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>
|
||||
</select></p>
|
||||
<p>License: <select id="githubRepoLicense">
|
||||
<option value="">Will decide later</option>
|
||||
<option value="cc0-1.0">CC Zero (public domain, recommended)</option>
|
||||
<option value="">Will decide later / all rights reserved</option>
|
||||
<option value="cc0-1.0">CC Zero (public domain, remix-friendly)</option>
|
||||
<option value="mit">MIT (must preserve notices)</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>
|
||||
|
20
src/ui.ts
20
src/ui.ts
@ -1862,18 +1862,16 @@ function convertLegacyVCS(store) {
|
||||
|
||||
const useHTTPSCookieName = "__use_https";
|
||||
|
||||
function shouldRedirectHTTPS() {
|
||||
// cookie set?
|
||||
if (getCookie(useHTTPSCookieName)) {
|
||||
return true;
|
||||
function shouldRedirectHTTPS() : boolean {
|
||||
// cookie set? either true or false
|
||||
var shouldRedir = getCookie(useHTTPSCookieName);
|
||||
if (typeof shouldRedir === 'string') {
|
||||
return !!shouldRedir; // convert to bool
|
||||
}
|
||||
// is this our first time here? if so, set a 10yr cookie
|
||||
if (hasLocalStorage && !localStorage.getItem("__lastplatform")) {
|
||||
document.cookie = useHTTPSCookieName + "=1;domain=8bitworkshop.com;path=/;max-age=315360000";
|
||||
return true;
|
||||
}
|
||||
// we can't redirect, might still have HTTP files
|
||||
return false;
|
||||
// set a 10yr cookie, value depends on if it's our first time here
|
||||
var val = hasLocalStorage && !localStorage.getItem("__lastplatform") ? 1 : 0;
|
||||
document.cookie = useHTTPSCookieName + "=" + val + ";domain=8bitworkshop.com;path=/;max-age=315360000";
|
||||
return !!val;
|
||||
}
|
||||
|
||||
function redirectToHTTPS() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user