mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-07 12:07:07 +03:00
Added config file.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -90,3 +90,6 @@ typings/
|
|||||||
# Databases
|
# Databases
|
||||||
databases/sponsorTimes.db
|
databases/sponsorTimes.db
|
||||||
databases/private.db
|
databases/private.db
|
||||||
|
|
||||||
|
# Config files
|
||||||
|
config.json
|
||||||
5
config.json.example
Normal file
5
config.json.example
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"globalSalt": "[global salt (pepper) that is added to every ip before hashing to make it even harder for someone to decode the ip]",
|
||||||
|
"adminUserID": "[the hashed id of the user who can perform admin actions]",
|
||||||
|
"behindProxy": true
|
||||||
|
}
|
||||||
12
index.js
12
index.js
@@ -1,4 +1,5 @@
|
|||||||
var express = require('express');
|
var express = require('express');
|
||||||
|
var fs = require('fs');
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
// Create a service (the app object is just a callback).
|
// Create a service (the app object is just a callback).
|
||||||
var app = express();
|
var app = express();
|
||||||
@@ -15,14 +16,13 @@ var privateDB = new sqlite3.Database('./databases/private.db');
|
|||||||
// Create an HTTP service.
|
// Create an HTTP service.
|
||||||
http.createServer(app).listen(80);
|
http.createServer(app).listen(80);
|
||||||
|
|
||||||
//global salt that is added to every ip before hashing to
|
let config = JSON.parse(fs.readFileSync('config.json'));
|
||||||
// make it even harder for someone to decode the ip
|
|
||||||
var globalSalt = "49cb0d52-1aec-4b89-85fc-fab2c53062fb";
|
var globalSalt = config.globalSalt;
|
||||||
//this is the user that can add shadow bans
|
var adminUserID = config.adminUserID;
|
||||||
var adminUserID = "7b89ea26f77bda8176e655eee86029f28c1e6514b6d6e3450bce362b5b126ca3";
|
|
||||||
|
|
||||||
//if so, it will use the x-forwarded header instead of the ip address of the connection
|
//if so, it will use the x-forwarded header instead of the ip address of the connection
|
||||||
var behindProxy = true;
|
var behindProxy = config.behindProxy;
|
||||||
|
|
||||||
//setup CORS correctly
|
//setup CORS correctly
|
||||||
app.use(function(req, res, next) {
|
app.use(function(req, res, next) {
|
||||||
|
|||||||
Reference in New Issue
Block a user