Browse Source

first commit

master
Luna 8 months ago
parent
commit
4010581834
2 changed files with 23 additions and 3 deletions
  1. 22
    3
      data/public/index.html
  2. 1
    0
      docker-compose.yml

+ 22
- 3
data/public/index.html View File

@@ -19,9 +19,15 @@
19 19
 		 document.getElementById('in').style.display = 'none';
20 20
 	
21 21
 		 var iframe = document.createElement('iframe');
22
-		 var url = decodeURIComponent(window.top.location.toString().replace(/^.*\?to=(.*)$/, '$1'));
22
+		 var ourl = window.top.location.toString();
23
+		 var url = ourl.replace(/^.*\?to=(.*)$/, '$1');
24
+		 if (url == ourl)
25
+		 url = location.protocol + '//' + location.host.replace(/[^\.\/]+\.([^\.\/]+\.[^\.\/]+)/, '$1');
26
+		 if (url == ourl)
27
+		 url = 'https://can-i.help/';
28
+		 
23 29
 		 iframe.style.display = 'none';
24
-		 iframe.src = 'javascript:window.top.location.replace("'+url.replace(/"/g, '"')+'")';
30
+		 iframe.src = 'javascript:window.top.location.replace("'+decodeURIComponent(url).replace(/"/g, '"')+'")';
25 31
  		 iframe.referrerpolicy = "no-referrer";
26 32
 		 document.getElementsByTagName('body')[0].appendChild(iframe);
27 33
 		 clearInterval(interval);
@@ -35,12 +41,24 @@
35 41
     <style>
36 42
       html, body { margin: 0; padding: 0; box-sizing: border-box; line-height: normal; text-align: center; font-family: monospace; font-size: 30px; }
37 43
       header {
38
-      margin: 50px 0 0;
44
+      margin: 50px 0;
39 45
       padding: 10px 20px;
40 46
       }
41 47
       #in {
42 48
       font-size: 12px; margin-top: 8px;
43 49
       }
50
+footer {
51
+position: fixed;
52
+    bottom: 0;
53
+    left: 0;
54
+    right: 0;
55
+    padding: 10px;
56
+    font-size: 10px;
57
+}
58
+footer a {
59
+color: #777;
60
+    text-decoration: none;
61
+}
44 62
       </style>
45 63
   </head>
46 64
   <body>
@@ -48,5 +66,6 @@
48 66
       Redirecting..
49 67
       <div id="in">in <span>2s</span></div>
50 68
       </header>
69
+<footer><a href="https://code.can-i.help/luna/luna-noreferrer-redirect">Source code</a></footer>
51 70
   </body>
52 71
 </html>

+ 1
- 0
docker-compose.yml View File

@@ -8,6 +8,7 @@ services:
8 8
       dockerfile: Dockerfile
9 9
       args:
10 10
         APACHE_VERSION: ${APACHE_VERSION}
11
+    restart: always
11 12
     volumes:
12 13
     - ./data/public:/var/www/html:rw
13 14
     - ./logs/apache:/apache-logs:rw

Loading…
Cancel
Save