mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-01-27 08:31:17 +00:00
new https cookie behavior
This commit is contained in:
parent
98423c7fa2
commit
0ea0ac2f60
@ -383,8 +383,8 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||||||
<option value="private">Private</option>
|
<option value="private">Private</option>
|
||||||
</select></p>
|
</select></p>
|
||||||
<p>License: <select id="githubRepoLicense">
|
<p>License: <select id="githubRepoLicense">
|
||||||
<option value="">Will decide later</option>
|
<option value="">Will decide later / all rights reserved</option>
|
||||||
<option value="cc0-1.0">CC Zero (public domain, recommended)</option>
|
<option value="cc0-1.0">CC Zero (public domain, remix-friendly)</option>
|
||||||
<option value="mit">MIT (must preserve notices)</option>
|
<option value="mit">MIT (must preserve notices)</option>
|
||||||
<option value="cc-by-4.0">CC BY (must attribute)</option>
|
<option value="cc-by-4.0">CC BY (must attribute)</option>
|
||||||
<option value="cc-by-sa-4.0">CC BY-SA (must attribute, use same license)</option>
|
<option value="cc-by-sa-4.0">CC BY-SA (must attribute, use same license)</option>
|
||||||
|
20
src/ui.ts
20
src/ui.ts
@ -1862,18 +1862,16 @@ function convertLegacyVCS(store) {
|
|||||||
|
|
||||||
const useHTTPSCookieName = "__use_https";
|
const useHTTPSCookieName = "__use_https";
|
||||||
|
|
||||||
function shouldRedirectHTTPS() {
|
function shouldRedirectHTTPS() : boolean {
|
||||||
// cookie set?
|
// cookie set? either true or false
|
||||||
if (getCookie(useHTTPSCookieName)) {
|
var shouldRedir = getCookie(useHTTPSCookieName);
|
||||||
return true;
|
if (typeof shouldRedir === 'string') {
|
||||||
|
return !!shouldRedir; // convert to bool
|
||||||
}
|
}
|
||||||
// is this our first time here? if so, set a 10yr cookie
|
// set a 10yr cookie, value depends on if it's our first time here
|
||||||
if (hasLocalStorage && !localStorage.getItem("__lastplatform")) {
|
var val = hasLocalStorage && !localStorage.getItem("__lastplatform") ? 1 : 0;
|
||||||
document.cookie = useHTTPSCookieName + "=1;domain=8bitworkshop.com;path=/;max-age=315360000";
|
document.cookie = useHTTPSCookieName + "=" + val + ";domain=8bitworkshop.com;path=/;max-age=315360000";
|
||||||
return true;
|
return !!val;
|
||||||
}
|
|
||||||
// we can't redirect, might still have HTTP files
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function redirectToHTTPS() {
|
function redirectToHTTPS() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user