mirror of https://gitlab.com/oatmealine/cumstorm
commit
6ec2b0a6a9
@ -0,0 +1,38 @@
|
||||
{
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended"
|
||||
],
|
||||
"globals": {
|
||||
"Atomics": "readonly",
|
||||
"SharedArrayBuffer": "readonly"
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"indent": [
|
||||
"warn",
|
||||
"tab"
|
||||
],
|
||||
"linebreak-style": "off",
|
||||
"quotes": [
|
||||
"error",
|
||||
"single"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"no-mixed-spaces-and-tabs": "off"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
.vscode
|
||||
|
||||
built/
|
||||
|
||||
.env
|
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2020 Jill "Oatmealine"
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "cumstorm",
|
||||
"version": "1.0.0",
|
||||
"description": "a typescript gdps",
|
||||
"main": "built/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"quickrun": "tsc && node built/index.js"
|
||||
},
|
||||
"keywords": [
|
||||
"gdps",
|
||||
"geometry-dash",
|
||||
"gd",
|
||||
"server"
|
||||
],
|
||||
"author": "oatmealine <krakaka088@gmail.com> (https://koyu.space/@oatmealine)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chalk": "^3.0.0",
|
||||
"express": "^4.17.1",
|
||||
"typescript": "^3.7.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.2",
|
||||
"@types/node": "^13.5.0",
|
||||
"@typescript-eslint/eslint-plugin": "^2.17.0",
|
||||
"@typescript-eslint/parser": "^2.17.0",
|
||||
"eslint": "^6.8.0"
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
import * as hash from './hash';
|
||||
|
||||
// hardcoded for now
|
||||
const levels = [
|
||||
{
|
||||
'id': 1,
|
||||
'name': 'I am awesome level',
|
||||
'diff': 20,
|
||||
'downloads': 20,
|
||||
'likes': 30,
|
||||
'song': 0,
|
||||
'stars': 5,
|
||||
'description': 'An awesome level!!!!',
|
||||
'length': 0,
|
||||
'author': 16
|
||||
},
|
||||
{
|
||||
'id': 2,
|
||||
'name': 'SECOND',
|
||||
'diff': 10,
|
||||
'downloads': 20,
|
||||
'likes': 30,
|
||||
'song': 3,
|
||||
'stars': 5,
|
||||
'description': 'An awesome level!!!!',
|
||||
'length': 0,
|
||||
'author': 16
|
||||
},
|
||||
{
|
||||
'id': 3,
|
||||
'name': '333',
|
||||
'diff': 60,
|
||||
'downloads': 333,
|
||||
'likes': 333,
|
||||
'song': 3,
|
||||
'stars': 333,
|
||||
'description': 'An awesome level!!!!',
|
||||
'length': 0,
|
||||
'author': 16
|
||||
}
|
||||
];
|
||||
|
||||
module.exports = (app) : void => {
|
||||
|
||||
app.post('/aa/database/getGJLevels21.php', (req, res) => {
|
||||
let levelsString = '';
|
||||
|
||||
let results = levels // TODO: searching
|
||||
.map(l =>
|
||||
`1:${l.id}:2:${l.name}:5:0:6:16:8:10:9:${l.diff}:10:${l.downloads}:12:1:13:21:14:${l.likes}:17:0:43:0:25:0:18:${l.stars}:19:0:42:0:45:10:3:${l.description}:15:1:30:0:31:0:37:0:38:0:39:0:46:1:47:2:40:0:35:0`
|
||||
)
|
||||
.join('|');
|
||||
|
||||
let users = new Array(levels.length) // placeholder
|
||||
.fill('16:mat:0')
|
||||
.join('|');
|
||||
|
||||
let songs = ''; // placeholder
|
||||
|
||||
levelsString = [results, users, songs, levels.length].join('#') + ':0:10#' + hash.hashLevels(levels);
|
||||
|
||||
res.status(200).send(levelsString);
|
||||
});
|
||||
};
|
@ -0,0 +1,9 @@
|
||||
import * as crypto from 'crypto';
|
||||
|
||||
export function hashLevels(levels : any[]) : string {
|
||||
let c = levels.map(lvl => `${lvl.id.toString()[0]}${lvl.id.toString().slice(-1)}${lvl.stars}0`).join('');
|
||||
|
||||
let shasum = crypto.createHash('sha1');
|
||||
shasum.update(c + 'xI25fpAapCQg');
|
||||
return shasum.digest('hex');
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
import * as express from 'express';
|
||||
const app = express();
|
||||
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Hello World');
|
||||
});
|
||||
|
||||
require('./getGJLevels21')(app);
|
||||
|
||||
app.get('*', (req, res) => res.status(404).send('wrong page dumbass'));
|
||||
|
||||
app.listen(3000);
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "./built",
|
||||
"allowJs": true,
|
||||
"target": "esnext",
|
||||
"module": "commonjs",
|
||||
"noImplicitReturns": true
|
||||
},
|
||||
"include": [
|
||||
"src/*"
|
||||
]
|
||||
}
|
Loading…
Reference in new issue