Add database and config file support.

This commit is contained in:
2023-09-26 00:11:38 -04:00
parent f1e9586836
commit f49fb8101d
8 changed files with 402 additions and 8 deletions

35
.env.example Normal file
View File

@@ -0,0 +1,35 @@
# TechnicFlux Configuration File
# For support: https://github.com/Zandercraft/TechnicFlux/
# =========================================================
# This is an example configuration file and is not active.
# Copy and rename it to .env before starting TechnicFlux.
# (Read the README.md file for more detailed instructions)
# (REQUIRED) The connection string for your MongoDB instance (including the database)
# Ex. (No SSL): mongodb://myDatabaseUser:D1fficultP%40ssw0rd@127.0.0.1/myDatabaseName
# Ex. (SSL): mongodb+srv://myDatabaseUser:D1fficultP%40ssw0rd@server.example.com/myDatabaseName
# See https://www.mongodb.com/docs/manual/reference/connection-string/
MONGODB_CONN_STRING="mongodb://localhost:27017/technicflux"
# (REQUIRED) Admin Username and Password
# The username and password for the administrator account. CHANGE THIS!
ADMIN_USER="flux"
ADMIN_PASS="flux"
# (REQUIRED) The name of your TechnicFlux instance.
NAME="A TechnicFlux Instance"
# (REQUIRED) The public hostname of the website (i.e. the full domain name without any path, http://, or https://)
HOST="example.com"
# (REQUIRED) Solder API Key
# 1. Go to https://www.technicpack.net/
# 2. Sign into your account and navigate to My Profile
# 3. Go to Solder Configuration and put your API key here
# 4. Put your solder API URL (http[s]://example.com/api/) in and link it.
API_KEY=""
# (Optional) Default Author Name (for custom files)
# This is the name that will be pre-filled when you go to upload custom files for a modpack.
# Unset behaviour: You will need to specify the author every time.
AUTHOR_NAME="John Doe"

BIN
README.md

Binary file not shown.

22
bin/www
View File

@@ -1,25 +1,37 @@
#!/usr/bin/env node #!/usr/bin/env node
/**
* Load configuration from .env
*/
require('dotenv').config()
/** /**
* Module dependencies. * Module dependencies.
*/ */
var app = require('../app'); const app = require('../app');
var debug = require('debug')('technicflux:server'); const debug = require('debug')('technicflux:server');
var http = require('http'); const http = require('http');
const database = require('../database')
/** /**
* Get port from environment and store in Express. * Get port from environment and store in Express.
*/ */
var port = normalizePort(process.env.PORT || '3000'); let port = normalizePort(process.env.PORT || '80');
app.set('port', port); app.set('port', port);
/** /**
* Create HTTP server. * Create HTTP server.
*/ */
var server = http.createServer(app); let server = http.createServer(app);
/**
* Connect to the Database
*/
database.connectToDB(process.env.MONGODB_CONN_STRING)
/** /**
* Listen on provided port, on all network interfaces. * Listen on provided port, on all network interfaces.

103
database.js Normal file
View File

@@ -0,0 +1,103 @@
const mongoose = require('mongoose')
const { SchemaTypes } = require('mongoose')
const bcrypt = require('bcryptjs')
const Schema = mongoose.Schema
// --- Schemas ---
const userSchema = new Schema({
username: {
type: String,
unique: true
},
display_name: String,
password: String
})
const modpackSchema = new Schema({
name: String,
display_name: String,
url: String,
recommended: String,
latest: String,
builds: [{ type: SchemaTypes.ObjectId, ref: 'technicflux_builds' }],
owners: [{ type:SchemaTypes.ObjectId, ref: 'technicflux_users' }],
contributors: [{ type:SchemaTypes.ObjectId, ref: 'technicflux_users' }]
})
const modSchema = new Schema({
name: String,
pretty_name: String,
version: String,
mc_version: String,
type: String,
md5: String,
author: String,
description: String,
link: String,
donate: String
})
const buildSchema = new Schema({
minecraft: String,
java: String,
memory: Number,
forge: String,
mods: [{ type: SchemaTypes.ObjectId, ref: 'technicflux_mods' }]
})
// --- Models ---
const User = mongoose.model('technicflux_users', userSchema)
const Modpack = mongoose.model('technicflux_modpacks', modpackSchema)
const Mod = mongoose.model('technicflux_mods', modSchema)
const Build = mongoose.model('technicflux_builds', buildSchema)
// --- Functions ---
exports.connectToDB = (connectionString) => {
mongoose.connect(connectionString)
}
// --- User-Related Functions ---
/*
* Creates a new user with the given information.
*/
exports.createUser = (u_username, u_display_name, u_password) => {
// Encrypt the password using bcrypt and save user
return bcrypt.genSalt(10).then((Salt) => {
return bcrypt.hash(u_password, Salt).then((hash) => {
// Create a user object
const newUser = new User({
username: u_username,
display_name: u_display_name,
password: hash
})
// Commit it to the database
return newUser.save().then((user) => {
process.stdout.write(`Successfully added new user ${user.username}\n`)
return user
}).catch((reason) => {
process.stdout.write(`ERROR (when saving new user): ${reason}\n`)
return false
})
}).catch((err) => {
// Issue creating hashed password
process.stdout.write(`ERROR (while hashing password): ${err}`)
return false
})
}).catch((err) => {
// Issue creating hashed object salt
process.stdout.write(`ERROR (while generating password salt): ${err}`)
return false
})
}
// --- Modpack-Related Functions ---
// --- Mod-Related Functions ---
// --- Build-Related Functions ---

