Skip to content

Commit

Permalink
enhancement: drop IE11 support (getfider#919)
Browse files Browse the repository at this point in the history
  • Loading branch information
goenning authored Mar 19, 2021
1 parent c7ddf76 commit 723cfe1
Show file tree
Hide file tree
Showing 16 changed files with 8 additions and 111 deletions.
6 changes: 3 additions & 3 deletions app/middlewares/security_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestSecureWithoutCDN(t *testing.T) {
return c.NoContent(http.StatusOK)
})

expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com ; script-src 'self' 'nonce-" + ctxID + "' https://cdn.polyfill.io https://js.stripe.com https://www.google-analytics.com ; img-src 'self' https: data: ; font-src 'self' https://fonts.gstatic.com data: ; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com https://ipinfo.io https://js.stripe.com ; frame-src 'self' https://js.stripe.com"
expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com ; script-src 'self' 'nonce-" + ctxID + "' https://js.stripe.com https://www.google-analytics.com ; img-src 'self' https: data: ; font-src 'self' https://fonts.gstatic.com data: ; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com https://ipinfo.io https://js.stripe.com ; frame-src 'self' https://js.stripe.com"

Expect(status).Equals(http.StatusOK)
Expect(response.Header().Get("Content-Security-Policy")).Equals(expectedPolicy)
Expand All @@ -46,7 +46,7 @@ func TestSecureWithCDN(t *testing.T) {
return c.NoContent(http.StatusOK)
})

expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com *.test.fider.io; script-src 'self' 'nonce-" + ctxID + "' https://cdn.polyfill.io https://js.stripe.com https://www.google-analytics.com *.test.fider.io; img-src 'self' https: data: *.test.fider.io; font-src 'self' https://fonts.gstatic.com data: *.test.fider.io; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com https://ipinfo.io https://js.stripe.com *.test.fider.io; frame-src 'self' https://js.stripe.com"
expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com *.test.fider.io; script-src 'self' 'nonce-" + ctxID + "' https://js.stripe.com https://www.google-analytics.com *.test.fider.io; img-src 'self' https: data: *.test.fider.io; font-src 'self' https://fonts.gstatic.com data: *.test.fider.io; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com https://ipinfo.io https://js.stripe.com *.test.fider.io; frame-src 'self' https://js.stripe.com"

Expect(status).Equals(http.StatusOK)
Expect(response.Header().Get("Content-Security-Policy")).Equals(expectedPolicy)
Expand All @@ -69,7 +69,7 @@ func TestSecureWithCDN_SingleHost(t *testing.T) {
return c.NoContent(http.StatusOK)
})

expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com test.fider.io; script-src 'self' 'nonce-" + ctxID + "' https://cdn.polyfill.io https://js.stripe.com https://www.google-analytics.com test.fider.io; img-src 'self' https: data: test.fider.io; font-src 'self' https://fonts.gstatic.com data: test.fider.io; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com https://ipinfo.io https://js.stripe.com test.fider.io; frame-src 'self' https://js.stripe.com"
expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com test.fider.io; script-src 'self' 'nonce-" + ctxID + "' https://js.stripe.com https://www.google-analytics.com test.fider.io; img-src 'self' https: data: test.fider.io; font-src 'self' https://fonts.gstatic.com data: test.fider.io; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com https://ipinfo.io https://js.stripe.com test.fider.io; frame-src 'self' https://js.stripe.com"

