Skip to content

Commit

Permalink
Merge pull request #31 from CoR-Forum/res-db
Browse files Browse the repository at this point in the history
Res db
  • Loading branch information
Joshua2504 authored Aug 23, 2024
2 parents dbb0127 + 0b3cb09 commit ccc952b
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 6 deletions.
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use the official Node.js image as base
FROM node:latest

# Set the working directory in the container
WORKDIR /usr/src/app

# Install requirements: python3 and bs4
RUN apt-get update && apt-get install -y python3

# Copy the app file to the working directory
COPY app/CoRT .

# Install app dependencies
RUN npm install

# Expose the port your app runs on
EXPOSE 3000

# Run the app
CMD ["node", "server/index.js"]
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ page, and anonymous setup collection (see the `collect` directory) which by
default only works for https://mascaldotfr.github.io and can be completely
skipped.

# About the Marketplace
# About v2

The marketplace server is required for the Market to run, right now there is
no functionality tho.
CoRT v2 is an extended version of CoRT running NodeJs.

WZ Stats etc. are fetched from mascal's CoRT.

Nearly all additions use a MySQL Database, so the Stats part needs to be rewritten to work with MySQL. CoRT v2 is not made to store dynamic files.

## Textures Paradise

Expand Down
2 changes: 1 addition & 1 deletion public/js/trainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var automated_clicks = false;
var tooltips = [];

$(document).ready(function() {
document.title = "CoRT - " + _("Trainer");
document.title = _("Trainer") + "CoRT";
$("#title").text(_("Trainer"));
$("#titleinfo").text(
_("Hovering your mouse or clicking (on mobile) on a skill icon will show its description.") +
Expand Down
4 changes: 2 additions & 2 deletions public/timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<head>
<meta charset="utf-8">
<meta property="og:image" content="/CoRT/favicon_512.png">
<title>Champions of Regnum Timeline</title>
<title>Manuka's Timeline - Champions of Regnum</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="regnumsentinel champions regnum online trainer entrenador bosses war warzone guerra status">
<meta name="description" content="Champions of Regnum trainer, war status, bosses respawn and bz countdowns">
<meta name="description" content="A Timeline of everything that happened in Champions of Regnum (Regnum Online), originally created by Manuka.">
<link rel="stylesheet" href="css/style.css">
<link rel="icon" type="image/png" href="favicon.png">
<link rel="apple-touch-icon" href="favicon.png" sizes="192x192">
Expand Down
62 changes: 62 additions & 0 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,68 @@ db.query(`CREATE TABLE IF NOT EXISTS trainer_setup_ratings (
logger.info('Table trainer_setup_ratings created or updated');
});

// regnum online resource server index
db.query(`CREATE TABLE IF NOT EXISTS regnum_res (
id INT AUTO_INCREMENT PRIMARY KEY,
res_id INT NOT NULL,
filename VARCHAR(255) NOT NULL,
name VARCHAR(255) NOT NULL,
type VARCHAR(255) NOT NULL,
url TEXT NOT NULL,
indexed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)`, (err, result) => {
if (err) {
logger.error('Error creating regnum_res table:', err);
throw err;
}
logger.info('Table regnum_res created or updated');
});

// import regnum online resource server index from json file
// it contains the filename and needs to be converted
// 12345-Filename-goes-here.png -> ID 12345, Name Filename goes here, Filename 12345-Filename-goes-here.png
// const regnumRes = require('../public/data/texturesparadise/files.json');
// if (Array.isArray(regnumRes.textures)) {
// for (const res of regnumRes.textures) {
// const res_id = parseInt(res.filename.split('-')[0]);
// const filename = res.filename;
// const type = 'texture';
// const name = res.filename.split('-').slice(1).join(' ').split('.')[0];
// const url = "https://cor-forum.de/regnum/datengrab/res/" + type.toUpperCase + "/" + res.filename;
// db.query('INSERT INTO regnum_res (res_id, filename, name, type, url) VALUES (?, ?, ?, ?, ?)', [res_id, filename, name, type, url], (err) => {
// if (err) {
// logger.error('Error inserting regnum_res into database:', err);
// throw err;
// }
// });
// }
// } else {
// logger.error('regnumRes.textures is not an array');
// }
//
// if (Array.isArray(regnumRes.sounds)) {
// for (const res of regnumRes.sounds) {
// const res_id = parseInt(res.filename.split('-')[0]);
// const filename = res.filename;
// const type = 'sound';
// const name = res.filename.split('-').slice(1).join(' ').split('.')[0];
// const url = "https://cor-forum.de/regnum/datengrab/res/" + type.toUpperCase + "/" + res.filename;
// db.query('INSERT INTO regnum_res (res_id, filename, name, type, url) VALUES (?, ?, ?, ?, ?)', [res_id, filename, name, type, url], (err) => {
// if (err) {
// logger.error('Error inserting regnum_res into database:', err);
// throw err;
// }
// });
// }
// } else {
// logger.error('regnumRes.sounds is not an array');
// }





// E-Mails

const nodemailer = require('nodemailer');
Expand Down

0 comments on commit ccc952b

Please sign in to comment.