Maintenance commit Sat Jan 5 01:10:23 EET 2019
This commit is contained in:
parent
681905b0a7
commit
913309c7ab
24
README.md
24
README.md
@ -2,28 +2,20 @@
|
|||||||
Icy Network Primary Web Application - Authentication and News
|
Icy Network Primary Web Application - Authentication and News
|
||||||
|
|
||||||
## About Icy Network
|
## About Icy Network
|
||||||
Icy Network is a community network aimed at anyone who likes friendly discussions and playing multiplayer games, such as Minecraft.
|
Icy Network is a SSO (Single-Sign On) service provider - for communities. This application is used for authentication services such as OAuth2 in order to unite our websites with a single login and as a central news outlet for Icy Network services.
|
||||||
|
|
||||||
### Currently IcyNet-managed community platforms
|
## Requirements
|
||||||
* mc.icynet.eu - Minecraft Server
|
* [Node.js](https://nodejs.org/en/)
|
||||||
* [Discord server](https://discord.gg/Xe7MKSx)
|
* A running instance of [Redis](https://redis.io/)
|
||||||
* icynet.ml - IRC Network
|
* A database of your choice. See [knex installation](https://knexjs.org/#Installation-node) for a list of supported database drivers.
|
||||||
|
|
||||||
More to come!
|
|
||||||
|
|
||||||
## The Goal of this Application
|
|
||||||
This application is used for authentication services such as OAuth2 in order to unite our websites with a single login and as a central news outlet for Icy Network services.
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
The first time you run the application, it will migrate the database and that may take a while. **You will also need a running instance of `redis-server` for session storage!**
|
|
||||||
### Development
|
### Development
|
||||||
1. Clone this repository and `cd` into it
|
1. Clone this repository and `cd` into it
|
||||||
2. `npm install` - Get all the dependencies
|
2. `npm install` - Get all the dependencies
|
||||||
3. `cp config.example.toml config.toml` - Copy the configuration
|
3. `cp config.example.toml config.toml && $EDITOR config.toml` - Copy the configuration (and edit it)
|
||||||
4. `npm run watch` - Run the style and front-end script watch task
|
4. `npm run watch` - Run the server and front-end watch task, which also starts the application in development mode
|
||||||
5. `npm start -- -d` - Start the application in development mode
|
|
||||||
|
|
||||||
There is also a watch mode for the server. To enable `server` file tree watching you must provide both `-d` and `-w` as parameters. This task will reset all workers when any file in the `server` directory changes, enabling for live debugging.
|
You can run the application in development mode using `npm start -- -d` if you do not need the watch tasks.
|
||||||
|
|
||||||
### Production
|
### Production
|
||||||
1. `npm run build` - Build the front-end
|
1. `npm run build` - Build the front-end
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
./node_modules/.bin/concurrently --kill-others "npm run watch" "npm run start -- -d -w"
|
|
6
install
6
install
@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
npm install
|
|
||||||
cp config.example.toml config.toml
|
|
||||||
$EDITOR config.toml
|
|
||||||
echo "Run the program with `./development` in development mode or build the project"
|
|
||||||
echo "using `npm run build` and then `npm start` for production!"
|
|
38
package-lock.json
generated
38
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "icynet.eu",
|
"name": "icynet.eu",
|
||||||
"version": "0.9.1",
|
"version": "0.9.3",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -1292,11 +1292,18 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"basic-auth": {
|
"basic-auth": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
|
||||||
"integrity": "sha1-AV2z81PgLlY3d1X5YnQuiYHnu7o=",
|
"integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"safe-buffer": "5.1.1"
|
"safe-buffer": "5.1.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": {
|
||||||
|
"version": "5.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||||
|
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bcrypt-pbkdf": {
|
"bcrypt-pbkdf": {
|
||||||
@ -5722,9 +5729,9 @@
|
|||||||
"integrity": "sha1-4gD/TdgjcX+OBWOzLj9UgfyiYrI="
|
"integrity": "sha1-4gD/TdgjcX+OBWOzLj9UgfyiYrI="
|
||||||
},
|
},
|
||||||
"merge": {
|
"merge": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/merge/-/merge-1.2.1.tgz",
|
||||||
"integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=",
|
"integrity": "sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"merge-descriptors": {
|
"merge-descriptors": {
|
||||||
@ -5880,15 +5887,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"morgan": {
|
"morgan": {
|
||||||
"version": "1.9.0",
|
"version": "1.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz",
|
||||||
"integrity": "sha1-0B+mxlhZt2/PMbPLU6OCGjEdgFE=",
|
"integrity": "sha512-HQStPIV4y3afTiCYVxirakhlCfGkI161c76kKFca7Fk1JusM//Qeo1ej2XaMniiNeaZklMVrh3vTtIzpzwbpmA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"basic-auth": "~2.0.0",
|
"basic-auth": "~2.0.0",
|
||||||
"debug": "2.6.9",
|
"debug": "2.6.9",
|
||||||
"depd": "~1.1.1",
|
"depd": "~1.1.2",
|
||||||
"on-finished": "~2.3.0",
|
"on-finished": "~2.3.0",
|
||||||
"on-headers": "~1.0.1"
|
"on-headers": "~1.0.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"depd": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
|
||||||
|
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"move-concurrently": {
|
"move-concurrently": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "icynet.eu",
|
"name": "icynet.eu",
|
||||||
"version": "0.9.2",
|
"version": "0.9.3",
|
||||||
"description": "Icy Network web server",
|
"description": "Icy Network web server",
|
||||||
"main": "icynet.eu.js",
|
"main": "icynet.eu.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -26,9 +26,9 @@
|
|||||||
"author": "Icy Network",
|
"author": "Icy Network",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/IcyNet/IcyNet.eu/issues"
|
"url": "https://gitlab.icynet.eu/IcyNetwork/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/IcyNet/IcyNet.eu#readme",
|
"homepage": "https://icynet.eu",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-core": "^6.26.3",
|
"babel-core": "^6.26.3",
|
||||||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
||||||
@ -66,7 +66,7 @@
|
|||||||
"concurrently": "^3.6.0",
|
"concurrently": "^3.6.0",
|
||||||
"eslint-plugin-import": "^2.13.0",
|
"eslint-plugin-import": "^2.13.0",
|
||||||
"jquery": "^3.3.1",
|
"jquery": "^3.3.1",
|
||||||
"morgan": "^1.9.0",
|
"morgan": "^1.9.1",
|
||||||
"mustache": "^2.3.0",
|
"mustache": "^2.3.0",
|
||||||
"popper.js": "^1.14.3",
|
"popper.js": "^1.14.3",
|
||||||
"standard": "^10.0.3",
|
"standard": "^10.0.3",
|
||||||
|
@ -10,7 +10,7 @@ function HTTP_GET (link, headers = {}, lback) {
|
|||||||
port: parsed.port,
|
port: parsed.port,
|
||||||
path: parsed.path,
|
path: parsed.path,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': 'Squeebot/Commons-2.0.0',
|
'User-Agent': 'Icy Network Back-end (icynet.eu)',
|
||||||
'Accept': '*/*',
|
'Accept': '*/*',
|
||||||
'Accept-Language': 'en-GB,enq=0.5'
|
'Accept-Language': 'en-GB,enq=0.5'
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ function HTTP_POST (link, headers = {}, data) {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
'Content-Length': Buffer.byteLength(postData),
|
'Content-Length': Buffer.byteLength(postData),
|
||||||
'User-Agent': 'Squeebot/Commons-2.0.0'
|
'User-Agent': 'Icy Network Back-end (icynet.eu)'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,13 +53,21 @@ console.error = function () {
|
|||||||
async function initializeLogger () {
|
async function initializeLogger () {
|
||||||
let logPath = path.resolve(config.logger.file)
|
let logPath = path.resolve(config.logger.file)
|
||||||
|
|
||||||
|
// Only throw bad permission errors
|
||||||
try {
|
try {
|
||||||
await fs.access(logPath, fs.W_OK)
|
await fs.access(logPath, fs.W_OK)
|
||||||
|
} catch (e) {
|
||||||
|
if (e.code !== 'ENOENT') throw e
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
lfs = fs.createWriteStream(logPath, {flags: 'a'})
|
lfs = fs.createWriteStream(logPath, {flags: 'a'})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
lfs = null
|
lfs = null
|
||||||
console.error('Failed to initiate log file write stream')
|
console.error('Failed to initiate log file write stream')
|
||||||
console.error(e.stack)
|
|
||||||
|
// Rethrow error
|
||||||
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,5 +86,5 @@ module.exports = function () {
|
|||||||
|
|
||||||
// Create log file write stream
|
// Create log file write stream
|
||||||
if (!config.logger || !config.logger.write) return
|
if (!config.logger || !config.logger.write) return
|
||||||
initializeLogger()
|
initializeLogger().catch((e) => console.error(e))
|
||||||
}
|
}
|
||||||
|
@ -195,6 +195,7 @@ apiRouter.get('/search/users', wrap(async (req, res) => {
|
|||||||
* OAuth2 Data
|
* OAuth2 Data
|
||||||
* ===============
|
* ===============
|
||||||
*/
|
*/
|
||||||
|
|
||||||
apiRouter.get('/clients', wrap(async (req, res) => {
|
apiRouter.get('/clients', wrap(async (req, res) => {
|
||||||
let page = parseInt(req.query.page)
|
let page = parseInt(req.query.page)
|
||||||
if (isNaN(page) || page < 1) {
|
if (isNaN(page) || page < 1) {
|
||||||
|
@ -96,6 +96,7 @@ router.use('/oauth2', oauthRouter)
|
|||||||
RENDER VIEWS
|
RENDER VIEWS
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
router.get('/', (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
res.render('index')
|
res.render('index')
|
||||||
})
|
})
|
||||||
@ -833,7 +834,7 @@ router.use('/api', apiRouter)
|
|||||||
router.use('/admin', adminRouter)
|
router.use('/admin', adminRouter)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NO ROUTES BEYOND THIS POINT
|
FALLBACK ROUTES BEYOND THIS POINT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Handle 'Failed to lookup view' errors
|
// Handle 'Failed to lookup view' errors
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
.form-group
|
.form-group
|
||||||
label(for="privilege") Privilege
|
label(for="privilege") Privilege
|
||||||
input(type="range" min="0" max="5" step="1" id="privilege" name="privilege" v-model="nw_privilege")
|
input(type="range" min="0" max="5" step="1" id="privilege" name="privilege" v-model="nw_privilege")
|
||||||
span {{ nw_privilege }}
|
span#priv-num {{ nw_privilege }}
|
||||||
.form-check
|
.form-check
|
||||||
input.form-check-input(type="checkbox" id="activated" name="activated" v-model="activated")
|
input.form-check-input(type="checkbox" id="activated" name="activated" v-model="activated")
|
||||||
label.form-check-label(for="activated") Activated
|
label.form-check-label(for="activated") Activated
|
||||||
|
@ -34,6 +34,7 @@ body
|
|||||||
.list-item
|
.list-item
|
||||||
background-color: #f5f5f5
|
background-color: #f5f5f5
|
||||||
padding: 10px
|
padding: 10px
|
||||||
|
flex-wrap: nowrap
|
||||||
&:nth-child(even)
|
&:nth-child(even)
|
||||||
background-color: #fff
|
background-color: #fff
|
||||||
|
|
||||||
@ -165,3 +166,12 @@ body
|
|||||||
form
|
form
|
||||||
.message
|
.message
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
|
#priv-num
|
||||||
|
padding: 0 4px
|
||||||
|
vertical-align: top
|
||||||
|
|
||||||
|
input[type=range]
|
||||||
|
display: inline-block
|
||||||
|
margin: 0 15px
|
||||||
|
vertical-align: top
|
||||||
|
Reference in New Issue
Block a user