|
@@ -11,6 +11,7 @@ import (
|
|
|
"imuslab.com/zoraxy/mod/acme"
|
|
|
"imuslab.com/zoraxy/mod/auth"
|
|
|
"imuslab.com/zoraxy/mod/database"
|
|
|
+ "imuslab.com/zoraxy/mod/dynamicproxy"
|
|
|
"imuslab.com/zoraxy/mod/dynamicproxy/redirection"
|
|
|
"imuslab.com/zoraxy/mod/ganserv"
|
|
|
"imuslab.com/zoraxy/mod/geodb"
|
|
@@ -238,4 +239,19 @@ func startupSequence() {
|
|
|
func finalSequence() {
|
|
|
//Start ACME renew agent
|
|
|
acmeRegisterSpecialRoutingRule()
|
|
|
+
|
|
|
+ //TODO: REMOVE THIS AFTER TESTING
|
|
|
+ dynamicProxyRouter.AddRoutingRules(&dynamicproxy.RoutingRule{
|
|
|
+ ID: "cloudflare-decoder",
|
|
|
+ MatchRule: func(r *http.Request) bool {
|
|
|
+ return strings.HasSuffix(r.RequestURI, "cloudflare-static/email-decode.min.js")
|
|
|
+ },
|
|
|
+ RoutingHandler: func(w http.ResponseWriter, r *http.Request) {
|
|
|
+ decoder := "function fixObfuscatedEmails(){let t=document.getElementsByClassName(\"__cf_email__\");for(let e=0;e<t.length;e++){let r=t[e],l=r.getAttribute(\"data-cfemail\");if(l){let a=decrypt(l);r.setAttribute(\"href\",\"mailto:\"+a),r.innerHTML=a}}}function decrypt(t){let e=\"\",r=parseInt(t.substr(0,2),16);for(let l=2;l<t.length;l+=2){let a=parseInt(t.substr(l,2),16)^r;e+=String.fromCharCode(a)}try{e=decodeURIComponent(escape(e))}catch(f){console.error(f)}return e}fixObfuscatedEmails();"
|
|
|
+ w.Header().Set("Content-type", "text/javascript")
|
|
|
+ w.Write([]byte(decoder))
|
|
|
+ },
|
|
|
+ Enabled: true,
|
|
|
+ UseSystemAccessControl: false,
|
|
|
+ })
|
|
|
}
|