mirror of
https://dev.s-ul.net/Galexion/MaiMaiDXNet.git
synced 2024-11-27 22:50:48 +01:00
Hotfix: Unhardcoded the DB file
This commit is contained in:
parent
2e551a9728
commit
0b0ef64a98
@ -23,6 +23,19 @@ clearStorageBtn.addEventListener('click', () => {
|
|||||||
window.location = "/";
|
window.location = "/";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function startBanBtnEventListener(status) {
|
||||||
|
// Get the Ban Button Element
|
||||||
|
const banBtn = document.getElementById('banButton');
|
||||||
|
|
||||||
|
// Add a click Event Listener to the Ban button.
|
||||||
|
banBtn.addEventListener('click', () => {
|
||||||
|
if(status === 0) {
|
||||||
|
getuserbanned(aime_card_id)
|
||||||
|
} else {
|
||||||
|
getuserunbanned(aime_card_id)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
// Get the cookie string
|
// Get the cookie string
|
||||||
const cookieString = document.cookie;
|
const cookieString = document.cookie;
|
||||||
|
|
||||||
@ -93,6 +106,21 @@ if (userdata.ban_state !== 0) {
|
|||||||
max-width:800px;'>Heya! It looks like you've been banned from playing on this profile, but don't worry - you can still enjoy the game in guest mode and view this profile. However, your account won't be able to play on it anymore. If you have any questions about your ban, please contact your Network Administrator.</h3>`; // or set the HTML content with scoreDiv.innerHTML = "<p>This is some HTML content</p>;
|
max-width:800px;'>Heya! It looks like you've been banned from playing on this profile, but don't worry - you can still enjoy the game in guest mode and view this profile. However, your account won't be able to play on it anymore. If you have any questions about your ban, please contact your Network Administrator.</h3>`; // or set the HTML content with scoreDiv.innerHTML = "<p>This is some HTML content</p>;
|
||||||
parent.insertBefore(wrapperDiv, parent.firstChild);
|
parent.insertBefore(wrapperDiv, parent.firstChild);
|
||||||
wrapperDiv.appendChild(scoreDiv);
|
wrapperDiv.appendChild(scoreDiv);
|
||||||
|
document.getElementById('BanUserArea').innerHTML = `Welcome back, developer! You found it! This is the unban button, available for self-banned users and Network admins. Click this button to reverse the ban, stop testing the features needed to be tested while banned, and get back to having fun.`;
|
||||||
|
let banButton = document.createElement('button');
|
||||||
|
banButton.id = "banButton";
|
||||||
|
banButton.innerHTML = "let me in... LET ME INnNnNnNnNnNnNnNnN";
|
||||||
|
|
||||||
|
document.getElementById('BanUserArea').append(banButton);
|
||||||
|
startBanBtnEventListener(1) // unban user
|
||||||
|
} else {
|
||||||
|
document.getElementById('BanUserArea').innerHTML = `Caution! Pressing this button will result in self-ban. Please use with care or take a break without resorting to self-banning. Remember, you can always reverse the action through the web UI.`;
|
||||||
|
let banButton = document.createElement('button');
|
||||||
|
banButton.id = "banButton";
|
||||||
|
banButton.innerHTML = "I Quit.";
|
||||||
|
|
||||||
|
document.getElementById('BanUserArea').append(banButton);
|
||||||
|
startBanBtnEventListener(0) // ban user
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -238,6 +266,7 @@ async function userPlayLogFormatter(div, loadMoreButton) {
|
|||||||
/* Full Combo */
|
/* Full Combo */
|
||||||
/* Full Sync */
|
/* Full Sync */
|
||||||
/* Player Placement */
|
/* Player Placement */
|
||||||
|
|
||||||
/* Side note: Can't Do Any of this without the Image Assets / Information, So Moving on for now */
|
/* Side note: Can't Do Any of this without the Image Assets / Information, So Moving on for now */
|
||||||
/* setting stuff up */
|
/* setting stuff up */
|
||||||
scoreDiv.setAttribute("class", "score-grid");
|
scoreDiv.setAttribute("class", "score-grid");
|
||||||
@ -293,7 +322,8 @@ async function userAreaStatusFormatter(div) {
|
|||||||
} else if (area.distance !== 0) {
|
} else if (area.distance !== 0) {
|
||||||
let diffrence = unlock.Distance - area.distance
|
let diffrence = unlock.Distance - area.distance
|
||||||
if (diffrence === 0) {
|
if (diffrence === 0) {
|
||||||
areaKilometers.innerHTML = areaKilometers.innerHTML + ` Task Track! Clear the song to continue!`;
|
console.log(unlock)
|
||||||
|
areaKilometers.innerHTML = areaKilometers.innerHTML + ` Task Track!<br>Clear ${unlock.TreasureId.str} to continue!`;
|
||||||
} else {
|
} else {
|
||||||
areaKilometers.innerHTML = areaKilometers.innerHTML + ` ${diffrence} KM until Next Reward.`;
|
areaKilometers.innerHTML = areaKilometers.innerHTML + ` ${diffrence} KM until Next Reward.`;
|
||||||
}
|
}
|
||||||
@ -305,6 +335,13 @@ async function userAreaStatusFormatter(div) {
|
|||||||
areaGrid.append(areaKilometers)
|
areaGrid.append(areaKilometers)
|
||||||
// Append to AreaGrid
|
// Append to AreaGrid
|
||||||
areaWrapper.append(areaGrid);
|
areaWrapper.append(areaGrid);
|
||||||
|
/* Details Button */
|
||||||
|
let areaDetails = document.createElement('div');
|
||||||
|
areaDetails.classList.add('areaDetails');
|
||||||
|
let areaDetailsButton = document.createElement('button');
|
||||||
|
areaDetailsButton.appendChild(document.createTextNode("Details"));
|
||||||
|
areaDetails.append(areaDetailsButton)
|
||||||
|
areaGrid.append(areaDetails)
|
||||||
}
|
}
|
||||||
// Place everything done here Inside the parent Div
|
// Place everything done here Inside the parent Div
|
||||||
div.appendChild(areaWrapper)
|
div.appendChild(areaWrapper)
|
||||||
@ -349,7 +386,7 @@ function UserPlayLog(aime_card_id) {
|
|||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
input: aime_card_id
|
input: input
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
@ -357,6 +394,44 @@ function UserPlayLog(aime_card_id) {
|
|||||||
.catch(error => console.error(error));
|
.catch(error => console.error(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getuserbanned(aime_card_id) {
|
||||||
|
const input = aime_card_id;
|
||||||
|
const url = "/api/getuserbanned/";
|
||||||
|
|
||||||
|
// Return the fetch promise so that it can be handled within userPlayLogFormatter
|
||||||
|
return fetch(url, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
input: input
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => window.location.reload())
|
||||||
|
.catch(error => console.error(error));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getuserunbanned(aime_card_id) {
|
||||||
|
const input = aime_card_id;
|
||||||
|
const url = "/api/getuserunbanned/";
|
||||||
|
|
||||||
|
// Return the fetch promise so that it can be handled within userPlayLogFormatter
|
||||||
|
return fetch(url, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
input: input
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => window.location.reload())
|
||||||
|
.catch(error => console.error(error));
|
||||||
|
}
|
||||||
|
|
||||||
function userAreaInfomation(aime_card_id) {
|
function userAreaInfomation(aime_card_id) {
|
||||||
const input = aime_card_id;
|
const input = aime_card_id;
|
||||||
const url = "/api/getUserArea/";
|
const url = "/api/getUserArea/";
|
||||||
@ -368,7 +443,7 @@ function userAreaInfomation(aime_card_id) {
|
|||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
input: aime_card_id
|
input: input
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
|
@ -170,9 +170,9 @@ h4.profile {
|
|||||||
grid-template-columns: max-content max-content min-content;
|
grid-template-columns: max-content max-content min-content;
|
||||||
|
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
'title title title'
|
'title title'
|
||||||
'kilometers kilometers kilometersReward'
|
'kilometers kilometers'
|
||||||
'. . details';
|
'. details';
|
||||||
|
|
||||||
gap: 0px;
|
gap: 0px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -186,14 +186,20 @@ h4.profile {
|
|||||||
.areaKilometers {
|
.areaKilometers {
|
||||||
grid-area: kilometers;
|
grid-area: kilometers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.areaDetails {
|
||||||
|
grid-area: details;
|
||||||
|
padding-top: 1em;
|
||||||
|
padding-bottom: 1em;
|
||||||
|
}
|
||||||
/* Galexion make your fucking mind up are you going to use camelCase or dashe-instead-of-spaces */
|
/* Galexion make your fucking mind up are you going to use camelCase or dashe-instead-of-spaces */
|
||||||
|
|
||||||
.score-grid {
|
.score-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|
||||||
grid-template-rows: min-content min-content min-content;
|
grid-template-rows: min-content min-content min-content;
|
||||||
grid-template-columns: 15em min-content min-content;
|
grid-template-columns: 82.5% min-content min-content;
|
||||||
|
grid-auto-rows: minmax(100px, auto);
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
'label0 label0'
|
'label0 label0'
|
||||||
'label1 label2'
|
'label1 label2'
|
||||||
@ -211,6 +217,7 @@ h4.profile {
|
|||||||
width: 80%;
|
width: 80%;
|
||||||
grid-template-rows: max-content min-content min-content;
|
grid-template-rows: max-content min-content min-content;
|
||||||
grid-template-columns: 1fr 1fr 1fr;
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
|
grid-auto-rows: minmax(100px, auto);
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
'label0 label0 label0'
|
'label0 label0 label0'
|
||||||
'label1 label2 label3'
|
'label1 label2 label3'
|
||||||
|
13
readme.md
13
readme.md
@ -42,6 +42,15 @@ Create a `config.json` file and paste this in, with paths to your instance.
|
|||||||
|
|
||||||
# Project Progress
|
# Project Progress
|
||||||
|
|
||||||
|
Goal for Milestone 1:
|
||||||
|
- Get all tabs showing with ***Some*** Functionality (2/6)
|
||||||
|
- PlayLog (Done)
|
||||||
|
- Photos
|
||||||
|
- Area (Done)
|
||||||
|
- Collection
|
||||||
|
- Ranking
|
||||||
|
- Options
|
||||||
|
|
||||||
ToDo:
|
ToDo:
|
||||||
- Create Play Data Tab
|
- Create Play Data Tab
|
||||||
- Get User Playlog Data (Done)
|
- Get User Playlog Data (Done)
|
||||||
@ -50,6 +59,7 @@ ToDo:
|
|||||||
- Re-Create the MaiMaiDXNet Playlog list (90% Done, can't continue without image assets that are only on the offical Server)
|
- Re-Create the MaiMaiDXNet Playlog list (90% Done, can't continue without image assets that are only on the offical Server)
|
||||||
- Create Detailed Look Into Score
|
- Create Detailed Look Into Score
|
||||||
- Create Photos Tab
|
- Create Photos Tab
|
||||||
|
- Create a rudementrary Photos tab until i can finallly get my hands on images of the Photos tab in MaiMai DX Net
|
||||||
- Create Area Tab
|
- Create Area Tab
|
||||||
- Get User Area Data (Done)
|
- Get User Area Data (Done)
|
||||||
- Get Metadata for Area (Done)
|
- Get Metadata for Area (Done)
|
||||||
@ -65,3 +75,6 @@ Complete:
|
|||||||
- Sign In Page
|
- Sign In Page
|
||||||
- Make User Profile on User Page (done)
|
- Make User Profile on User Page (done)
|
||||||
- Fuck you css go kill yourself
|
- Fuck you css go kill yourself
|
||||||
|
- Ban button
|
||||||
|
- lmao
|
||||||
|
- ok actually this is pretty cool
|
@ -3,7 +3,8 @@ var router = express.Router();
|
|||||||
var fetch = require('cross-fetch');
|
var fetch = require('cross-fetch');
|
||||||
const sqlite3 = require('sqlite3').verbose();
|
const sqlite3 = require('sqlite3').verbose();
|
||||||
|
|
||||||
let db = new sqlite3.Database('A:\\db.sqlite');
|
var config = require('../config.json');
|
||||||
|
let db = new sqlite3.Database(config.DXMemorialImageDirectory + '\\db.sqlite');
|
||||||
|
|
||||||
router.post('/getExtId/', function (req, res, next) {
|
router.post('/getExtId/', function (req, res, next) {
|
||||||
db.all('SELECT * FROM sega_card', (err, rows) => {
|
db.all('SELECT * FROM sega_card', (err, rows) => {
|
||||||
@ -91,4 +92,33 @@ let db = new sqlite3.Database('A:\\db.sqlite');
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.post('/getuserbanned/', function (req,res,next) {
|
||||||
|
var request = req.body;
|
||||||
|
if (request.input === undefined) {
|
||||||
|
return res.status(500).send('Failed to update user ban state, insufficent paramaters');
|
||||||
|
}
|
||||||
|
db.run('UPDATE maimai2_user_detail SET ban_state = ? WHERE id = ?', [2, request.input], function(err) {
|
||||||
|
if (err) {
|
||||||
|
console.error(err.message);
|
||||||
|
res.status(500).send('Failed to update user ban state');
|
||||||
|
} else {
|
||||||
|
res.send({"status": "Success", "message": `User ${request.input} banned.`});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post('/getuserunbanned/', function (req,res,next) {
|
||||||
|
var request = req.body;
|
||||||
|
if (request.input === undefined) {
|
||||||
|
return res.status(500).send('Failed to update user ban state, insufficent paramaters');
|
||||||
|
}
|
||||||
|
db.run('UPDATE maimai2_user_detail SET ban_state = ? WHERE id = ?', [0, request.input], function(err) {
|
||||||
|
if (err) {
|
||||||
|
console.error(err.message);
|
||||||
|
res.status(500).send('Failed to update user ban state');
|
||||||
|
} else {
|
||||||
|
res.send({"status": "Success", "message": `User ${request.input} unbanned.`});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
module.exports = router;
|
module.exports = router;
|
@ -2,8 +2,8 @@ var express = require('express');
|
|||||||
var router = express.Router();
|
var router = express.Router();
|
||||||
var fetch = require('cross-fetch');
|
var fetch = require('cross-fetch');
|
||||||
const sqlite3 = require('sqlite3').verbose();
|
const sqlite3 = require('sqlite3').verbose();
|
||||||
|
var config = require('../config.json');
|
||||||
let db = new sqlite3.Database('A:\\db.sqlite');
|
let db = new sqlite3.Database(config.DXMemorialImageDirectory + '\\db.sqlite');
|
||||||
/* GET home page. */
|
/* GET home page. */
|
||||||
var title = 'Webapp Mission Test'
|
var title = 'Webapp Mission Test'
|
||||||
router.get('/', function (req, res, next) {
|
router.get('/', function (req, res, next) {
|
||||||
@ -27,7 +27,7 @@ router.get('/user', async function (req, res, next) {
|
|||||||
const cookies = req.cookies
|
const cookies = req.cookies
|
||||||
console.log(cookies)
|
console.log(cookies)
|
||||||
if (cookies.aime_card_id === undefined) {
|
if (cookies.aime_card_id === undefined) {
|
||||||
return res.render('index', { title: title });
|
return res.redirect("/")
|
||||||
}
|
}
|
||||||
res.render('user', { title: title, userdata: await getUserData(req) });
|
res.render('user', { title: title, userdata: await getUserData(req) });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -13,5 +13,5 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="imgHeader">
|
<div id="imgHeader">
|
||||||
<img id="imgHeader" src="MaiMaiDXNet/maimaidxex.jpg">
|
<img id="imgHeader" src="/MaiMaiDXNet/maimaidxex.jpg">
|
||||||
</div>
|
</div>
|
@ -56,6 +56,12 @@
|
|||||||
<summary>Developer Only Information</summary>
|
<summary>Developer Only Information</summary>
|
||||||
For Development purposes only, send statistics found in this menu when encontering UI
|
For Development purposes only, send statistics found in this menu when encontering UI
|
||||||
Errors.
|
Errors.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Ban User</summary>
|
||||||
|
<div id="BanUserArea"></div>
|
||||||
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Raw User Details</summary>
|
<summary>Raw User Details</summary>
|
||||||
<pre><code><%=JSON.stringify(userdata, null, 2)%></code></pre>
|
<pre><code><%=JSON.stringify(userdata, null, 2)%></code></pre>
|
||||||
|
Loading…
Reference in New Issue
Block a user