Compare commits
13 Commits
master
...
SQLBackend
| Author | SHA1 | Date | |
|---|---|---|---|
| c340821d39 | |||
| 9bc1abe9a5 | |||
| 91e70f8a34 | |||
| 22957f6159 | |||
| 010c8fd0bb | |||
| eea19594e2 | |||
| 8a3db49489 | |||
| 7e7434d7e2 | |||
| 09f3b6dfc3 | |||
| b159318494 | |||
| 89a64a8fef | |||
| e639989424 | |||
| 88b63a3291 |
63
SQLDefinitions/tables.sql
Normal file
63
SQLDefinitions/tables.sql
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
CREATE TABLE `apps` (
|
||||||
|
`id` TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` VARCHAR(30),
|
||||||
|
`url` VARCHAR(50),
|
||||||
|
`icon` VARCHAR(30),
|
||||||
|
`urlbase` VARCHAR(15),
|
||||||
|
`NSFW` VARCHAR(10),
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE `links` (
|
||||||
|
`id` TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`category` VARCHAR(20),
|
||||||
|
`name` VARCHAR(50),
|
||||||
|
`url` VARCHAR(100),
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE `tabs` (
|
||||||
|
`id` TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` VARCHAR(50),
|
||||||
|
`NSFW` BOOLEAN,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE `categories` (
|
||||||
|
`id` TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` VARCHAR(50),
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE `messages` (
|
||||||
|
`id` TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`message` VARCHAR(255),
|
||||||
|
`easteregg` BOOLEAN,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE `personaldata` (
|
||||||
|
`fname` VARCHAR(20),
|
||||||
|
`lname` VARCHAR(30),
|
||||||
|
`email` VARCHAR(50)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE `providers` (
|
||||||
|
`id` TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` VARCHAR(20),
|
||||||
|
`url` VARCHAR(100),
|
||||||
|
`prefix` VARCHAR(5),
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE `themes` (
|
||||||
|
`id` TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` VARCHAR(20),
|
||||||
|
`imagebackground` VARCHAR(100),
|
||||||
|
`colorbackground` VARCHAR(9),
|
||||||
|
`colorserachbackground` VARCHAR(9),
|
||||||
|
`colortextpri` VARCHAR(9),
|
||||||
|
`colortextacc` VARCHAR(9),
|
||||||
|
`colorborder` VARCHAR(9),
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
@@ -2,8 +2,18 @@ const express = require("express");
|
|||||||
const bodyParser = require("body-parser");
|
const bodyParser = require("body-parser");
|
||||||
const cors = require("cors");
|
const cors = require("cors");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const wol = require("wol")
|
const wol = require("wol");
|
||||||
|
const mysql = require("mysql");
|
||||||
|
const sql = "SELECT * FROM "
|
||||||
|
|
||||||
|
var con = mysql.createConnection({
|
||||||
|
host: "localhost",
|
||||||
|
user: "hpadmin",
|
||||||
|
password: "changeme",
|
||||||
|
database: "home_page"
|
||||||
|
});
|
||||||
|
|
||||||
|
//Read bookmarks
|
||||||
try {
|
try {
|
||||||
var links = require('../src/links.json');
|
var links = require('../src/links.json');
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
@@ -14,7 +24,7 @@ try {
|
|||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"name": "Gitea",
|
"name": "Gitea",
|
||||||
"url": "https://home.halfaperture.com/gitea"
|
"url": "https://sean.bet/gitea"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -24,6 +34,7 @@ try {
|
|||||||
var links = require('../src/links.json');
|
var links = require('../src/links.json');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Read personal data
|
||||||
try {
|
try {
|
||||||
var personaldata = require('../src/personaldata.json');
|
var personaldata = require('../src/personaldata.json');
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
@@ -36,6 +47,7 @@ try {
|
|||||||
var personaldata = require('../src/personaldata.json');
|
var personaldata = require('../src/personaldata.json');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Read app list
|
||||||
if (fs.existsSync('../src/apps.json')) {
|
if (fs.existsSync('../src/apps.json')) {
|
||||||
console.log("apps.json exists");
|
console.log("apps.json exists");
|
||||||
}else {
|
}else {
|
||||||
@@ -47,10 +59,8 @@ if (fs.existsSync('../src/apps.json')) {
|
|||||||
fs.writeFileSync('../src/apps.json',body);
|
fs.writeFileSync('../src/apps.json',body);
|
||||||
}
|
}
|
||||||
|
|
||||||
const providers = require('../src/providers.json');
|
//Read everything else
|
||||||
const themes = require('../src/themes.json');
|
const themes = require('../src/themes.json');
|
||||||
const messages = require('../src/messages.json');
|
|
||||||
|
|
||||||
// initializing app
|
// initializing app
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
@@ -65,7 +75,7 @@ app.get("/sui/api/apps", (req, res) => {
|
|||||||
let apps = JSON.parse(data);
|
let apps = JSON.parse(data);
|
||||||
res.status(200).send(apps.apps);
|
res.status(200).send(apps.apps);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/sui/api/links", (req, res) => {
|
app.get("/sui/api/links", (req, res) => {
|
||||||
@@ -73,19 +83,31 @@ app.get("/sui/api/links", (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.get("/sui/api/providers", (req, res) => {
|
app.get("/sui/api/providers", (req, res) => {
|
||||||
res.status(200).send(providers.providers);
|
con.query('SELECT * FROM providers', (error, results, fields) => {
|
||||||
|
if (error) throw error;
|
||||||
|
res.status(200).send(results);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/sui/api/themes", (req, res) => {
|
app.get("/sui/api/themes", (req, res) => {
|
||||||
res.status(200).send(themes.themes);
|
con.query('SELECT * FROM themes', (error, results, fields) => {
|
||||||
|
if (error) throw error;
|
||||||
|
res.status(200).send(results);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/sui/api/personaldata", (req, res) => {
|
app.get("/sui/api/personaldata", (req, res) => {
|
||||||
res.status(200).send(personaldata);
|
con.query('SELECT * FROM personaldata', (error, results, fields) => {
|
||||||
|
if (error) throw error;
|
||||||
|
res.status(200).send(results);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/sui/api/messages", (req, res) => {
|
app.get("/sui/api/messages", (req, res) => {
|
||||||
res.status(200).send(messages.messages);
|
con.query('SELECT * FROM messages', (error, results, fields) => {
|
||||||
|
if (error) throw error;
|
||||||
|
res.status(200).send(results);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/sui/api/appUpdate", jsonParser, (req, res) => {
|
app.post("/sui/api/appUpdate", jsonParser, (req, res) => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"proxy": "http://localhost:5000",
|
"proxy": "http://localhost:5000",
|
||||||
"homepage": "https://home.halfaperture.com/sui",
|
"homepage": "https://sean.bet/sui",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@testing-library/jest-dom": "^5.16.1",
|
"@testing-library/jest-dom": "^5.16.1",
|
||||||
"@testing-library/react": "^11.2.7",
|
"@testing-library/react": "^11.2.7",
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
{
|
{
|
||||||
"apps" : [
|
"apps" : [
|
||||||
{"name":"Deluge","url":"home.halfaperture.com/deluge","icon":"water","urlbase":"/Deluge","NSFW":"NSFW"},
|
{"name":"Deluge","url":"sean.bet/deluge","icon":"water","urlbase":"/Deluge","NSFW":"NSFW"},
|
||||||
{"name":"Gitea","url":"home.halfaperture.com/gitea","icon":"tea","urlbase":"/Gitea","NSFW":"SAFE"},
|
{"name":"Gitea","url":"sean.bet/gitea","icon":"tea","urlbase":"/Gitea","NSFW":"SAFE"},
|
||||||
{"name":"Grafana","url":"home.halfaperture.com/grafana","icon":"chart-areaspline-variant","urlbase":"/Grafana","NSFW":"SAFE"},
|
{"name":"Grafana","url":"sean.bet/grafana","icon":"chart-areaspline-variant","urlbase":"/Grafana","NSFW":"SAFE"},
|
||||||
{"name":"Guacamole","url":"home.halfaperture.com/guacamole","icon":"remote-desktop","urlbase":"/Guacamole","NSFW":"SAFE"},
|
{"name":"Guacamole","url":"sean.bet/guacamole","icon":"remote-desktop","urlbase":"/Guacamole","NSFW":"SAFE"},
|
||||||
{"name":"Jackett","url":"home.halfaperture.com/jackett","icon":"tshirt-crew","urlbase":"/Jackett","NSFW":"NSFW"},
|
{"name":"Jackett","url":"sean.bet/jackett","icon":"tshirt-crew","urlbase":"/Jackett","NSFW":"NSFW"},
|
||||||
{"name":"Lidarr","url":"home.halfaperture.com/lidarr","icon":"music-circle","urlbase":"/Lidarr","NSFW":"NSFW"},
|
{"name":"Lidarr","url":"sean.bet/lidarr","icon":"music-circle","urlbase":"/Lidarr","NSFW":"NSFW"},
|
||||||
{"name":"NextCloud","url":"home.halfaperture.com/nextcloud","icon":"cloud","urlbase":"/NextCloud","NSFW":"SAFE"},
|
{"name":"NextCloud","url":"sean.bet/nextcloud","icon":"cloud","urlbase":"/NextCloud","NSFW":"SAFE"},
|
||||||
{"name":"NZBHydra","url":"home.halfaperture.com/nzbhydra","icon":"snake","urlbase":"/NZBHydra","NSFW":"NSFW"},
|
{"name":"NZBHydra","url":"sean.bet/nzbhydra","icon":"snake","urlbase":"/NZBHydra","NSFW":"NSFW"},
|
||||||
{"name":"PiHole","url":"home.halfaperture.com/admin","icon":"pi-hole","urlbase":"/Admin","NSFW":"SAFE"},
|
{"name":"PiHole","url":"sean.bet/admin","icon":"pi-hole","urlbase":"/Admin","NSFW":"SAFE"},
|
||||||
{"name":"Plex","url":"home.halfaperture.com/plex","icon":"plex","urlbase":"/Plex","NSFW":"SAFE"},
|
{"name":"Plex","url":"sean.bet/plex","icon":"plex","urlbase":"/Plex","NSFW":"SAFE"},
|
||||||
{"name":"OctoPrint","url":"home.halfaperture.com/octoprint","icon":"printer-3d","urlbase":"/octoprint","NSFW":"SAFE"},
|
{"name":"OctoPrint","url":"sean.bet/octoprint","icon":"printer-3d","urlbase":"/octoprint","NSFW":"SAFE"},
|
||||||
{"name":"Ombi","url":"home.halfaperture.com/requests","icon":"magnify","urlbase":"/Ombi","NSFW":"NSFW"},
|
{"name":"Ombi","url":"sean.bet/requests","icon":"magnify","urlbase":"/Ombi","NSFW":"NSFW"},
|
||||||
{"name":"Organizr","url":"home.halfaperture.com","icon":"home","urlbase":"/Organizr","NSFW":"SAFE"},
|
{"name":"Organizr","url":"sean.bet","icon":"home","urlbase":"/Organizr","NSFW":"SAFE"},
|
||||||
{"name":"Radarr","url":"home.halfaperture.com/radarr","icon":"movie-open","urlbase":"/Radarr","NSFW":"NSFW"},
|
{"name":"Radarr","url":"sean.bet/radarr","icon":"movie-open","urlbase":"/Radarr","NSFW":"NSFW"},
|
||||||
{"name":"Readarr","url":"home.halfaperture.com/readarr","icon":"library","urlbase":"/Readarr","NSFW":"NSFW"},
|
{"name":"Readarr","url":"sean.bet/readarr","icon":"library","urlbase":"/Readarr","NSFW":"NSFW"},
|
||||||
{"name":"SABnzbd","url":"home.halfaperture.com/sabnzbd","icon":"download","urlbase":"/SABnzbd","NSFW":"NSFW"},
|
{"name":"SABnzbd","url":"sean.bet/sabnzbd","icon":"download","urlbase":"/SABnzbd","NSFW":"NSFW"},
|
||||||
{"name":"Sonarr","url":"home.halfaperture.com/sonarr","icon":"television-classic","urlbase":"/Sonarr","NSFW":"NSFW"},
|
{"name":"Sonarr","url":"sean.bet/sonarr","icon":"television-classic","urlbase":"/Sonarr","NSFW":"NSFW"},
|
||||||
{"name":"Tautulli","url":"home.halfaperture.com/stats","icon":"chart-bar","urlbase":"/Stats","NSFW":"NSFW"},
|
{"name":"Tautulli","url":"sean.bet/stats","icon":"chart-bar","urlbase":"/Stats","NSFW":"NSFW"},
|
||||||
{"name":"uBooquity","url":"home.halfaperture.com/ubooquity","icon":"book-open-outline","urlbase":"/uBooquity","NSFW":"SAFE"},
|
{"name":"uBooquity","url":"sean.bet/ubooquity","icon":"book-open-outline","urlbase":"/uBooquity","NSFW":"SAFE"},
|
||||||
{"name":"Wiki","url":"home.halfaperture.com/wiki","icon":"wikipedia","urlbase":"/Wiki","NSFW":"SAFE"}
|
{"name":"Wiki","url":"sean.bet/wiki","icon":"wikipedia","urlbase":"/Wiki","NSFW":"SAFE"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export function greet() {
|
|||||||
let currentTime = new Date();
|
let currentTime = new Date();
|
||||||
let greet = Math.floor(currentTime.getHours() / 6);
|
let greet = Math.floor(currentTime.getHours() / 6);
|
||||||
let easterEggChance = Math.floor(Math.random() * 100);
|
let easterEggChance = Math.floor(Math.random() * 100);
|
||||||
let greetings = require('../messages.json');
|
let greetings = require("../messages.json");
|
||||||
let timeBased = [];
|
let timeBased = [];
|
||||||
let easterEggs = [];
|
let easterEggs = [];
|
||||||
for (var i = 0; i < greetings.messages.length; i++) {
|
for (var i = 0; i < greetings.messages.length; i++) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const ApplicationSettings = () => {
|
|||||||
const addRow = () => {
|
const addRow = () => {
|
||||||
setState([
|
setState([
|
||||||
...state,
|
...state,
|
||||||
{ key: state.length +1,name: "", url: "home.halfaperture.com/", icon: "", urlbase: "/", NSFW: false}
|
{ key: state.length +1,name: "", url: "sean.bet/", icon: "", urlbase: "/", NSFW: false}
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import Messages from './Messages';
|
|||||||
function MessageInfo() {
|
function MessageInfo() {
|
||||||
const [state, setState] = useState([]);
|
const [state, setState] = useState([]);
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
const response = await fetch("/sui/api/messages");
|
const response = await fetch("/sui/api/messages");
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
setState(data);
|
setState(data);
|
||||||
@@ -13,14 +13,13 @@ function MessageInfo() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getData();
|
getData();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="messageForm">
|
<div id="messageForm">
|
||||||
{state.map((greetings, index) => (
|
{state.map((greetings, index) => (
|
||||||
<Messages
|
<Messages
|
||||||
key={index}
|
key={index}
|
||||||
group={index+1}
|
group={index+1}
|
||||||
index={greetings.index}
|
|
||||||
greeting={greetings.message}
|
greeting={greetings.message}
|
||||||
easterEgg={greetings.easteregg}
|
easterEgg={greetings.easteregg}
|
||||||
/>
|
/>
|
||||||
@@ -29,4 +28,4 @@ function MessageInfo() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MessageInfo
|
export default MessageInfo
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
function Messages(props) {
|
function Messages(props) {
|
||||||
|
|
||||||
var eeChecked;
|
var eeChecked;
|
||||||
if(props.easterEgg === "TRUE") {
|
if(props.easterEgg === 1) {
|
||||||
eeChecked = true;
|
eeChecked = true;
|
||||||
} else if(props.easterEgg === "FALSE") {
|
} else if(props.easterEgg === 0) {
|
||||||
eeChecked = false;
|
eeChecked = false;
|
||||||
} else {
|
} else {
|
||||||
eeChecked = false;
|
eeChecked = false;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div id="messageGrid" title={props.group}>
|
<div id="messageGrid" title={props.group}>
|
||||||
<label htmlFor="index">Index</label>
|
|
||||||
<input id="index" type="text" defaultValue={props.index}></input>
|
|
||||||
<label htmlFor="greeting">Greeting</label>
|
<label htmlFor="greeting">Greeting</label>
|
||||||
<input id="greeting" type="text" defaultValue={props.greeting}></input>
|
<input id="greeting" type="text" defaultValue={props.greeting}></input>
|
||||||
<label htmlFor="Easter Egg">Easter Egg</label>
|
<label htmlFor="Easter Egg">Easter Egg</label>
|
||||||
@@ -20,4 +18,4 @@ function Messages(props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Messages;
|
export default Messages;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ function PersonalInfo() {
|
|||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
const response = await fetch("/sui/api/personaldata");
|
const response = await fetch("/sui/api/personaldata");
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
setState(data);
|
setState(data[0]);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -23,4 +23,4 @@ function PersonalInfo() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PersonalInfo;
|
export default PersonalInfo;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"name": "Nextcloud",
|
"name": "Nextcloud",
|
||||||
"url": "https://home.halfaperture.com/nextcloud/apps/files"
|
"url": "https://sean.bet/nextcloud/apps/files"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "OneDrive",
|
"name": "OneDrive",
|
||||||
@@ -144,7 +144,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Guacamole",
|
"name": "Guacamole",
|
||||||
"url": "https://home.halfaperture.com/guacamole"
|
"url": "https://sean.bet/guacamole"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Unifi",
|
"name": "Unifi",
|
||||||
|
|||||||
Reference in New Issue
Block a user