235
package-lock.json generated
View File

@@ -9,12 +9,15 @@
"version": "0.0.1", "version": "0.0.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"bcryptjs": "^2.4.3",
"cookie-parser": "~1.4.4", "cookie-parser": "~1.4.4",
"current-git-branch": "^1.1.0", "current-git-branch": "^1.1.0",
"debug": "~4.3.4", "debug": "~4.3.4",
"dotenv": "^16.3.1",
"express": "~4.16.1", "express": "~4.16.1",
"hbs": "~4.2.0", "hbs": "~4.2.0",
"http-errors": "~1.6.3", "http-errors": "~1.6.3",
"mongoose": "^7.5.3",
"morgan": "~1.9.1", "morgan": "~1.9.1",
"standard": "^17.1.0" "standard": "^17.1.0"
}, },
@@ -116,6 +119,15 @@
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==" "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA=="
}, },
"node_modules/@mongodb-js/saslprep": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.0.tgz",
"integrity": "sha512-Xfijy7HvfzzqiOAhAepF4SGN5e9leLkMvg/OPOF97XemjfVCYN/oWa75wnkc6mltMSTwY+XlbhWgUOJmkFspSw==",
"optional": true,
"dependencies": {
"sparse-bitfield": "^3.0.3"
}
},
"node_modules/@nodelib/fs.scandir": { "node_modules/@nodelib/fs.scandir": {
"version": "2.1.5", "version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -153,6 +165,25 @@
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==" "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ=="
}, },
"node_modules/@types/node": {
"version": "20.7.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.7.0.tgz",
"integrity": "sha512-zI22/pJW2wUZOVyguFaUL1HABdmSVxpXrzIqkjsHmyUjNhPoWM1CKfvVuXfetHhIok4RY573cqS0mZ1SJEnoTg=="
},
"node_modules/@types/webidl-conversions": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.1.tgz",
"integrity": "sha512-8hKOnOan+Uu+NgMaCouhg3cT9x5fFZ92Jwf+uDLXLu/MFRbXxlWwGeQY7KVHkeSft6RvY+tdxklUBuyY9eIEKg=="
},
"node_modules/@types/whatwg-url": {
"version": "8.2.2",
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz",
"integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==",
"dependencies": {
"@types/node": "*",
"@types/webidl-conversions": "*"
}
},
"node_modules/accepts": { "node_modules/accepts": {
"version": "1.3.8", "version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
@@ -385,6 +416,11 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/bcryptjs": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz",
"integrity": "sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ=="
},
"node_modules/body-parser": { "node_modules/body-parser": {
"version": "1.18.3", "version": "1.18.3",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
@@ -422,6 +458,14 @@
"concat-map": "0.0.1" "concat-map": "0.0.1"
} }
}, },
"node_modules/bson": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/bson/-/bson-5.5.0.tgz",
"integrity": "sha512-B+QB4YmDx9RStKv8LLSl/aVIEV3nYJc3cJNNTK2Cd1TL+7P+cNpw9mAPeCgc5K+j01Dv6sxUzcITXDx7ZU3F0w==",
"engines": {
"node": ">=14.20.1"
}
},
"node_modules/builtins": { "node_modules/builtins": {
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz",
@@ -651,6 +695,17 @@
"node": ">=6.0.0" "node": ">=6.0.0"
} }
}, },
"node_modules/dotenv": {
"version": "16.3.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/motdotla/dotenv?sponsor=1"
}
},
"node_modules/ee-first": { "node_modules/ee-first": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
@@ -1896,6 +1951,11 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/ip": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz",
"integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ=="
},
"node_modules/ipaddr.js": { "node_modules/ipaddr.js": {
"version": "1.9.1", "version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
@@ -2290,6 +2350,14 @@
"node": ">=4.0" "node": ">=4.0"
} }
}, },
"node_modules/kareem": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/kareem/-/kareem-2.5.1.tgz",
"integrity": "sha512-7jFxRVm+jD+rkq3kY0iZDJfsO2/t4BBPeEb2qKn2lR/9KhuksYk5hxzfRYWMPV8P/x2d0kHD306YyWLzjjH+uA==",
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/keyv": { "node_modules/keyv": {
"version": "4.5.3", "version": "4.5.3",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz",
@@ -2382,6 +2450,12 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/memory-pager": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
"optional": true
},
"node_modules/merge-descriptors": { "node_modules/merge-descriptors": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
@@ -2441,6 +2515,81 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/mongodb": {
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.8.1.tgz",
"integrity": "sha512-wKyh4kZvm6NrCPH8AxyzXm3JBoEf4Xulo0aUWh3hCgwgYJxyQ1KLST86ZZaSWdj6/kxYUA3+YZuyADCE61CMSg==",
"dependencies": {
"bson": "^5.4.0",
"mongodb-connection-string-url": "^2.6.0",
"socks": "^2.7.1"
},
"engines": {
"node": ">=14.20.1"
},
"optionalDependencies": {
"@mongodb-js/saslprep": "^1.1.0"
},
"peerDependencies": {
"@aws-sdk/credential-providers": "^3.188.0",
"@mongodb-js/zstd": "^1.0.0",
"kerberos": "^1.0.0 || ^2.0.0",
"mongodb-client-encryption": ">=2.3.0 <3",
"snappy": "^7.2.2"
},
"peerDependenciesMeta": {
"@aws-sdk/credential-providers": {
"optional": true
},
"@mongodb-js/zstd": {
"optional": true
},
"kerberos": {
"optional": true
},
"mongodb-client-encryption": {
"optional": true
},
"snappy": {
"optional": true
}
}
},
"node_modules/mongodb-connection-string-url": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz",
"integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==",
"dependencies": {
"@types/whatwg-url": "^8.2.1",
"whatwg-url": "^11.0.0"
}
},
"node_modules/mongoose": {
"version": "7.5.3",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.5.3.tgz",
"integrity": "sha512-QyYzhZusux0wIJs+4rYyHvel0kJm0CT887trNd1WAB3iQnDuJow0xEnjETvuS/cTjHQUVPihOpN7OHLlpJc52w==",
"dependencies": {
"bson": "^5.4.0",
"kareem": "2.5.1",
"mongodb": "5.8.1",
"mpath": "0.9.0",
"mquery": "5.0.0",
"ms": "2.1.3",
"sift": "16.0.1"
},
"engines": {
"node": ">=14.20.1"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mongoose"
}
},
"node_modules/mongoose/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/morgan": { "node_modules/morgan": {
"version": "1.9.1", "version": "1.9.1",
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz", "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz",
@@ -2464,6 +2613,25 @@
"ms": "2.0.0" "ms": "2.0.0"
} }
}, },
"node_modules/mpath": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz",
"integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==",
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/mquery": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz",
"integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==",
"dependencies": {
"debug": "4.x"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/ms": { "node_modules/ms": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
@@ -3206,11 +3374,38 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/sift": {
"version": "16.0.1",
"resolved": "https://registry.npmjs.org/sift/-/sift-16.0.1.tgz",
"integrity": "sha512-Wv6BjQ5zbhW7VFefWusVP33T/EM0vYikCaQ2qR8yULbsilAT8/wQaXvuQ3ptGLpoKx+lihJE3y2UTgKDyyNHZQ=="
},
"node_modules/signal-exit": { "node_modules/signal-exit": {
"version": "3.0.7", "version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
}, },
"node_modules/smart-buffer": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
}
},
"node_modules/socks": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz",
"integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==",
"dependencies": {
"ip": "^2.0.0",
"smart-buffer": "^4.2.0"
},
"engines": {
"node": ">= 10.13.0",
"npm": ">= 3.0.0"
}
},
"node_modules/source-map": { "node_modules/source-map": {
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
@@ -3219,6 +3414,15 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/sparse-bitfield": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
"integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
"optional": true,
"dependencies": {
"memory-pager": "^1.0.2"
}
},
"node_modules/standard": { "node_modules/standard": {
"version": "17.1.0", "version": "17.1.0",
"resolved": "https://registry.npmjs.org/standard/-/standard-17.1.0.tgz", "resolved": "https://registry.npmjs.org/standard/-/standard-17.1.0.tgz",
@@ -3455,6 +3659,17 @@
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
"integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==" "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw=="
}, },
"node_modules/tr46": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
"integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
"dependencies": {
"punycode": "^2.1.1"
},
"engines": {
"node": ">=12"
}
},
"node_modules/tsconfig-paths": { "node_modules/tsconfig-paths": {
"version": "3.14.2", "version": "3.14.2",
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz",
@@ -3635,6 +3850,26 @@
"foreachasync": "^3.0.0" "foreachasync": "^3.0.0"
} }
}, },
"node_modules/webidl-conversions": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
"engines": {
"node": ">=12"
}
},
"node_modules/whatwg-url": {
"version": "11.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
"integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
"dependencies": {
"tr46": "^3.0.0",
"webidl-conversions": "^7.0.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/which": { "node_modules/which": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",

View File

@@ -35,12 +35,15 @@
"start": "node ./bin/www" "start": "node ./bin/www"
}, },
"dependencies": { "dependencies": {
"bcryptjs": "^2.4.3",
"cookie-parser": "~1.4.4", "cookie-parser": "~1.4.4",
"current-git-branch": "^1.1.0", "current-git-branch": "^1.1.0",
"debug": "~4.3.4", "debug": "~4.3.4",
"dotenv": "^16.3.1",
"express": "~4.16.1", "express": "~4.16.1",
"hbs": "~4.2.0", "hbs": "~4.2.0",
"http-errors": "~1.6.3", "http-errors": "~1.6.3",
"mongoose": "^7.5.3",
"morgan": "~1.9.1", "morgan": "~1.9.1",
"standard": "^17.1.0" "standard": "^17.1.0"
}, },

6
public/mods/.gitkeep Normal file
View File

@@ -0,0 +1,6 @@
======================INTERNAL FILE======================
This is just a placeholder file within the mods route.
The file itself is just used to keep the folder on Git
before any other files are added. This file is located in
the base route for mods in the system.
=========================================================

View File

@@ -53,12 +53,12 @@ router.get('/mod/:modname/:modversion', (req, res) => {
}) })
router.get('/modpack', (req, res) => { router.get('/modpack', (req, res) => {
// No Slug // Modpack Index
res.json({ res.json({
"modpacks": { "modpacks": {
"test": "Example Modpack" "slug": "Example Modpack Pretty Name"
}, },
"mirror_url": "https://example.com/" "mirror_url": `http://${process.env.HOST}/mods`
}) })
}) })