Merge pull request #41 from BytewaveMLP/discord-auth

Discord OAuth support
This commit is contained in:
Erik McClure
2019-08-30 18:11:53 -07:00
committed by GitHub
11 changed files with 131 additions and 59 deletions
+15
View File
@@ -107,6 +107,21 @@ Get OAuth keys for authentication platform of your choice (github, google, twitt
}, },
``` ```
### Discord
- Go to https://discordapp.com/developers/applications/ and create a new app
- Navigate to the OAuth2 tab
- Add `http://<your domain>/auth/discord/callback` (or `http://localhost:8090/auth/discord/callback` for your localhost server) as a redirect URI
- Navigate back to the General Information tab
- Add this to the `oauth` field in your `config.json`
```json
"discord": {
"clientID": "<your_client_id>",
"clientSecret": "<your_client_secret>"
},
```
### Other ### Other
If you want to add other sign-in methods you need to find appropriate [passport](http://www.passportjs.org/) package and add it in `src/ts/server/oauth.ts` and add correct entry in `config.json`. If you want to add other sign-in methods you need to find appropriate [passport](http://www.passportjs.org/) package and add it in `src/ts/server/oauth.ts` and add correct entry in `config.json`.
+85 -49
View File
@@ -5,9 +5,9 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@angular-devkit/core": { "@angular-devkit/core": {
"version": "8.3.1", "version": "8.3.2",
"resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-8.3.1.tgz", "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-8.3.2.tgz",
"integrity": "sha512-H92REifFygP4a/0fsnshiz31KsuaHRrRHwfT67tVxPnN8rwWnTWkf5gxFwG8ezcBMnR5eVLBb/Xisnc/+A/8Kw==", "integrity": "sha512-jFrBGPJBhy4D4foH9YHDrlbqGmb+ZivTKtHnR4yV241VUd3W53+KABrvPyHeS5xk/aHTRsm76rx6l+UREEEUkw==",
"requires": { "requires": {
"ajv": "6.10.2", "ajv": "6.10.2",
"fast-json-stable-stringify": "2.0.0", "fast-json-stable-stringify": "2.0.0",
@@ -53,9 +53,9 @@
} }
}, },
"@angular/animations": { "@angular/animations": {
"version": "8.2.3", "version": "8.2.4",
"resolved": "https://registry.npmjs.org/@angular/animations/-/animations-8.2.3.tgz", "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-8.2.4.tgz",
"integrity": "sha512-kumEi9s8/cCNkndmETbAN7eSBfPkHGgX1up8ynsRgpjX7PTiGpsKMP0rxJBt281fqQPL/D6G3yZOyC5YfsP5+g==", "integrity": "sha512-EHTvA5ugoFiYVwi9SyozJORWcBhUIn06VbNa2uhQQdOUrsbvKBCF0PpH2nZZJz7wsQ6Pyonizee8vgea8/X59Q==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
@@ -70,25 +70,25 @@
} }
}, },
"@angular/common": { "@angular/common": {
"version": "8.2.3", "version": "8.2.4",
"resolved": "https://registry.npmjs.org/@angular/common/-/common-8.2.3.tgz", "resolved": "https://registry.npmjs.org/@angular/common/-/common-8.2.4.tgz",
"integrity": "sha512-Y8ttd66bAApnJgxjndVnBP0aMsID8AzttR2TKp1KpdDKy4n6td22+1DeHZJqPMOBwoTDEdjHZqFQ7XRNYe3IVw==", "integrity": "sha512-sPeTkor3uf8T3MvpekS0ZQe9K/yzlHBSoMyT0bIPOYeDTHUph3f/0XyYhH7KSGXLo7tSw1Mx9Ua05nQ+VHtLGQ==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"@angular/compiler": { "@angular/compiler": {
"version": "8.2.3", "version": "8.2.4",
"resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-8.2.3.tgz", "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-8.2.4.tgz",
"integrity": "sha512-CDUiYXdy7jIwhK3aeBwz4Bik3eQUORVWDVuO8fsVot7CODE4jIkETUdeWuYuEpwPX7dkjsFvuT4btiwzZfrCUg==", "integrity": "sha512-LYaYhQlW3GFiXrNywJBYQtsLOWmUFcgudacF1m7QHHhlljnkG3BqkosbT0Dkcl7ayrIDYT/ZMTkVmaiGvgAhnw==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"@angular/compiler-cli": { "@angular/compiler-cli": {
"version": "8.2.3", "version": "8.2.4",
"resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-8.2.3.tgz", "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-8.2.4.tgz",
"integrity": "sha512-KdUBhno+b9hIjM3lQOm39IHgSCex6vJa5dmjfCfcNUhT3BVs2nTtJ4uLMqJMI776KCf3y3zNJ5XUd8jMpgoxdQ==", "integrity": "sha512-tN269yWPbJsetzmO8x/Bx7wLwqCfnD8BYoJsBFPcZOZpW0cfELzVdY13R325WB1uXiMrVN0lskNtPBLe9OcMTA==",
"requires": { "requires": {
"canonical-path": "1.0.0", "canonical-path": "1.0.0",
"chokidar": "^2.1.1", "chokidar": "^2.1.1",
@@ -343,41 +343,41 @@
} }
}, },
"@angular/core": { "@angular/core": {
"version": "8.2.3", "version": "8.2.4",
"resolved": "https://registry.npmjs.org/@angular/core/-/core-8.2.3.tgz", "resolved": "https://registry.npmjs.org/@angular/core/-/core-8.2.4.tgz",
"integrity": "sha512-wNlq6r0RI8q0BCr3I16NHfteliJLVjZN3MsLfzYi4u08LcGTemGL9YwcVjCOPEH4xREo3xX0ebvmuLwObu75lQ==", "integrity": "sha512-8FSdkUSb5S4+K2w49iLzrQF/jzcmoRnOogFZQ8CctiXQHSVHHF8AjpoFpFVUAI6/77UVL8CehlyBSKF5EE1Z8A==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"@angular/forms": { "@angular/forms": {
"version": "8.2.3", "version": "8.2.4",
"resolved": "https://registry.npmjs.org/@angular/forms/-/forms-8.2.3.tgz", "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-8.2.4.tgz",
"integrity": "sha512-BDphHWx6FI3wfOd9XqhiUBKuIg4dnpr9Aw5+n1by4y9e2avBwWoefHJ15FtEZdop5qMwVWlCcHjdwZ2+q65f4g==", "integrity": "sha512-TsaMrfy/Ls9kpxxlkqaPSQCL3DWqIzh3fMd0aGXTjcsEFI3gztttAmE/dlU0dtVsQxD0M9cdqjjPqi0TGamfTw==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"@angular/platform-browser": { "@angular/platform-browser": {
"version": "8.2.3", "version": "8.2.4",
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-8.2.3.tgz", "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-8.2.4.tgz",
"integrity": "sha512-hKC5V2n0jfrFc9DXvHW+NtHDSfC417WZz8onmUhMR2Eo3fjBm5cuZi5CNgnbZt9zUoXXOfwCy6p3N7FbPDXxLQ==", "integrity": "sha512-3nd71h6S4RT9lHu9mVGD/741O+8MBSjI1A0V8H/LjT79yWnkxoR6BgZA7KL76AeTTITagUcVIuxtNAaxssgLHg==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"@angular/platform-browser-dynamic": { "@angular/platform-browser-dynamic": {
"version": "8.2.3", "version": "8.2.4",
"resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-8.2.3.tgz", "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-8.2.4.tgz",
"integrity": "sha512-rH7tpOwJ6r8+085bOmXUI9/v9MxFfsL+BYzi6bG2vCU280cSblvZR2Rx9nqx3/+Xd97ISWkUZiQhyRVJWYk6UQ==", "integrity": "sha512-qn84B796UZIl1KB+YcxwFCx/Ze439Zf7G8ZK+xKsUA16H0R6GswAgBndnYq8xFjww1g4dY7zNH/XZ2FKngETKA==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"@angular/platform-server": { "@angular/platform-server": {
"version": "8.2.3", "version": "8.2.4",
"resolved": "https://registry.npmjs.org/@angular/platform-server/-/platform-server-8.2.3.tgz", "resolved": "https://registry.npmjs.org/@angular/platform-server/-/platform-server-8.2.4.tgz",
"integrity": "sha512-esVJSOX6GYGzW8Rsmn/FwZl2cpsH24lWsPNmIQHe61qXCmuLrjWKrsefrWq8FMpUfyPqZNC4QuwNWZ1yeA/Hrw==", "integrity": "sha512-SpvpGDEcJ748okD3ExbhQUVoOBm9QKGCeynuRg4aEusXKJ3TZ9/IiJLMjyc87YeRC6+4YU4zymT3JaaTxD8C2g==",
"requires": { "requires": {
"domino": "^2.1.2", "domino": "^2.1.2",
"tslib": "^1.9.0", "tslib": "^1.9.0",
@@ -385,9 +385,9 @@
} }
}, },
"@angular/router": { "@angular/router": {
"version": "8.2.3", "version": "8.2.4",
"resolved": "https://registry.npmjs.org/@angular/router/-/router-8.2.3.tgz", "resolved": "https://registry.npmjs.org/@angular/router/-/router-8.2.4.tgz",
"integrity": "sha512-PMZ5JA0GonaNpwV3VfGWUkL6eo2KbtYUZERu6AnTYpQTTzGBiS6pakQTczE7lb9KZ9u+LIhKBaxQ8hrGLWqgKw==", "integrity": "sha512-ZJwsztlD1vbb2HF9SgvHfpIK82BkOlDP2OmdZZavnxV7RstbU5hUkJ4lB4JB/EN9B76djo117CwOxxIveOhJMQ==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
@@ -722,11 +722,11 @@
} }
}, },
"@ngtools/webpack": { "@ngtools/webpack": {
"version": "8.3.1", "version": "8.3.2",
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-8.3.1.tgz", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-8.3.2.tgz",
"integrity": "sha512-VGlVnrRwCN8M5YMk8psf9qbKsOKMSuHnJnIczs5sqI9dvjx+B2oAA/+B+BJoBBnDqXccBvintPV+HSgxfnbA0A==", "integrity": "sha512-7HnciOy2I/UdVYyp6BCDnLcyLaGIuxPLJHLbQPdkyG2sEwxX+lWd+/+W8RSPmjDEwAe0xvSxLTCY14T/8DneVQ==",
"requires": { "requires": {
"@angular-devkit/core": "8.3.1", "@angular-devkit/core": "8.3.2",
"enhanced-resolve": "4.1.0", "enhanced-resolve": "4.1.0",
"rxjs": "6.4.0", "rxjs": "6.4.0",
"tree-kill": "1.2.1", "tree-kill": "1.2.1",
@@ -1059,9 +1059,9 @@
} }
}, },
"@types/mongoose": { "@types/mongoose": {
"version": "5.5.15", "version": "5.5.16",
"resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.5.15.tgz", "resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.5.16.tgz",
"integrity": "sha512-LgUHpGl6mmcyzjZR/afUZ7mDPjDd38mA0HCf8vL11otVKiNGyu7ug8z3ePx2QAqcPrxbtfaJVgirdBeNXYG54Q==", "integrity": "sha512-He7VRmleSucCi63v2Hihy+ii1IqG4nTuXWsNrYXeCk7cBZ4J7jufbNcUNjswsDlSr9Ir1Eai/AQC9qDtecsXtA==",
"requires": { "requires": {
"@types/mongodb": "*", "@types/mongodb": "*",
"@types/node": "*" "@types/node": "*"
@@ -1076,9 +1076,9 @@
} }
}, },
"@types/node": { "@types/node": {
"version": "12.7.2", "version": "12.7.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.2.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.3.tgz",
"integrity": "sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg==" "integrity": "sha512-3SiLAIBkDWDg6vFo0+5YJyHPWU9uwu40Qe+v+0MH8wRKYBimHvvAOyk3EzMrD/TrIlLYfXrqDqrg913PynrMJQ=="
}, },
"@types/node-ipc": { "@types/node-ipc": {
"version": "9.1.1", "version": "9.1.1",
@@ -1088,6 +1088,14 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"@types/oauth": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@types/oauth/-/oauth-0.9.1.tgz",
"integrity": "sha512-a1iY62/a3yhZ7qH7cNUsxoI3U/0Fe9+RnuFrpTKr+0WVOzbKlSLojShCKe20aOD1Sppv+i8Zlq0pLDuTJnwS4A==",
"requires": {
"@types/node": "*"
}
},
"@types/passport": { "@types/passport": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.1.tgz", "resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.1.tgz",
@@ -1096,6 +1104,16 @@
"@types/express": "*" "@types/express": "*"
} }
}, },
"@types/passport-discord": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@types/passport-discord/-/passport-discord-0.1.3.tgz",
"integrity": "sha512-IQiIF+QAWzAqOKuUJvnMyEeTF6ib9DwjQpOODWawB+cxNiv2Om5csdhX+eLyKRhMtnW4+Em8AMGFunwvB859eQ==",
"requires": {
"@types/express": "*",
"@types/passport": "*",
"@types/passport-oauth2": "*"
}
},
"@types/passport-local": { "@types/passport-local": {
"version": "1.0.33", "version": "1.0.33",
"resolved": "https://registry.npmjs.org/@types/passport-local/-/passport-local-1.0.33.tgz", "resolved": "https://registry.npmjs.org/@types/passport-local/-/passport-local-1.0.33.tgz",
@@ -1106,6 +1124,16 @@
"@types/passport-strategy": "*" "@types/passport-strategy": "*"
} }
}, },
"@types/passport-oauth2": {
"version": "1.4.8",
"resolved": "https://registry.npmjs.org/@types/passport-oauth2/-/passport-oauth2-1.4.8.tgz",
"integrity": "sha512-tlX16wyFE5YJR2pHpZ308dgB1MV9/Ra2wfQh71eWk+/umPoD1Rca2D4N5M27W7nZm1wqUNGTk1I864nHvEgiFA==",
"requires": {
"@types/express": "*",
"@types/oauth": "*",
"@types/passport": "*"
}
},
"@types/passport-strategy": { "@types/passport-strategy": {
"version": "0.2.33", "version": "0.2.33",
"resolved": "https://registry.npmjs.org/@types/passport-strategy/-/passport-strategy-0.2.33.tgz", "resolved": "https://registry.npmjs.org/@types/passport-strategy/-/passport-strategy-0.2.33.tgz",
@@ -14531,6 +14559,14 @@
"pkginfo": "0.2.x" "pkginfo": "0.2.x"
} }
}, },
"passport-discord": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/passport-discord/-/passport-discord-0.1.3.tgz",
"integrity": "sha512-o8+KiQrV63DCJvYVceyVJgyFhHxqOPlcxaiB8Hlrrm0uq83KfQOMPUcXal0pao5Qx8ZeOH/RBJEbJV9aB0F/hw==",
"requires": {
"passport-oauth2": "^1.2.0"
}
},
"passport-github2": { "passport-github2": {
"version": "0.1.11", "version": "0.1.11",
"resolved": "https://registry.npmjs.org/passport-github2/-/passport-github2-0.1.11.tgz", "resolved": "https://registry.npmjs.org/passport-github2/-/passport-github2-0.1.11.tgz",
@@ -17689,9 +17725,9 @@
} }
}, },
"rollbar": { "rollbar": {
"version": "2.12.2", "version": "2.12.3",
"resolved": "https://registry.npmjs.org/rollbar/-/rollbar-2.12.2.tgz", "resolved": "https://registry.npmjs.org/rollbar/-/rollbar-2.12.3.tgz",
"integrity": "sha512-KUZ3dhR55HNhVS1fsBc3UC8Sdh53T1tVMGhRY8IXxDHWxVCQIGH8HTMZ7mFGcidS0WQkNG9ElsTiV9B8IEpyBw==", "integrity": "sha512-r+d3YiRr8U5ucpI19YzO081UIN7vXRTRsRMtSnLwgfoOUmCMHJPklYMbV0bhfGYyGpq7LAej7N89O6aI3zMGtw==",
"requires": { "requires": {
"async": "~1.2.1", "async": "~1.2.1",
"buffer-from": ">=1.1", "buffer-from": ">=1.1",
@@ -18456,9 +18492,9 @@
"integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=" "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM="
}, },
"sourcemap-codec": { "sourcemap-codec": {
"version": "1.4.4", "version": "1.4.6",
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.4.tgz", "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz",
"integrity": "sha512-CYAPYdBu34781kLHkaW3m6b/uUSyMOC2R61gcYMWooeuaGtjof86ZA/8T+qVPPt7np1085CR9hmMGrySwEc8Xg==" "integrity": "sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg=="
}, },
"sparkles": { "sparkles": {
"version": "1.0.1", "version": "1.0.1",
+3 -1
View File
@@ -86,6 +86,7 @@
"@types/node": "^12.7.2", "@types/node": "^12.7.2",
"@types/node-ipc": "^9.1.1", "@types/node-ipc": "^9.1.1",
"@types/passport": "^1.0.1", "@types/passport": "^1.0.1",
"@types/passport-discord": "^0.1.3",
"@types/passport-local": "^1.0.33", "@types/passport-local": "^1.0.33",
"@types/pug": "^2.0.4", "@types/pug": "^2.0.4",
"@types/request": "^2.48.2", "@types/request": "^2.48.2",
@@ -155,6 +156,7 @@
"parallel-webpack": "^2.4.0", "parallel-webpack": "^2.4.0",
"passport": "^0.4.0", "passport": "^0.4.0",
"passport-deviantart": "0.0.5", "passport-deviantart": "0.0.5",
"passport-discord": "^0.1.3",
"passport-github2": "^0.1.11", "passport-github2": "^0.1.11",
"passport-local": "^1.0.0", "passport-local": "^1.0.0",
"passport-patreon": "^1.0.1", "passport-patreon": "^1.0.1",
@@ -187,7 +189,7 @@
"tslib": "^1.10.0", "tslib": "^1.10.0",
"tslint": "^5.19.0", "tslint": "^5.19.0",
"tsutils": "^3.17.1", "tsutils": "^3.17.1",
"typescript": "^3.5.3", "typescript": "<3.6.0",
"ua-parser-js": "^0.7.20", "ua-parser-js": "^0.7.20",
"uglifyjs-webpack-plugin": "^1.3.0", "uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "^4.39.3", "webpack": "^4.39.3",
+1 -1
View File
@@ -565,7 +565,7 @@ export class PonyTownGame implements Game {
this.drawOptions.tileGrid = !this.drawOptions.tileGrid; this.drawOptions.tileGrid = !this.drawOptions.tileGrid;
}); });
addDebugShortcut(7, 'grayscale', () => { addDebugShortcut(7, 'grayscale', () => {
document.documentElement.style.filter = document.documentElement.style.filter ? null : 'grayscale(100%)'; document.documentElement.style.filter = document.documentElement.style.filter ? '' : 'grayscale(100%)';
}); });
addDebugShortcut(8, 'show regions', () => { addDebugShortcut(8, 'show regions', () => {
this.debug.showRegions = !this.debug.showRegions; this.debug.showRegions = !this.debug.showRegions;
+3
View File
@@ -137,6 +137,7 @@ import {
faLinux, faLinux,
faAmilia, faAmilia,
faYandexInternational, faYandexInternational,
faDiscord
} from '../generated/fa-icons'; } from '../generated/fa-icons';
export { export {
@@ -145,6 +146,7 @@ export {
faTwitter, faTwitter,
faTumblr, faTumblr,
faGithub, faGithub,
faDiscord
} from '../generated/fa-icons'; } from '../generated/fa-icons';
export const partyLeaderIcon = faCrown; export const partyLeaderIcon = faCrown;
@@ -164,6 +166,7 @@ export const oauthIcons: { [key: string]: any; } = {
github: faGithub, github: faGithub,
vkontakte: faVk, vkontakte: faVk,
google: faGoogle, google: faGoogle,
discord: faDiscord
}; };
export const uaIcons: { [key: string]: any; } = { export const uaIcons: { [key: string]: any; } = {
+1
View File
@@ -43,6 +43,7 @@ export const faCrown = {'prefix':'fas','iconName':'crown','icon':[640,512,[],'f5
export const faDatabase = {'prefix':'fas','iconName':'database','icon':[448,512,[],'f1c0','M448 73.143v45.714C448 159.143 347.667 192 224 192S0 159.143 0 118.857V73.143C0 32.857 100.333 0 224 0s224 32.857 224 73.143zM448 176v102.857C448 319.143 347.667 352 224 352S0 319.143 0 278.857V176c48.125 33.143 136.208 48.572 224 48.572S399.874 209.143 448 176zm0 160v102.857C448 479.143 347.667 512 224 512S0 479.143 0 438.857V336c48.125 33.143 136.208 48.572 224 48.572S399.874 369.143 448 336z']}; export const faDatabase = {'prefix':'fas','iconName':'database','icon':[448,512,[],'f1c0','M448 73.143v45.714C448 159.143 347.667 192 224 192S0 159.143 0 118.857V73.143C0 32.857 100.333 0 224 0s224 32.857 224 73.143zM448 176v102.857C448 319.143 347.667 352 224 352S0 319.143 0 278.857V176c48.125 33.143 136.208 48.572 224 48.572S399.874 209.143 448 176zm0 160v102.857C448 479.143 347.667 512 224 512S0 479.143 0 438.857V336c48.125 33.143 136.208 48.572 224 48.572S399.874 369.143 448 336z']};
export const faDesktop = {'prefix':'fas','iconName':'desktop','icon':[576,512,[],'f108','M528 0H48C21.5 0 0 21.5 0 48v320c0 26.5 21.5 48 48 48h192l-16 48h-72c-13.3 0-24 10.7-24 24s10.7 24 24 24h272c13.3 0 24-10.7 24-24s-10.7-24-24-24h-72l-16-48h192c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zm-16 352H64V64h448v288z']}; export const faDesktop = {'prefix':'fas','iconName':'desktop','icon':[576,512,[],'f108','M528 0H48C21.5 0 0 21.5 0 48v320c0 26.5 21.5 48 48 48h192l-16 48h-72c-13.3 0-24 10.7-24 24s10.7 24 24 24h272c13.3 0 24-10.7 24-24s-10.7-24-24-24h-72l-16-48h192c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zm-16 352H64V64h448v288z']};
export const faDeviantart = {'prefix':'fab','iconName':'deviantart','icon':[320,512,[],'f1bd','M320 93.2l-98.2 179.1 7.4 9.5H320v127.7H159.1l-13.5 9.2-43.7 84c-.3 0-8.6 8.6-9.2 9.2H0v-93.2l93.2-179.4-7.4-9.2H0V102.5h156l13.5-9.2 43.7-84c.3 0 8.6-8.6 9.2-9.2H320v93.1z']}; export const faDeviantart = {'prefix':'fab','iconName':'deviantart','icon':[320,512,[],'f1bd','M320 93.2l-98.2 179.1 7.4 9.5H320v127.7H159.1l-13.5 9.2-43.7 84c-.3 0-8.6 8.6-9.2 9.2H0v-93.2l93.2-179.4-7.4-9.2H0V102.5h156l13.5-9.2 43.7-84c.3 0 8.6-8.6 9.2-9.2H320v93.1z']};
export const faDiscord = {'prefix':'fab','iconName':'discord','icon':[448,512,[],'f392','M297.216 243.2c0 15.616-11.52 28.416-26.112 28.416-14.336 0-26.112-12.8-26.112-28.416s11.52-28.416 26.112-28.416c14.592 0 26.112 12.8 26.112 28.416zm-119.552-28.416c-14.592 0-26.112 12.8-26.112 28.416s11.776 28.416 26.112 28.416c14.592 0 26.112-12.8 26.112-28.416.256-15.616-11.52-28.416-26.112-28.416zM448 52.736V512c-64.494-56.994-43.868-38.128-118.784-107.776l13.568 47.36H52.48C23.552 451.584 0 428.032 0 398.848V52.736C0 23.552 23.552 0 52.48 0h343.04C424.448 0 448 23.552 448 52.736zm-72.96 242.688c0-82.432-36.864-149.248-36.864-149.248-36.864-27.648-71.936-26.88-71.936-26.88l-3.584 4.096c43.52 13.312 63.744 32.512 63.744 32.512-60.811-33.329-132.244-33.335-191.232-7.424-9.472 4.352-15.104 7.424-15.104 7.424s21.248-20.224 67.328-33.536l-2.56-3.072s-35.072-.768-71.936 26.88c0 0-36.864 66.816-36.864 149.248 0 0 21.504 37.12 78.08 38.912 0 0 9.472-11.52 17.152-21.248-32.512-9.728-44.8-30.208-44.8-30.208 3.766 2.636 9.976 6.053 10.496 6.4 43.21 24.198 104.588 32.126 159.744 8.96 8.96-3.328 18.944-8.192 29.44-15.104 0 0-12.8 20.992-46.336 30.464 7.68 9.728 16.896 20.736 16.896 20.736 56.576-1.792 78.336-38.912 78.336-38.912z']};
export const faDrawPolygon = {'prefix':'fas','iconName':'draw-polygon','icon':[448,512,[],'f5ee','M384 352c-.35 0-.67.1-1.02.1l-39.2-65.32c5.07-9.17 8.22-19.56 8.22-30.78s-3.14-21.61-8.22-30.78l39.2-65.32c.35.01.67.1 1.02.1 35.35 0 64-28.65 64-64s-28.65-64-64-64c-23.63 0-44.04 12.95-55.12 32H119.12C108.04 44.95 87.63 32 64 32 28.65 32 0 60.65 0 96c0 23.63 12.95 44.04 32 55.12v209.75C12.95 371.96 0 392.37 0 416c0 35.35 28.65 64 64 64 23.63 0 44.04-12.95 55.12-32h209.75c11.09 19.05 31.49 32 55.12 32 35.35 0 64-28.65 64-64 .01-35.35-28.64-64-63.99-64zm-288 8.88V151.12A63.825 63.825 0 0 0 119.12 128h208.36l-38.46 64.1c-.35-.01-.67-.1-1.02-.1-35.35 0-64 28.65-64 64s28.65 64 64 64c.35 0 .67-.1 1.02-.1l38.46 64.1H119.12A63.748 63.748 0 0 0 96 360.88zM272 256c0-8.82 7.18-16 16-16s16 7.18 16 16-7.18 16-16 16-16-7.18-16-16zM400 96c0 8.82-7.18 16-16 16s-16-7.18-16-16 7.18-16 16-16 16 7.18 16 16zM64 80c8.82 0 16 7.18 16 16s-7.18 16-16 16-16-7.18-16-16 7.18-16 16-16zM48 416c0-8.82 7.18-16 16-16s16 7.18 16 16-7.18 16-16 16-16-7.18-16-16zm336 16c-8.82 0-16-7.18-16-16s7.18-16 16-16 16 7.18 16 16-7.18 16-16 16z']}; export const faDrawPolygon = {'prefix':'fas','iconName':'draw-polygon','icon':[448,512,[],'f5ee','M384 352c-.35 0-.67.1-1.02.1l-39.2-65.32c5.07-9.17 8.22-19.56 8.22-30.78s-3.14-21.61-8.22-30.78l39.2-65.32c.35.01.67.1 1.02.1 35.35 0 64-28.65 64-64s-28.65-64-64-64c-23.63 0-44.04 12.95-55.12 32H119.12C108.04 44.95 87.63 32 64 32 28.65 32 0 60.65 0 96c0 23.63 12.95 44.04 32 55.12v209.75C12.95 371.96 0 392.37 0 416c0 35.35 28.65 64 64 64 23.63 0 44.04-12.95 55.12-32h209.75c11.09 19.05 31.49 32 55.12 32 35.35 0 64-28.65 64-64 .01-35.35-28.64-64-63.99-64zm-288 8.88V151.12A63.825 63.825 0 0 0 119.12 128h208.36l-38.46 64.1c-.35-.01-.67-.1-1.02-.1-35.35 0-64 28.65-64 64s28.65 64 64 64c.35 0 .67-.1 1.02-.1l38.46 64.1H119.12A63.748 63.748 0 0 0 96 360.88zM272 256c0-8.82 7.18-16 16-16s16 7.18 16 16-7.18 16-16 16-16-7.18-16-16zM400 96c0 8.82-7.18 16-16 16s-16-7.18-16-16 7.18-16 16-16 16 7.18 16 16zM64 80c8.82 0 16 7.18 16 16s-7.18 16-16 16-16-7.18-16-16 7.18-16 16-16zM48 416c0-8.82 7.18-16 16-16s16 7.18 16 16-7.18 16-16 16-16-7.18-16-16zm336 16c-8.82 0-16-7.18-16-16s7.18-16 16-16 16 7.18 16 16-7.18 16-16 16z']};
export const faEdge = {'prefix':'fab','iconName':'edge','icon':[512,512,[],'f282','M25.714 228.163c.111-.162.23-.323.342-.485-.021.162-.045.323-.065.485h-.277zm460.572 15.508c0-44.032-7.754-84.465-28.801-122.405C416.498 47.879 343.912 8.001 258.893 8.001 118.962 7.724 40.617 113.214 26.056 227.679c42.429-61.312 117.073-121.376 220.375-124.966 0 0 109.666 0 99.419 104.957H169.997c6.369-37.386 18.554-58.986 34.339-78.926-75.048 34.893-121.85 96.096-120.742 188.315.83 71.448 50.124 144.836 120.743 171.976 83.357 31.847 192.776 7.2 240.132-21.324V363.307c-80.864 56.494-270.871 60.925-272.255-67.572h314.073v-52.064z']}; export const faEdge = {'prefix':'fab','iconName':'edge','icon':[512,512,[],'f282','M25.714 228.163c.111-.162.23-.323.342-.485-.021.162-.045.323-.065.485h-.277zm460.572 15.508c0-44.032-7.754-84.465-28.801-122.405C416.498 47.879 343.912 8.001 258.893 8.001 118.962 7.724 40.617 113.214 26.056 227.679c42.429-61.312 117.073-121.376 220.375-124.966 0 0 109.666 0 99.419 104.957H169.997c6.369-37.386 18.554-58.986 34.339-78.926-75.048 34.893-121.85 96.096-120.742 188.315.83 71.448 50.124 144.836 120.743 171.976 83.357 31.847 192.776 7.2 240.132-21.324V363.307c-80.864 56.494-270.871 60.925-272.255-67.572h314.073v-52.064z']};
export const faEdit = {'prefix':'fas','iconName':'edit','icon':[576,512,[],'f044','M402.6 83.2l90.2 90.2c3.8 3.8 3.8 10 0 13.8L274.4 405.6l-92.8 10.3c-12.4 1.4-22.9-9.1-21.5-21.5l10.3-92.8L388.8 83.2c3.8-3.8 10-3.8 13.8 0zm162-22.9l-48.8-48.8c-15.2-15.2-39.9-15.2-55.2 0l-35.4 35.4c-3.8 3.8-3.8 10 0 13.8l90.2 90.2c3.8 3.8 10 3.8 13.8 0l35.4-35.4c15.2-15.3 15.2-40 0-55.2zM384 346.2V448H64V128h229.8c3.2 0 6.2-1.3 8.5-3.5l40-40c7.6-7.6 2.2-20.5-8.5-20.5H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V306.2c0-10.7-12.9-16-20.5-8.5l-40 40c-2.2 2.3-3.5 5.3-3.5 8.5z']}; export const faEdit = {'prefix':'fas','iconName':'edit','icon':[576,512,[],'f044','M402.6 83.2l90.2 90.2c3.8 3.8 3.8 10 0 13.8L274.4 405.6l-92.8 10.3c-12.4 1.4-22.9-9.1-21.5-21.5l10.3-92.8L388.8 83.2c3.8-3.8 10-3.8 13.8 0zm162-22.9l-48.8-48.8c-15.2-15.2-39.9-15.2-55.2 0l-35.4 35.4c-3.8 3.8-3.8 10 0 13.8l90.2 90.2c3.8 3.8 10 3.8 13.8 0l35.4-35.4c15.2-15.3 15.2-40 0-55.2zM384 346.2V448H64V128h229.8c3.2 0 6.2-1.3 8.5-3.5l40-40c7.6-7.6 2.2-20.5-8.5-20.5H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V306.2c0-10.7-12.9-16-20.5-8.5l-40 40c-2.2 2.3-3.5 5.3-3.5 8.5z']};
+1 -1
View File
@@ -1 +1 @@
{"hash":"L9wF5m2jwn","stamp":395651319} {"hash":"lMWcnf9yNB","stamp":2143289268}
+2 -2
View File
@@ -1,2 +1,2 @@
export const HASH = 'L9wF5m2jwn'; export const HASH = 'lMWcnf9yNB';
export const STAMP = 395651319; export const STAMP = 2143289268;
+3 -3
View File
@@ -1,13 +1,13 @@
export const REV: { [key: string]: string; } = { export const REV: { [key: string]: string; } = {
'images/avatars.jpg': '0f8cf8266f', 'images/avatars.jpg': '4625b7b891',
'images/logo-120.png': 'b051cf1915', 'images/logo-120.png': 'b051cf1915',
'images/logo-64.png': '64a63307c9', 'images/logo-64.png': '64a63307c9',
'images/logo-gray.png': '7d4473f069', 'images/logo-gray.png': '7d4473f069',
'images/logo-large.png': 'ef5e56ccc9', 'images/logo-large.png': 'ef5e56ccc9',
'images/logo-small.png': '770b141d9d', 'images/logo-small.png': '770b141d9d',
'images/logo.png': 'fedfb401e4', 'images/logo.png': 'fedfb401e4',
'images/pony.png': '981a26108b', 'images/pony.png': '541b24abea',
'images/pony2.png': 'c030edb607', 'images/pony2.png': 'f370ad056d',
'images/pony2a.png': 'a6292b4e18', 'images/pony2a.png': 'a6292b4e18',
'music/ambient.mp3': 'd37b620d70', 'music/ambient.mp3': 'd37b620d70',
'music/ambient.webm': '4dbe61d738', 'music/ambient.webm': '4dbe61d738',
+16 -1
View File
@@ -8,6 +8,7 @@ import { Strategy as FacebookStrategy } from '@passport-next/passport-facebook';
import { Strategy as GithubStrategy } from 'passport-github2'; import { Strategy as GithubStrategy } from 'passport-github2';
import { Strategy as VKontakteStrategy } from 'passport-vkontakte'; import { Strategy as VKontakteStrategy } from 'passport-vkontakte';
import { Strategy as PatreonStrategy } from 'passport-patreon'; import { Strategy as PatreonStrategy } from 'passport-patreon';
import { Strategy as DiscordStrategy } from 'passport-discord';
import { Profile } from '../common/interfaces'; import { Profile } from '../common/interfaces';
import { PATREON_COLOR } from '../common/colors'; import { PATREON_COLOR } from '../common/colors';
import { colorToCSS } from '../common/color'; import { colorToCSS } from '../common/color';
@@ -20,7 +21,9 @@ export interface OAuthProfile {
id?: string; id?: string;
name?: OAuthProfileName; name?: OAuthProfileName;
username?: string; username?: string;
discriminator?: string; // discord
displayName?: string; displayName?: string;
email?: string; // discord
emails?: { value: string; }[]; emails?: { value: string; }[];
provider: string; provider: string;
gender?: string; gender?: string;
@@ -87,6 +90,12 @@ const providerList: OAuthProviderInfo[] = [
color: colorToCSS(PATREON_COLOR), color: colorToCSS(PATREON_COLOR),
strategy: PatreonStrategy, strategy: PatreonStrategy,
}, },
{
id: 'discord',
name: 'Discord',
color: '#7289DA',
strategy: DiscordStrategy,
},
]; ];
providerList.forEach(p => p.auth = config.oauth[p.id]); providerList.forEach(p => p.auth = config.oauth[p.id]);
@@ -101,6 +110,8 @@ export function getProfileUrl(profile: OAuthProfile): string | undefined {
return `http://${profile.username}.tumblr.com/`; return `http://${profile.username}.tumblr.com/`;
} else if (profile.provider === 'facebook') { } else if (profile.provider === 'facebook') {
return `http://www.facebook.com/${profile.id}`; return `http://www.facebook.com/${profile.id}`;
} else if (profile.provider === 'discord') {
return undefined;
} else if (profile._json.attributes && profile._json.attributes.url) { // patreon } else if (profile._json.attributes && profile._json.attributes.url) { // patreon
return profile._json.attributes.url; return profile._json.attributes.url;
} else { } else {
@@ -109,7 +120,9 @@ export function getProfileUrl(profile: OAuthProfile): string | undefined {
} }
export function getProfileEmails(profile: OAuthProfile): string[] { export function getProfileEmails(profile: OAuthProfile): string[] {
if (profile.emails && profile.emails.length) { if (profile.provider === 'discord') {
return [profile.email as string];
} else if (profile.emails && profile.emails.length) {
return profile.emails.map(e => e.value); return profile.emails.map(e => e.value);
} else if (profile._json && profile._json.attributes && profile._json.attributes.email) { // patreon } else if (profile._json && profile._json.attributes && profile._json.attributes.email) { // patreon
return [profile._json.attributes.email]; return [profile._json.attributes.email];
@@ -119,10 +132,12 @@ export function getProfileEmails(profile: OAuthProfile): string[] {
} }
export function getProfileUsername(profile: OAuthProfile): string | undefined { export function getProfileUsername(profile: OAuthProfile): string | undefined {
if (profile.provider === 'discord') return `${profile.username}#${profile.discriminator}`;
return profile.username || profile.displayName || getProfileNameInternal(profile.name); return profile.username || profile.displayName || getProfileNameInternal(profile.name);
} }
export function getProfileName(profile: OAuthProfile): string | undefined { export function getProfileName(profile: OAuthProfile): string | undefined {
if (profile.provider === 'discord') return `${profile.username}#${profile.discriminator}`;
return profile.displayName || profile.username || getProfileNameInternal(profile.name); return profile.displayName || profile.username || getProfileNameInternal(profile.name);
} }
+1 -1
View File
@@ -239,7 +239,7 @@ export function authRoutes(
providers.filter(p => !!p.auth).forEach(({ id, strategy, auth, connectOnly, additionalOptions = {} }) => { providers.filter(p => !!p.auth).forEach(({ id, strategy, auth, connectOnly, additionalOptions = {} }) => {
const callbackURL = `${host}auth/${id}/callback`; const callbackURL = `${host}auth/${id}/callback`;
const scope = id === 'patreon' ? ['users'] : ['email']; const scope = id === 'patreon' ? ['users'] : id === 'discord' ? ['identify', 'email'] : ['email'];
const options = { const options = {
...additionalOptions, ...additionalOptions,
...auth, ...auth,