add polyfills for es6-promise and fetch for those browsers that don't support them
closes #2
This commit is contained in:
@ -114,38 +114,46 @@ setup = (user) ->
|
|||||||
lastCookie = currentCookie
|
lastCookie = currentCookie
|
||||||
, 100
|
, 100
|
||||||
|
|
||||||
wiki.getScript '/security/winchan.js'
|
wiki.getScript '/security/modernizr-custom.js', () ->
|
||||||
if (!$("link[href='/security/style.css']").length)
|
console.log 'modernizr loaded'
|
||||||
$('<link rel="stylesheet" href="/security/style.css">').appendTo("head")
|
unless Modernizr.promises
|
||||||
myInit = {
|
require('es6-promise').polyfill()
|
||||||
method: 'GET'
|
|
||||||
cache: 'no-cache'
|
|
||||||
mode: 'same-origin'
|
|
||||||
}
|
|
||||||
fetch '/auth/client-settings.json', myInit
|
|
||||||
.then (response) ->
|
|
||||||
if response.ok
|
|
||||||
response.json().then (json) ->
|
|
||||||
settings = json
|
|
||||||
if settings.wikiHost
|
|
||||||
dialogHost = settings.wikiHost
|
|
||||||
else
|
|
||||||
dialogHost = window.location.hostname
|
|
||||||
settings.cookieDomain = dialogHost
|
|
||||||
if settings.useHttps
|
|
||||||
dialogProtocol = 'https:'
|
|
||||||
else
|
|
||||||
dialogProtocol = window.location.protocol
|
|
||||||
if window.location.port
|
|
||||||
dialogHost = dialogHost + ':' + window.location.port
|
|
||||||
if settings.usingPersona
|
|
||||||
settings.dialogURL = dialogProtocol + '//' + dialogHost + '/auth/personaLogin'
|
|
||||||
else
|
|
||||||
settings.dialogURL = dialogProtocol + '//' + dialogHost + '/auth/loginDialog'
|
|
||||||
settings.relayURL = dialogProtocol + '//' + dialogHost + '/auth/relay.html'
|
|
||||||
|
|
||||||
update_footer ownerName, isAuthenticated
|
unless Modernizr.fetch
|
||||||
else
|
require('whatwg-fetch')
|
||||||
console.log 'Unable to fetch client settings: ', response
|
|
||||||
|
wiki.getScript '/security/winchan.js'
|
||||||
|
if (!$("link[href='/security/style.css']").length)
|
||||||
|
$('<link rel="stylesheet" href="/security/style.css">').appendTo("head")
|
||||||
|
myInit = {
|
||||||
|
method: 'GET'
|
||||||
|
cache: 'no-cache'
|
||||||
|
mode: 'same-origin'
|
||||||
|
}
|
||||||
|
fetch '/auth/client-settings.json', myInit
|
||||||
|
.then (response) ->
|
||||||
|
if response.ok
|
||||||
|
response.json().then (json) ->
|
||||||
|
settings = json
|
||||||
|
if settings.wikiHost
|
||||||
|
dialogHost = settings.wikiHost
|
||||||
|
else
|
||||||
|
dialogHost = window.location.hostname
|
||||||
|
settings.cookieDomain = dialogHost
|
||||||
|
if settings.useHttps
|
||||||
|
dialogProtocol = 'https:'
|
||||||
|
else
|
||||||
|
dialogProtocol = window.location.protocol
|
||||||
|
if window.location.port
|
||||||
|
dialogHost = dialogHost + ':' + window.location.port
|
||||||
|
if settings.usingPersona
|
||||||
|
settings.dialogURL = dialogProtocol + '//' + dialogHost + '/auth/personaLogin'
|
||||||
|
else
|
||||||
|
settings.dialogURL = dialogProtocol + '//' + dialogHost + '/auth/loginDialog'
|
||||||
|
settings.relayURL = dialogProtocol + '//' + dialogHost + '/auth/relay.html'
|
||||||
|
|
||||||
|
update_footer ownerName, isAuthenticated
|
||||||
|
else
|
||||||
|
console.log 'Unable to fetch client settings: ', response
|
||||||
|
|
||||||
window.plugins.security = {setup, claim_wiki, update_footer}
|
window.plugins.security = {setup, claim_wiki, update_footer}
|
||||||
|
@ -9,13 +9,15 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"coffee-script": "1.10",
|
"coffee-script": "1.10",
|
||||||
|
"es6-promise": "^3.2.1",
|
||||||
"lodash": "^4.13.1",
|
"lodash": "^4.13.1",
|
||||||
"passport": "^0.3.2",
|
"passport": "^0.3.2",
|
||||||
"passport-github": "^1.1.0",
|
"passport-github": "^1.1.0",
|
||||||
"passport-google-oauth20": "^1.0.0",
|
"passport-google-oauth20": "^1.0.0",
|
||||||
"passport-twitter": "^1.0.4",
|
"passport-twitter": "^1.0.4",
|
||||||
"persona-pass": "^0.2.1",
|
"persona-pass": "^0.2.1",
|
||||||
"qs": "^6.2.0"
|
"qs": "^6.2.0",
|
||||||
|
"whatwg-fetch": "^1.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"coffeeify": "*",
|
"coffeeify": "*",
|
||||||
|
Reference in New Issue
Block a user