Merge branch 'master' into paul90/jQuery
This commit is contained in:
commit
ff69116fbf
|
@ -1,3 +0,0 @@
|
|||
/*! modernizr 3.3.1 (Custom Build) | MIT *
|
||||
* https://modernizr.com/download/?-fetch-promises-setclasses !*/
|
||||
!function(e,n,s){function o(e,n){return typeof e===n}function i(){var e,n,s,i,a,f,l;for(var c in r)if(r.hasOwnProperty(c)){if(e=[],n=r[c],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(s=0;s<n.options.aliases.length;s++)e.push(n.options.aliases[s].toLowerCase());for(i=o(n.fn,"function")?n.fn():n.fn,a=0;a<e.length;a++)f=e[a],l=f.split("."),1===l.length?Modernizr[l[0]]=i:(!Modernizr[l[0]]||Modernizr[l[0]]instanceof Boolean||(Modernizr[l[0]]=new Boolean(Modernizr[l[0]])),Modernizr[l[0]][l[1]]=i),t.push((i?"":"no-")+l.join("-"))}}function a(e){var n=l.className,s=Modernizr._config.classPrefix||"";if(c&&(n=n.baseVal),Modernizr._config.enableJSClass){var o=new RegExp("(^|\\s)"+s+"no-js(\\s|$)");n=n.replace(o,"$1"+s+"js$2")}Modernizr._config.enableClasses&&(n+=" "+s+e.join(" "+s),c?l.className.baseVal=n:l.className=n)}var t=[],r=[],f={_version:"3.3.1",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var s=this;setTimeout(function(){n(s[e])},0)},addTest:function(e,n,s){r.push({name:e,fn:n,options:s})},addAsyncTest:function(e){r.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=f,Modernizr=new Modernizr,Modernizr.addTest("promises",function(){return"Promise"in e&&"resolve"in e.Promise&&"reject"in e.Promise&&"all"in e.Promise&&"race"in e.Promise&&function(){var n;return new e.Promise(function(e){n=e}),"function"==typeof n}()});var l=n.documentElement,c="svg"===l.nodeName.toLowerCase();Modernizr.addTest("fetch","fetch"in e),i(),a(t),delete f.addTest,delete f.addAsyncTest;for(var u=0;u<Modernizr._q.length;u++)Modernizr._q[u]();e.Modernizr=Modernizr}(window,document);
|
|
@ -15,9 +15,6 @@
|
|||
|
||||
settings = {}
|
||||
|
||||
# Mozilla Persona service closes on
|
||||
personaEnd = new Date('2016-11-30')
|
||||
|
||||
claim_wiki = () ->
|
||||
# we want to initiate a claim on a wiki
|
||||
#
|
||||
|
@ -82,53 +79,6 @@ update_footer = (ownerName, isAuthenticated) ->
|
|||
$('footer > #security > #claim').on 'click', (e) ->
|
||||
e.preventDefault()
|
||||
claim_wiki()
|
||||
else
|
||||
# only offer to add alternative id if using persona - at least initially.
|
||||
if settings.usingPersona
|
||||
$('footer > #security').append "<a href='#' id='addAltAuth' class='foot-item' title='Add Alternative Credentials'><i class='fa fa-user-plus fa-lg fa-fw'></i></a>"
|
||||
$('footer > #security > #addAltAuth').on 'click', (e) ->
|
||||
e.preventDefault
|
||||
|
||||
document.cookie = "wikiName=#{window.location.host}" + ";domain=.#{settings.cookieDomain}; path=/; max-age=300; sameSite=Strict;"
|
||||
|
||||
w = WinChan.open({
|
||||
url: settings.dialogAddAltURL
|
||||
relay_url: settings.relayURL
|
||||
window_features: "menubar=0, location=0, resizable=0, scrollbars=1, status=0, dialog=1, width=700, height=375"
|
||||
params: {}
|
||||
}, (err, r) ->
|
||||
if err
|
||||
console.log err
|
||||
else
|
||||
# add call to add alternative to owner here
|
||||
console.log 'send request to add owner identity'
|
||||
myInit = {
|
||||
method: 'GET'
|
||||
cache: 'no-cache'
|
||||
mode: 'same-origin'
|
||||
credentials: 'include'
|
||||
}
|
||||
fetch '/auth/addAltAuth', myInit
|
||||
.then (response) ->
|
||||
if response.ok
|
||||
console.log 'Alternative Identity added', response
|
||||
settings.usingPersona = false
|
||||
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
|
||||
settings.dialogURL = dialogProtocol + '//' + dialogHost + '/auth/loginDialog'
|
||||
update_footer ownerName, isAuthenticated
|
||||
else
|
||||
console.log 'Attempt to claim site failed', response
|
||||
)
|
||||
else
|
||||
if !isClaimed
|
||||
signonTitle = 'Claim this Wiki'
|
||||
|
@ -187,49 +137,38 @@ setup = (user) ->
|
|||
lastCookie = currentCookie
|
||||
, 100
|
||||
|
||||
wiki.getScript '/security/modernizr-custom.js', () ->
|
||||
console.log 'modernizr loaded'
|
||||
unless Modernizr.promises
|
||||
require('es6-promise').polyfill()
|
||||
|
||||
unless Modernizr.fetch
|
||||
require('whatwg-fetch')
|
||||
|
||||
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) ->
|
||||
window.isOwner = json.isOwner
|
||||
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'
|
||||
settings.dialogAddAltURL = dialogProtocol + '//' + dialogHost + '/auth/addAuthDialog'
|
||||
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) ->
|
||||
window.isOwner = json.isOwner
|
||||
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
|
||||
settings.dialogURL = dialogProtocol + '//' + dialogHost + '/auth/loginDialog'
|
||||
settings.relayURL = dialogProtocol + '//' + dialogHost + '/auth/relay.html'
|
||||
settings.dialogAddAltURL = dialogProtocol + '//' + dialogHost + '/auth/addAuthDialog'
|
||||
|
||||
|
||||
update_footer ownerName, isAuthenticated
|
||||
else
|
||||
console.log 'Unable to fetch client settings: ', response
|
||||
update_footer ownerName, isAuthenticated
|
||||
else
|
||||
console.log 'Unable to fetch client settings: ', response
|
||||
|
||||
window.plugins.security = {setup, claim_wiki, update_footer}
|
||||
|
|
|
@ -35,6 +35,7 @@ Sometimes, you'll be able to look up the URLs by visiting your provider's
|
|||
```JSON
|
||||
{
|
||||
"farm": true,
|
||||
"admin": {"oauth2": "ID VALUE FROM OWNER.JSON FILE OF ADMIN"},
|
||||
"security_type": "passportjs",
|
||||
"oauth2_clientID": "CLIENT ID",
|
||||
"oauth2_clientSecret": "CLIENT SECRET",
|
||||
|
@ -48,6 +49,7 @@ Sometimes, you'll be able to look up the URLs by visiting your provider's
|
|||
```JSON
|
||||
{
|
||||
"farm": true,
|
||||
"admin": {"oauth2": "ID VALUE FROM OWNER.JSON FILE OF ADMIN"},
|
||||
"security_type": "passportjs",
|
||||
"oauth2_clientID": "CLIENT ID",
|
||||
"oauth2_clientSecret": "CLIENT SECRET",
|
||||
|
|
|
@ -9,7 +9,7 @@ Configuration of Passport security plug-ins is a two stage process:
|
|||
|
||||
The legacy Mozilla Persona Passport plug-in does not require any configuration.
|
||||
|
||||
This plug-in comes with support for using GitHub, Google, and Twitter. Although the configuration process is broadly the same for each of these, there are some slight differences.
|
||||
This plug-in comes with support for using GitHub, Google, Twitter, and generic OAuth. Although the configuration process is broadly the same for each of these, there are some slight differences.
|
||||
|
||||
As a wiki server owner you need to pick one, or more, of these that you want to use.
|
||||
|
||||
|
|
|
@ -11,15 +11,11 @@
|
|||
"dependencies": {
|
||||
"@passport-js/passport-twitter": "^1.0.8",
|
||||
"coffeescript": "^2.4.1",
|
||||
"es6-promise": "^4.2.8",
|
||||
"lodash": "^4.17.19",
|
||||
"passport": "^0.3.2",
|
||||
"passport-github2": "^0.1.12",
|
||||
"passport-google-oauth20": "^2.0.0",
|
||||
"passport-oauth2": "^1.6.1",
|
||||
"persona-pass": "^0.2.1",
|
||||
"qs": "^6.7.0",
|
||||
"whatwg-fetch": "^3.2.0"
|
||||
"passport-oauth2": "^1.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coffeeify": "^3.0.1",
|
||||
|
@ -57,9 +53,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@passport-js/passport-twitter/node_modules/@xmldom/xmldom": {
|
||||
"version": "0.8.6",
|
||||
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.6.tgz",
|
||||
"integrity": "sha512-uRjjusqpoqfmRkTaNuLJ2VohVr67Q5YwDATW3VU7PfzTj6IRaihGrYI7zckGZjxQPBIp63nfvJbM+Yu5ICh0Bg==",
|
||||
"version": "0.8.7",
|
||||
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.7.tgz",
|
||||
"integrity": "sha512-sI1Ly2cODlWStkINzqGrZ8K6n+MTSbAeQnAipGyL+KZCXuHaRlj2gyyy8B/9MvsFFqN7XHryQnB2QwhzvJXovg==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
|
@ -70,9 +66,9 @@
|
|||
"integrity": "sha512-a5ERWK1kh38ExDEfoO6qUHJb32rd7aYmPHuyCu3Fta/cnICvYmgd2uhuKXvPD+PXB+gCEYYEaQdIRAjCOwAKNA=="
|
||||
},
|
||||
"node_modules/@passport-js/passport-twitter/node_modules/passport-oauth1": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/passport-oauth1/-/passport-oauth1-1.2.0.tgz",
|
||||
"integrity": "sha512-Sv2YWodC6jN12M/OXwmR4BIXeeIHjjbwYTQw4kS6tHK4zYzSEpxBgSJJnknBjICA5cj0ju3FSnG1XmHgIhYnLg==",
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/passport-oauth1/-/passport-oauth1-1.3.0.tgz",
|
||||
"integrity": "sha512-8T/nX4gwKTw0PjxP1xfD0QhrydQNakzeOpZ6M5Uqdgz9/a/Ag62RmJxnZQ4LkbdXGrRehQHIAHNAu11rCP46Sw==",
|
||||
"dependencies": {
|
||||
"oauth": "0.9.x",
|
||||
"passport-strategy": "1.x.x",
|
||||
|
@ -146,9 +142,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/coffeeify/node_modules/readable-stream": {
|
||||
"version": "2.3.7",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
||||
"version": "2.3.8",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
|
||||
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"core-util-is": "~1.0.0",
|
||||
|
@ -212,11 +208,6 @@
|
|||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/es6-promise": {
|
||||
"version": "4.2.8",
|
||||
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
|
||||
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w=="
|
||||
},
|
||||
"node_modules/grunt": {
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/grunt/-/grunt-1.6.1.tgz",
|
||||
|
@ -647,9 +638,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/grunt-browserify/node_modules/browserify-sign/node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
|
@ -1179,9 +1170,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/grunt-browserify/node_modules/hash-base/node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
|
@ -1341,9 +1332,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/grunt-browserify/node_modules/is-core-module": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz",
|
||||
"integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==",
|
||||
"version": "2.12.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz",
|
||||
"integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has": "^1.0.3"
|
||||
|
@ -1518,9 +1509,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/grunt-browserify/node_modules/minimist": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
|
||||
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==",
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||
"dev": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
|
@ -1778,9 +1769,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/grunt-browserify/node_modules/readable-stream": {
|
||||
"version": "2.3.7",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
||||
"version": "2.3.8",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
|
||||
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"core-util-is": "~1.0.0",
|
||||
|
@ -1820,12 +1811,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/grunt-browserify/node_modules/resolve": {
|
||||
"version": "1.22.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
||||
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
|
||||
"version": "1.22.2",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz",
|
||||
"integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-core-module": "^2.9.0",
|
||||
"is-core-module": "^2.11.0",
|
||||
"path-parse": "^1.0.7",
|
||||
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||
},
|
||||
|
@ -1895,9 +1886,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/grunt-browserify/node_modules/shell-quote": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.0.tgz",
|
||||
"integrity": "sha512-QHsz8GgQIGKlRi24yFc6a6lN69Idnx634w49ay6+jA5yFh7a1UY+4Rp6HPx/L/1zcEDPEij8cIsiqR6bQsE5VQ==",
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz",
|
||||
"integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==",
|
||||
"dev": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
|
@ -1943,9 +1934,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/grunt-browserify/node_modules/stream-browserify/node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
|
@ -1979,9 +1970,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/grunt-browserify/node_modules/stream-http/node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
|
@ -2181,9 +2172,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/grunt-browserify/node_modules/watchify/node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
|
@ -2296,6 +2287,19 @@
|
|||
"integrity": "sha512-/x68VkHLeTl3/Ll8IvxdwzhrT+IyKc52e/oyHhA2RwqPqswSnjVbSddfPRwAsJtbilMAPSRWwAlpxdYsSWOTKQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/call-bind": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
|
||||
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1",
|
||||
"get-intrinsic": "^1.0.2"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
|
@ -2344,6 +2348,12 @@
|
|||
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/gaze": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz",
|
||||
|
@ -2356,6 +2366,20 @@
|
|||
"node": ">= 4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/get-intrinsic": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
|
||||
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-symbols": "^1.0.3"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/glob": {
|
||||
"version": "7.1.7",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
|
||||
|
@ -2390,6 +2414,30 @@
|
|||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/has-symbols": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/http-parser-js": {
|
||||
"version": "0.5.8",
|
||||
"resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz",
|
||||
|
@ -2445,6 +2493,15 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/object-inspect": {
|
||||
"version": "1.12.3",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
|
||||
"integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
|
||||
"dev": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
|
@ -2463,6 +2520,21 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/qs": {
|
||||
"version": "6.11.1",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.1.tgz",
|
||||
"integrity": "sha512-0wsrzgTz/kAVIeuxSjnpGC56rzYtr6JT/2BwEvMaPhFIoYa1aGO8LbzuU1R0uUYQkLpWBTOj0l/CLAJB64J6nQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"side-channel": "^1.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/raw-body": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-1.1.7.tgz",
|
||||
|
@ -2502,6 +2574,20 @@
|
|||
"integrity": "sha512-o0JmTu17WGUaUOHa1l0FPGXKBfijbxK6qoHzlkihsDXxzBHvJcA7zgviKR92Xs841rX9pK16unfphLq0/KqX7A==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/side-channel": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
||||
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.0",
|
||||
"get-intrinsic": "^1.0.2",
|
||||
"object-inspect": "^1.9.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/grunt-contrib-watch/node_modules/string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
||||
|
@ -3106,9 +3192,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/grunt/node_modules/is-core-module": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz",
|
||||
"integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==",
|
||||
"version": "2.12.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz",
|
||||
"integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has": "^1.0.3"
|
||||
|
@ -3482,12 +3568,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/grunt/node_modules/resolve": {
|
||||
"version": "1.22.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
||||
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
|
||||
"version": "1.22.2",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz",
|
||||
"integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-core-module": "^2.9.0",
|
||||
"is-core-module": "^2.11.0",
|
||||
"path-parse": "^1.0.7",
|
||||
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||
},
|
||||
|
@ -3666,9 +3752,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/passport-oauth2": {
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/passport-oauth2/-/passport-oauth2-1.6.1.tgz",
|
||||
"integrity": "sha512-ZbV43Hq9d/SBSYQ22GOiglFsjsD1YY/qdiptA+8ej+9C1dL1TVB+mBE5kDH/D4AJo50+2i8f4bx0vg4/yDDZCQ==",
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/passport-oauth2/-/passport-oauth2-1.7.0.tgz",
|
||||
"integrity": "sha512-j2gf34szdTF2Onw3+76alNnaAExlUmHvkc7cL+cmaS5NzHzDP/BvFHJruueQ9XAeNOdpI+CH+PWid8RA7KCwAQ==",
|
||||
"dependencies": {
|
||||
"base64url": "3.x.x",
|
||||
"oauth": "0.9.x",
|
||||
|
@ -3730,126 +3816,6 @@
|
|||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz",
|
||||
"integrity": "sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg=="
|
||||
},
|
||||
"node_modules/persona-pass": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/persona-pass/-/persona-pass-0.2.1.tgz",
|
||||
"integrity": "sha512-duQEWInryiupZxXJ9NpeF1FNHFWYqqD1FSwY+Ymn8dms67fLMjTd6k7WOU3VwmgMV9ef49djoFXpZLVdg3Fqfg==",
|
||||
"dependencies": {
|
||||
"passport-strategy": "^1.0.0",
|
||||
"pkginfo": "0.2.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/persona-pass/node_modules/passport-strategy": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz",
|
||||
"integrity": "sha512-CB97UUvDKJde2V0KDWWB3lyf6PC3FaZP7YxZ2G8OAtn9p4HI9j9JLP9qjOGZFvyl8uwNT8qM+hGnz/n16NI7oA==",
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/persona-pass/node_modules/pkginfo": {
|
||||
"version": "0.2.3",
|
||||
"resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.2.3.tgz",
|
||||
"integrity": "sha512-7W7wTrE/NsY8xv/DTGjwNIyNah81EQH0MWcTzrHL6pOpMocOGZc0Mbdz9aXxSrp+U0mSmkU8jrNCDCfUs3sOBg==",
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.11.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
|
||||
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/qs/node_modules/call-bind": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
|
||||
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1",
|
||||
"get-intrinsic": "^1.0.2"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/qs/node_modules/function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
|
||||
},
|
||||
"node_modules/qs/node_modules/get-intrinsic": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
|
||||
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-symbols": "^1.0.3"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/qs/node_modules/has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/qs/node_modules/has-symbols": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/qs/node_modules/object-inspect": {
|
||||
"version": "1.12.3",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
|
||||
"integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/qs/node_modules/side-channel": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
||||
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.0",
|
||||
"get-intrinsic": "^1.0.2",
|
||||
"object-inspect": "^1.9.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/whatwg-fetch": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz",
|
||||
"integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,15 +7,11 @@
|
|||
"dependencies": {
|
||||
"@passport-js/passport-twitter": "^1.0.8",
|
||||
"coffeescript": "^2.4.1",
|
||||
"es6-promise": "^4.2.8",
|
||||
"lodash": "^4.17.19",
|
||||
"passport": "^0.3.2",
|
||||
"passport-github2": "^0.1.12",
|
||||
"passport-google-oauth20": "^2.0.0",
|
||||
"passport-oauth2": "^1.6.1",
|
||||
"persona-pass": "^0.2.1",
|
||||
"qs": "^6.7.0",
|
||||
"whatwg-fetch": "^3.2.0"
|
||||
"passport-oauth2": "^1.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coffeeify": "^3.0.1",
|
||||
|
|
|
@ -11,7 +11,6 @@ fs = require 'fs'
|
|||
path = require 'path'
|
||||
|
||||
https = require 'https'
|
||||
qs = require 'qs'
|
||||
|
||||
url = require 'url'
|
||||
|
||||
|
@ -38,7 +37,6 @@ module.exports = exports = (log, loga, argv) ->
|
|||
statusDir = argv.status
|
||||
|
||||
idFile = argv.id
|
||||
usingPersona = false
|
||||
|
||||
if argv.security_useHttps
|
||||
useHttps = true
|
||||
|
@ -56,26 +54,6 @@ module.exports = exports = (log, loga, argv) ->
|
|||
|
||||
ids = []
|
||||
|
||||
# Mozilla Persona service closes on
|
||||
personaEnd = new Date('2016-11-30')
|
||||
|
||||
watchForOwnerChange = ->
|
||||
# we watch for owner changes, so we can update the information held here
|
||||
fs.watch(idFile, (eventType, filename) ->
|
||||
# re-read the owner file
|
||||
fs.readFile(idFile, (err, data) ->
|
||||
if err
|
||||
console.log 'Error reading ', idFile, err
|
||||
return
|
||||
owner = JSON.parse(data)
|
||||
usingPersona = false
|
||||
if _.isEmpty(_.intersection(_.keys(owner), ids))
|
||||
if _.has(owner, 'persona')
|
||||
usingPersona = true
|
||||
ownerName = owner.name
|
||||
)
|
||||
)
|
||||
|
||||
#### Public stuff ####
|
||||
|
||||
# Attempt to figure out if the wiki is claimed or not,
|
||||
|
@ -87,11 +65,6 @@ module.exports = exports = (log, loga, argv) ->
|
|||
fs.readFile(idFile, (err, data) ->
|
||||
if err then return cb err
|
||||
owner = JSON.parse(data)
|
||||
# we only enable persona if it is the only owner information.
|
||||
if _.isEmpty(_.intersection(_.keys(owner), ids))
|
||||
if _.has(owner, 'persona')
|
||||
usingPersona = true
|
||||
watchForOwnerChange()
|
||||
cb())
|
||||
else
|
||||
owner = ''
|
||||
|
@ -109,10 +82,9 @@ module.exports = exports = (log, loga, argv) ->
|
|||
if !exists
|
||||
fs.writeFile(idFile, JSON.stringify(id), (err) ->
|
||||
if err then return cb err
|
||||
console.log "Claiming wiki #{wikiName} for #{id}"
|
||||
console.log "Claiming wiki #{wikiName} for #{id.name}"
|
||||
owner = id
|
||||
ownerName = owner.name
|
||||
watchForOwnerChange()
|
||||
cb())
|
||||
else
|
||||
cb('Already Claimed')
|
||||
|
@ -140,11 +112,6 @@ module.exports = exports = (log, loga, argv) ->
|
|||
return true
|
||||
else
|
||||
return false
|
||||
when 'persona'
|
||||
if _.isEqual(owner[idProvider].email, req.session.passport.user[idProvider].email)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
else
|
||||
return false
|
||||
catch error
|
||||
|
@ -170,11 +137,6 @@ module.exports = exports = (log, loga, argv) ->
|
|||
return true
|
||||
else
|
||||
return false
|
||||
when "persona"
|
||||
if _.isEqual(admin[idProvider], req.session.passport.user[idProvider].email)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
else
|
||||
return false
|
||||
|
||||
|
@ -323,24 +285,6 @@ module.exports = exports = (log, loga, argv) ->
|
|||
}
|
||||
cb(null, user)))
|
||||
|
||||
# Persona Strategy
|
||||
PersonaStrategy = require('persona-pass').Strategy
|
||||
|
||||
personaAudience = callbackProtocol + '//' + callbackHost
|
||||
|
||||
personaStrategyName = callbackHost + 'Persona'
|
||||
|
||||
passport.use(personaStrategyName, new PersonaStrategy({
|
||||
audience: personaAudience
|
||||
}, (email, cb) ->
|
||||
user = {
|
||||
persona: {
|
||||
email: email
|
||||
}
|
||||
}
|
||||
cb(null, user)))
|
||||
|
||||
|
||||
app.use(passport.initialize())
|
||||
app.use(passport.session())
|
||||
|
||||
|
@ -367,16 +311,11 @@ module.exports = exports = (log, loga, argv) ->
|
|||
app.get('/auth/google/callback',
|
||||
passport.authenticate(googleStrategyName, { prompt: 'select_account', successRedirect: '/auth/loginDone', failureRedirect: '/auth/loginDialog'}))
|
||||
|
||||
# Persona
|
||||
app.post('/auth/browserid',
|
||||
passport.authenticate(personaStrategyName, { successRedirect: '/auth/loginDone', failureRedirect: '/auth/loginDialog'}))
|
||||
|
||||
|
||||
app.get '/auth/client-settings.json', (req, res) ->
|
||||
# the client needs some information to configure itself
|
||||
settings = {
|
||||
useHttps: useHttps
|
||||
usingPersona: usingPersona
|
||||
}
|
||||
if wikiHost
|
||||
settings.wikiHost = wikiHost
|
||||
|
@ -417,47 +356,6 @@ module.exports = exports = (log, loga, argv) ->
|
|||
}
|
||||
res.render(path.join(__dirname, '..', 'views', 'securityDialog.html'), info)
|
||||
|
||||
app.get '/auth/personaLogin', (req, res) ->
|
||||
cookies = req.cookies
|
||||
schemeButtons = []
|
||||
if Date.now() < personaEnd
|
||||
schemeButtons.push({
|
||||
button: "<a href='#' id='browserid' class='scheme-button persona-button'><span>Persona</span></a>
|
||||
<script>
|
||||
$('#browserid').click(function(){
|
||||
navigator.id.get(function(assertion) {
|
||||
if (assertion) {
|
||||
$('input').val(assertion);
|
||||
$('form').submit();
|
||||
} else {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>"})
|
||||
info = {
|
||||
wikiName: cookies['wikiName']
|
||||
wikiHostName: if wikiHost
|
||||
"part of " + req.hostname + " wiki farm"
|
||||
else
|
||||
"a federated wiki site"
|
||||
title: "Federated Wiki: Site Owner Sign-on"
|
||||
loginText: "Sign in to"
|
||||
message: "Mozilla Persona closes on 30th November 2016. Wiki owners should add an alternative identity as soon as they are able."
|
||||
schemes: schemeButtons
|
||||
}
|
||||
else
|
||||
info = {
|
||||
wikiName: cookies['wikiName']
|
||||
wikiHostName: if wikiHost
|
||||
"part of " + req.hostname + " wiki farm"
|
||||
else
|
||||
"a federated wiki site"
|
||||
title: "Federated Wiki: Site Owner Sign-on"
|
||||
message: "Mozilla Persona has now closed. Wiki owners will need to contact the Wiki Farm owner to re-claim their wiki."
|
||||
}
|
||||
res.render(path.join(__dirname, '..', 'views', 'personaDialog.html'), info)
|
||||
|
||||
app.get '/auth/loginDone', (req, res) ->
|
||||
cookies = req.cookies
|
||||
|
||||
|
@ -569,94 +467,12 @@ module.exports = exports = (log, loga, argv) ->
|
|||
console.log 'rejecting - not authorized', req.path
|
||||
res.sendStatus(403)
|
||||
|
||||
app.get '/auth/addAltAuth', authorized, (req, res) ->
|
||||
# add alternative authorentication scheme - only makes sense if user owns this site
|
||||
res.status(202).end()
|
||||
|
||||
user = req.session.passport.user
|
||||
|
||||
idProviders = _.keys(user)
|
||||
userIds = {}
|
||||
idProviders.forEach (idProvider) ->
|
||||
id = switch idProvider
|
||||
when "oauth2" then {
|
||||
name: user.oauth2.displayName
|
||||
oauth2: {
|
||||
id: user.oauth2.id
|
||||
username: user.oauth2.username
|
||||
}
|
||||
}
|
||||
when "twitter" then {
|
||||
name: user.twitter.displayName
|
||||
twitter: {
|
||||
id: user.twitter.id
|
||||
username: user.twitter.username
|
||||
}
|
||||
}
|
||||
when "github" then {
|
||||
name: user.github.displayName
|
||||
github: {
|
||||
id: user.github.id
|
||||
username: user.github.username
|
||||
email: user.github.emails
|
||||
}
|
||||
}
|
||||
when "google" then {
|
||||
name: user.google.displayName
|
||||
google: {
|
||||
id: user.google.id
|
||||
emails: user.google.emails
|
||||
}
|
||||
}
|
||||
# only needed until persona closes
|
||||
when "persona" then {
|
||||
name: user.persona.email
|
||||
.substr(0, user.persona.email.indexOf('@'))
|
||||
.split('.')
|
||||
.join(' ')
|
||||
.toLowerCase()
|
||||
.replace(/(^| )(\w)/g, (x) ->
|
||||
return x.toUpperCase())
|
||||
persona: {
|
||||
email: user.persona.email
|
||||
}
|
||||
}
|
||||
userIds = _.merge(userIds, id)
|
||||
|
||||
wikiDir = path.resolve(argv.data, '..')
|
||||
statusDir = argv.status.split(path.sep).slice(-1)[0]
|
||||
idFileName = path.parse(idFile).base
|
||||
|
||||
pattern = '*/' + statusDir + '/' + idFileName
|
||||
|
||||
glob(pattern, {cwd: wikiDir}, (err, files) ->
|
||||
_.forEach files, (file) ->
|
||||
# are we the owner?
|
||||
fs.readFile(path.join(wikiDir, file), 'utf8', (err, data) ->
|
||||
if err
|
||||
console.log 'Error reading ', file, err
|
||||
return
|
||||
siteOwner = JSON.parse(data)
|
||||
|
||||
if _.intersectionWith(_.entries(siteOwner), _.entries(user), _.isEqual).length > 0
|
||||
updateOwner = _.merge(user, siteOwner)
|
||||
fs.writeFile(path.join(wikiDir, file), JSON.stringify(userIds), (err) ->
|
||||
if err
|
||||
console.log 'Error writing ', file, err
|
||||
# if the write works the change will be picked up by fs.watch() in watchForOwnerChange
|
||||
# so there is nothing more to do here.
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
app.get '/auth/claim-wiki', (req, res) ->
|
||||
if owner
|
||||
console.log 'Claim Request Ignored: Wiki already has owner - ', wikiName
|
||||
res.sendStatus(403)
|
||||
else
|
||||
user = req.session.passport.user
|
||||
# there can be more than one id provider - initially only if we logged in with persona
|
||||
idProviders = _.keys(user)
|
||||
|
||||
id = {}
|
||||
|
@ -691,19 +507,6 @@ module.exports = exports = (log, loga, argv) ->
|
|||
emails: user.google.emails
|
||||
}
|
||||
}
|
||||
# only needed until persona closes
|
||||
when "persona" then {
|
||||
name: user.persona.email
|
||||
.substr(0, user.persona.email.indexOf('@'))
|
||||
.split('.')
|
||||
.join(' ')
|
||||
.toLowerCase()
|
||||
.replace(/(^| )(\w)/g, (x) ->
|
||||
return x.toUpperCase())
|
||||
persona: {
|
||||
email: user.persona.email
|
||||
}
|
||||
}
|
||||
|
||||
if _.isEmpty(id)
|
||||
console.log 'Unable to claim wiki', req.hostname, ' no valid id provided'
|
||||
|
|
Loading…
Reference in New Issue