From 8aad02dbf2d7df061e98cdb540427659cc227ec2 Mon Sep 17 00:00:00 2001
From: ArtemBaskal <a.baskal@adguard.com>
Date: Thu, 30 Apr 2020 18:50:05 +0300
Subject: [PATCH 1/5] + client: Add icons for Apple products

---
 client/public/apple-touch-icon-180x180.png | Bin 0 -> 2137 bytes
 client/public/index.html                   |   2 ++
 client/public/install.html                 |   2 ++
 client/public/login.html                   |   2 ++
 client/public/safari-pinned-tab.svg        |  16 ++++++++++++++++
 5 files changed, 22 insertions(+)
 create mode 100644 client/public/apple-touch-icon-180x180.png
 create mode 100644 client/public/safari-pinned-tab.svg

diff --git a/client/public/apple-touch-icon-180x180.png b/client/public/apple-touch-icon-180x180.png
new file mode 100644
index 0000000000000000000000000000000000000000..ebc0be5067efcf4d8366a70cb7a4777327d9cfc4
GIT binary patch
literal 2137
zcmV-f2&VUmP)<h;3K|Lk000e1NJLTq006WA006WI0{{R33KRAK0007lP)t-s|NsB)
z_wUT-(74>crq!>P&7z9NmVd#Fb-aXcxPNW8d~3CPYP5Q2w0dZ>d1tbDYQ1xAzjt%N
ze0Rftd&Pr*$B2Z<jEl^Ym(iW1*Qv1FwY}oO%IMA3?b+n><@Wpc<nrgf;KZTQs(HSL
zXuNT9!Fz|wkDSw@vE8-B=E>Uc-0}JI{r~-|*0OWDf_1`ulh2vW>Cox+>i+-!vf8<Y
z#FB8pc&pm5((Bdg_Uy3QxP-)!Y_@!c$&K{;^~dDRX}xmb^5XgZ`GLZYX|sBG#DS*R
zto;7``26{+*RyfJdY;sz&gs$0=Ffw|kEq$M;`8L0&ZEEM!@}aoc)f;gzIB_^q22J`
zl*^uY!+^TszH7d8X|#HN#)gf}l$Fq%jmMa?-ng04pWN`?@c8kr+q1yq#H-e`z~RRG
z{riQ;jN9+u*zViV>eHpys`dN!X}ogi_33W6e#hp^`TY5V$cuZwiN)o~qSmLO)uxZh
zn!@D8w%@y{*0I0h!shho;qv3T;Jvioxw720n9ibgxrLw3s=VFA%;nO_<Il9&y^Y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%GSSGa^HW9p*E
zoq?-()3GW#KL{?wJc|(OHpc|l@<&_WW{@OFk|arzBuSDaNs=T<k{sYW#kPSKf_w5I
P00000NkvXXu0mjf28pKS

literal 0
HcmV?d00001

diff --git a/client/public/index.html b/client/public/index.html
index 56d4bfda..8bd0eaf6 100644
--- a/client/public/index.html
+++ b/client/public/index.html
@@ -6,6 +6,8 @@
         <meta name="theme-color" content="#000000">
         <meta name="google" content="notranslate">
         <meta http-equiv="x-dns-prefetch-control" content="off">
+        <link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon-180x180.png" />
+        <link rel="mask-icon" href="./safari-pinned-tab.svg" color="#5bbad5">
         <link rel="icon" type="image/png" href="favicon.png" sizes="48x48">
         <title>AdGuard Home</title>
     </head>
diff --git a/client/public/install.html b/client/public/install.html
index 2fd3bb7d..51858294 100644
--- a/client/public/install.html
+++ b/client/public/install.html
@@ -5,6 +5,8 @@
         <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
         <meta name="theme-color" content="#000000">
         <meta name="google" content="notranslate">
+        <link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon-180x180.png" />
+        <link rel="mask-icon" href="./safari-pinned-tab.svg" color="#5bbad5">
         <link rel="icon" type="image/png" href="favicon.png" sizes="48x48">
         <title>Setup AdGuard Home</title>
     </head>
diff --git a/client/public/login.html b/client/public/login.html
index 03179b42..7e45e484 100644
--- a/client/public/login.html
+++ b/client/public/login.html
@@ -5,6 +5,8 @@
         <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
         <meta name="theme-color" content="#000000">
         <meta name="google" content="notranslate">
+        <link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon-180x180.png" />
+        <link rel="mask-icon" href="./safari-pinned-tab.svg" color="#5bbad5">
         <link rel="icon" type="image/png" href="favicon.png" sizes="48x48">
         <title>Login</title>
     </head>
diff --git a/client/public/safari-pinned-tab.svg b/client/public/safari-pinned-tab.svg
new file mode 100644
index 00000000..d2cd031d
--- /dev/null
+++ b/client/public/safari-pinned-tab.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
+ width="144.000000pt" height="144.000000pt" viewBox="0 0 144.000000 144.000000"
+ preserveAspectRatio="xMidYMid meet">
+<metadata>
+Created by potrace 1.11, written by Peter Selinger 2001-2013
+</metadata>
+<g transform="translate(0.000000,144.000000) scale(0.100000,-0.100000)"
+fill="#000000" stroke="none">
+<path d="M485 1424 c-159 -24 -332 -74 -449 -130 l-39 -19 6 -130 c4 -71 13
+-166 21 -210 66 -364 268 -656 608 -883 89 -59 79 -59 176 4 336 218 540 516
+608 884 11 60 14 91 20 216 l6 120 -78 33 c-267 112 -604 156 -879 115z"/>
+</g>
+</svg>

From 26ac9e422488998290ddfe4db1b0ceaabca0441c Mon Sep 17 00:00:00 2001
From: ArtemBaskal <a.baskal@adguard.com>
Date: Thu, 14 May 2020 12:06:22 +0300
Subject: [PATCH 2/5] Add icons to server

---
 home/auth.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/home/auth.go b/home/auth.go
index c72ca546..5e6c59f6 100644
--- a/home/auth.go
+++ b/home/auth.go
@@ -381,6 +381,8 @@ func optionalAuth(handler func(http.ResponseWriter, *http.Request)) func(http.Re
 			}
 
 		} else if r.URL.Path == "/favicon.png" ||
+			r.URL.Path == "/safari-pinned-tab.svg" ||
+			strings.HasPrefix(r.URL.Path, "/apple-touch-icon") ||
 			strings.HasPrefix(r.URL.Path, "/login.") ||
 			strings.HasPrefix(r.URL.Path, "/__locales/") {
 			// process as usual

From 5f13d4ab4a2a02eed867aabab0da094d63936ceb Mon Sep 17 00:00:00 2001
From: ArtemBaskal <a.baskal@adguard.com>
Date: Thu, 14 May 2020 14:45:16 +0300
Subject: [PATCH 3/5] Add assets folder

---
 .../{ => assets}/apple-touch-icon-180x180.png       | Bin
 client/public/{ => assets}/favicon.png              | Bin
 client/public/{ => assets}/safari-pinned-tab.svg    |   0
 client/public/index.html                            |   6 +++---
 client/public/install.html                          |   6 +++---
 client/public/login.html                            |   6 +++---
 client/webpack.common.js                            |   5 +++--
 home/auth.go                                        |   4 +---
 8 files changed, 13 insertions(+), 14 deletions(-)
 rename client/public/{ => assets}/apple-touch-icon-180x180.png (100%)
 rename client/public/{ => assets}/favicon.png (100%)
 rename client/public/{ => assets}/safari-pinned-tab.svg (100%)

diff --git a/client/public/apple-touch-icon-180x180.png b/client/public/assets/apple-touch-icon-180x180.png
similarity index 100%
rename from client/public/apple-touch-icon-180x180.png
rename to client/public/assets/apple-touch-icon-180x180.png
diff --git a/client/public/favicon.png b/client/public/assets/favicon.png
similarity index 100%
rename from client/public/favicon.png
rename to client/public/assets/favicon.png
diff --git a/client/public/safari-pinned-tab.svg b/client/public/assets/safari-pinned-tab.svg
similarity index 100%
rename from client/public/safari-pinned-tab.svg
rename to client/public/assets/safari-pinned-tab.svg
diff --git a/client/public/index.html b/client/public/index.html
index 8bd0eaf6..ecf811ec 100644
--- a/client/public/index.html
+++ b/client/public/index.html
@@ -6,9 +6,9 @@
         <meta name="theme-color" content="#000000">
         <meta name="google" content="notranslate">
         <meta http-equiv="x-dns-prefetch-control" content="off">
-        <link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon-180x180.png" />
-        <link rel="mask-icon" href="./safari-pinned-tab.svg" color="#5bbad5">
-        <link rel="icon" type="image/png" href="favicon.png" sizes="48x48">
+        <link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon-180x180.png" />
+        <link rel="mask-icon" href="assets/safari-pinned-tab.svg" color="#5bbad5">
+        <link rel="icon" type="image/png" href="assets/favicon.png" sizes="48x48">
         <title>AdGuard Home</title>
     </head>
     <body>
diff --git a/client/public/install.html b/client/public/install.html
index 51858294..3a09704c 100644
--- a/client/public/install.html
+++ b/client/public/install.html
@@ -5,9 +5,9 @@
         <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
         <meta name="theme-color" content="#000000">
         <meta name="google" content="notranslate">
-        <link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon-180x180.png" />
-        <link rel="mask-icon" href="./safari-pinned-tab.svg" color="#5bbad5">
-        <link rel="icon" type="image/png" href="favicon.png" sizes="48x48">
+        <link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon-180x180.png" />
+        <link rel="mask-icon" href="assets/safari-pinned-tab.svg" color="#5bbad5">
+        <link rel="icon" type="image/png" href="assets/favicon.png" sizes="48x48">
         <title>Setup AdGuard Home</title>
     </head>
     <body>
diff --git a/client/public/login.html b/client/public/login.html
index 7e45e484..9f06fc03 100644
--- a/client/public/login.html
+++ b/client/public/login.html
@@ -5,9 +5,9 @@
         <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
         <meta name="theme-color" content="#000000">
         <meta name="google" content="notranslate">
-        <link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon-180x180.png" />
-        <link rel="mask-icon" href="./safari-pinned-tab.svg" color="#5bbad5">
-        <link rel="icon" type="image/png" href="favicon.png" sizes="48x48">
+        <link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon-180x180.png" />
+        <link rel="mask-icon" href="assets/safari-pinned-tab.svg" color="#5bbad5">
+        <link rel="icon" type="image/png" href="assets/favicon.png" sizes="48x48">
         <title>Login</title>
     </head>
     <body>
diff --git a/client/webpack.common.js b/client/webpack.common.js
index 99b6dbae..f4f0bae4 100644
--- a/client/webpack.common.js
+++ b/client/webpack.common.js
@@ -14,9 +14,10 @@ const ENTRY_LOGIN = path.resolve(RESOURCES_PATH, 'src/login/index.js');
 const HTML_PATH = path.resolve(RESOURCES_PATH, 'public/index.html');
 const HTML_INSTALL_PATH = path.resolve(RESOURCES_PATH, 'public/install.html');
 const HTML_LOGIN_PATH = path.resolve(RESOURCES_PATH, 'public/login.html');
-const FAVICON_PATH = path.resolve(RESOURCES_PATH, 'public/favicon.png');
+const ASSETS_PATH = path.resolve(RESOURCES_PATH, 'public/assets');
 
 const PUBLIC_PATH = path.resolve(__dirname, '../build/static');
+const PUBLIC_ASSETS_PATH = path.resolve(PUBLIC_PATH, 'assets');
 
 const config = {
     target: 'web',
@@ -134,7 +135,7 @@ const config = {
             filename: '[name].[contenthash].css',
         }),
         new CopyPlugin([
-            { from: FAVICON_PATH, to: PUBLIC_PATH },
+            { from: ASSETS_PATH, to: PUBLIC_ASSETS_PATH },
         ]),
     ],
 };
diff --git a/home/auth.go b/home/auth.go
index 5e6c59f6..36aa53fe 100644
--- a/home/auth.go
+++ b/home/auth.go
@@ -380,9 +380,7 @@ func optionalAuth(handler func(http.ResponseWriter, *http.Request)) func(http.Re
 				}
 			}
 