Expect(status).Equals(http.StatusOK)
Expect(response.Header().Get("Content-Security-Policy")).Equals(expectedPolicy)
Expand Down
2 changes: 1 addition & 1 deletion app/pkg/web/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
cspBase = "base-uri 'self'"
cspDefault = "default-src 'self'"
cspStyle = "style-src 'self' 'nonce-%[1]s' https://fonts.googleapis.com %[2]s"
cspScript = "script-src 'self' 'nonce-%[1]s' https://cdn.polyfill.io https://js.stripe.com https://www.google-analytics.com %[2]s"
cspScript = "script-src 'self' 'nonce-%[1]s' https://js.stripe.com https://www.google-analytics.com %[2]s"
cspFont = "font-src 'self' https://fonts.gstatic.com data: %[2]s"
cspImage = "img-src 'self' https: data: %[2]s"
cspObject = "object-src 'none'"
Expand Down
1 change: 0 additions & 1 deletion app/pkg/web/testdata/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ <h2>Please enable JavaScript</h2>
{"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}

</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,fetch" crossorigin="anonymous"></script>



Expand Down
1 change: 0 additions & 1 deletion app/pkg/web/testdata/canonical.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ <h2>Please enable JavaScript</h2>
{"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}

</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,fetch" crossorigin="anonymous"></script>



Expand Down
1 change: 0 additions & 1 deletion app/pkg/web/testdata/chunk.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ <h2>Please enable JavaScript</h2>
{"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}

</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,fetch" crossorigin="anonymous"></script>



Expand Down
1 change: 0 additions & 1 deletion app/pkg/web/testdata/oauth.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ <h2>Please enable JavaScript</h2>
{"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[{"provider":"google","displayName":"Google","clientID":"1234","url":"https://demo.test.fider.io:3000/oauth/google","callbackURL":"https://demo.test.fider.io:3000/oauth/google/callback","logoBlobKey":"google.png","isCustomProvider":false,"isEnabled":true}],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}

</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,fetch" crossorigin="anonymous"></script>



Expand Down
1 change: 0 additions & 1 deletion app/pkg/web/testdata/props.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ <h2>Please enable JavaScript</h2>
{"contextID":"CONTEXT_ID","description":"My Page Description","props":{"array":["1","2"],"number":2,"object":{"key1":"value1","key2":"value2"}},"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"My Page Title · Fider"}

</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,fetch" crossorigin="anonymous"></script>



Expand Down
1 change: 0 additions & 1 deletion app/pkg/web/testdata/tenant.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ <h2>Please enable JavaScript</h2>
{"contextID":"CONTEXT_ID","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":{"id":0,"name":"Game of Thrones","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"isPrivate":false,"logoBlobKey":""},"title":"Game of Thrones"}

</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,fetch" crossorigin="anonymous"></script>



Expand Down
1 change: 0 additions & 1 deletion app/pkg/web/testdata/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ <h2>Please enable JavaScript</h2>
{"contextID":"CONTEXT_ID","description":"My Page Description","props":null,"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"My Page Title · Fider","user":{"avatarBlobKey":"","avatarType":"gravatar","avatarURL":"https://demo.test.fider.io:3000/avatars/gravatar/5/Jon%20Snow","email":"[email protected]","id":5,"isAdministrator":true,"isCollaborator":true,"name":"Jon Snow","role":"administrator","status":"active"}}

</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,fetch" crossorigin="anonymous"></script>



Expand Down
2 changes: 1 addition & 1 deletion magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var requiredDeps = []string{
"golangci-lint",
}
var buildTime = time.Now().Format("2006.01.02.150405")
var buildNumber = os.Getenv("CIRCLE_BUILD_NUM")
var buildNumber = os.Getenv("GITHUB_RUN_ID")
var exeName = "fider"

var Aliases = map[string]interface{}{
Expand Down
7 changes: 1 addition & 6 deletions public/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ReactDOM from "react-dom";
import { resolveRootComponent } from "@fider/router";
import { Header, Footer, Loader } from "@fider/components/common";
import { ErrorBoundary } from "@fider/components";
import { classSet, Fider, FiderContext, actions, navigator } from "@fider/services";
import { classSet, Fider, FiderContext, actions } from "@fider/services";
import { IconContext } from "react-icons";

const Loading = () => (
Expand Down Expand Up @@ -38,11 +38,6 @@ window.addEventListener("error", (evt: ErrorEvent) => {
(() => {
let fider;

if (!navigator.isBrowserSupported()) {
navigator.goTo("/browser-not-supported");
return;
}

fider = Fider.initialize();

__webpack_nonce__ = fider.session.contextID;
Expand Down
32 changes: 0 additions & 32 deletions public/services/navigator.spec.ts

This file was deleted.

12 changes: 0 additions & 12 deletions public/services/navigator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,9 @@ import { Fider, http } from "@fider/services";
import { cache } from "./cache";

const navigator = {
userAgent: () => {
return window.navigator.userAgent || window.navigator.appVersion;
},
url: () => {
return window.location.href;
},
isBrowserSupported() {
const ua = this.userAgent();
const isIE = ua.indexOf("MSIE") >= 0;
if (isIE) {
// On IE, the only supported version is IE 11
return window.navigator.appVersion.indexOf("MSIE 11") >= 0;
}
return true;
},
goHome: () => {
window.location.href = "/";
},
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"target": "es5",
"target": "es6",
"strict": true,
"sourceMap": true,
"types": ["marked", "react", "react-dom", "react-textarea-autosize", "jest", "node"],
"outDir": "./output/public",
"jsx": "react",
"lib": ["dom", "es2015.promise", "es5"],
"lib": ["dom", "es2015.promise", "es6"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"baseUrl": "./public",
Expand Down
1 change: 0 additions & 1 deletion views/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ <h2>Please enable JavaScript</h2>
<script id="server-data" type="application/json">
{{template "server-data" .}}
</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,fetch" crossorigin="anonymous"></script>
{{template "end-of-body" .}}
{{ if .public.tenant }}
{{ if .public.tenant.CustomCSS }}
Expand Down
46 changes: 0 additions & 46 deletions views/browser-not-supported.html

This file was deleted.

0 comments on commit 723cfe1

Please sign in to comment.