-		} else if r.URL.Path == "/favicon.png" ||
-			r.URL.Path == "/safari-pinned-tab.svg" ||
-			strings.HasPrefix(r.URL.Path, "/apple-touch-icon") ||
+		} else if strings.HasPrefix(r.URL.Path,"/assets/") ||
 			strings.HasPrefix(r.URL.Path, "/login.") ||
 			strings.HasPrefix(r.URL.Path, "/__locales/") {
 			// process as usual

From 11d65330a093090e335cfa7ab1d048bd1647a2d4 Mon Sep 17 00:00:00 2001
From: ArtemBaskal <a.baskal@adguard.com>
Date: Thu, 14 May 2020 15:03:00 +0300
Subject: [PATCH 4/5] Fix go lint warning

---
 home/auth.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/home/auth.go b/home/auth.go
index 36aa53fe..82918f78 100644
--- a/home/auth.go
+++ b/home/auth.go
@@ -380,7 +380,7 @@ func optionalAuth(handler func(http.ResponseWriter, *http.Request)) func(http.Re
 				}
 			}
 
-		} else if strings.HasPrefix(r.URL.Path,"/assets/") ||
+		} else if strings.HasPrefix(r.URL.Path, "/assets/") ||
 			strings.HasPrefix(r.URL.Path, "/login.") ||
 			strings.HasPrefix(r.URL.Path, "/__locales/") {
 			// process as usual

From 502fe3cfc5feea46f287854d0c3ebb9e66676bdd Mon Sep 17 00:00:00 2001
From: Andrey Meshkov <am@adguard.com>
Date: Thu, 14 May 2020 18:37:25 +0300
Subject: [PATCH 5/5] *(home): fix assets access

---
 home/auth.go    | 5 ++---
 home/control.go | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/home/auth.go b/home/auth.go
index 82918f78..a2d6d5f2 100644
--- a/home/auth.go
+++ b/home/auth.go
@@ -381,10 +381,9 @@ func optionalAuth(handler func(http.ResponseWriter, *http.Request)) func(http.Re
 			}
 
 		} else if strings.HasPrefix(r.URL.Path, "/assets/") ||
-			strings.HasPrefix(r.URL.Path, "/login.") ||
-			strings.HasPrefix(r.URL.Path, "/__locales/") {
+			strings.HasPrefix(r.URL.Path, "/login.") {
 			// process as usual
-
+			// no additional auth requirements
 		} else if Context.auth != nil && Context.auth.AuthRequired() {
 			// redirect to login page if not authenticated
 			ok := false
diff --git a/home/control.go b/home/control.go
index 310b9f20..744fc327 100644
--- a/home/control.go
+++ b/home/control.go
@@ -188,7 +188,7 @@ func postInstall(handler func(http.ResponseWriter, *http.Request)) func(http.Res
 
 		if Context.firstRun &&
 			!strings.HasPrefix(r.URL.Path, "/install.") &&
-			r.URL.Path != "/favicon.png" {
+			!strings.HasPrefix(r.URL.Path, "/assets/") {
 			http.Redirect(w, r, "/install.html", http.StatusFound)
 			return
 		}