Compare commits
11 Commits
master
...
91e70f8a34
| Author | SHA1 | Date | |
|---|---|---|---|
| 91e70f8a34 | |||
| 22957f6159 | |||
| 010c8fd0bb | |||
| eea19594e2 | |||
| 8a3db49489 | |||
| 7e7434d7e2 | |||
| 09f3b6dfc3 | |||
| b159318494 | |||
| 89a64a8fef | |||
| e639989424 | |||
| 88b63a3291 |
57
SQLDefinitions/tables.sql
Normal file
57
SQLDefinitions/tables.sql
Normal file
@@ -0,0 +1,57 @@
|
||||
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 `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 cors = require("cors");
|
||||
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 {
|
||||
var links = require('../src/links.json');
|
||||
} catch(err) {
|
||||
@@ -14,7 +24,7 @@ try {
|
||||
"links": [
|
||||
{
|
||||
"name": "Gitea",
|
||||
"url": "https://home.halfaperture.com/gitea"
|
||||
"url": "https://sean.bet/gitea"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -24,6 +34,7 @@ try {
|
||||
var links = require('../src/links.json');
|
||||
}
|
||||
|
||||
//Read personal data
|
||||
try {
|
||||
var personaldata = require('../src/personaldata.json');
|
||||
} catch(err) {
|
||||
@@ -36,6 +47,7 @@ try {
|
||||
var personaldata = require('../src/personaldata.json');
|
||||
}
|
||||
|
||||
//Read app list
|
||||
if (fs.existsSync('../src/apps.json')) {
|
||||
console.log("apps.json exists");
|
||||
}else {
|
||||
@@ -47,10 +59,8 @@ if (fs.existsSync('../src/apps.json')) {
|
||||
fs.writeFileSync('../src/apps.json',body);
|
||||
}
|
||||
|
||||
const providers = require('../src/providers.json');
|
||||
//Read everything else
|
||||
const themes = require('../src/themes.json');
|
||||
const messages = require('../src/messages.json');
|
||||
|
||||
// initializing app
|
||||
const app = express();
|
||||
|
||||
@@ -65,7 +75,7 @@ app.get("/sui/api/apps", (req, res) => {
|
||||
let apps = JSON.parse(data);
|
||||
res.status(200).send(apps.apps);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
app.get("/sui/api/links", (req, res) => {
|
||||
@@ -73,7 +83,11 @@ app.get("/sui/api/links", (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) => {
|
||||
@@ -81,11 +95,17 @@ app.get("/sui/api/themes", (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) => {
|
||||
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) => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"proxy": "http://localhost:5000",
|
||||
"homepage": "https://home.halfaperture.com/sui",
|
||||
"homepage": "https://sean.bet/sui",
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^5.16.1",
|
||||
"@testing-library/react": "^11.2.7",
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
{
|
||||
"apps" : [
|
||||
{"name":"Deluge","url":"home.halfaperture.com/deluge","icon":"water","urlbase":"/Deluge","NSFW":"NSFW"},
|
||||
{"name":"Gitea","url":"home.halfaperture.com/gitea","icon":"tea","urlbase":"/Gitea","NSFW":"SAFE"},
|
||||
{"name":"Grafana","url":"home.halfaperture.com/grafana","icon":"chart-areaspline-variant","urlbase":"/Grafana","NSFW":"SAFE"},
|
||||
{"name":"Guacamole","url":"home.halfaperture.com/guacamole","icon":"remote-desktop","urlbase":"/Guacamole","NSFW":"SAFE"},
|
||||
{"name":"Jackett","url":"home.halfaperture.com/jackett","icon":"tshirt-crew","urlbase":"/Jackett","NSFW":"NSFW"},
|
||||
{"name":"Lidarr","url":"home.halfaperture.com/lidarr","icon":"music-circle","urlbase":"/Lidarr","NSFW":"NSFW"},
|
||||
{"name":"NextCloud","url":"home.halfaperture.com/nextcloud","icon":"cloud","urlbase":"/NextCloud","NSFW":"SAFE"},
|
||||
{"name":"NZBHydra","url":"home.halfaperture.com/nzbhydra","icon":"snake","urlbase":"/NZBHydra","NSFW":"NSFW"},
|
||||
{"name":"PiHole","url":"home.halfaperture.com/admin","icon":"pi-hole","urlbase":"/Admin","NSFW":"SAFE"},
|
||||
{"name":"Plex","url":"home.halfaperture.com/plex","icon":"plex","urlbase":"/Plex","NSFW":"SAFE"},
|
||||
{"name":"OctoPrint","url":"home.halfaperture.com/octoprint","icon":"printer-3d","urlbase":"/octoprint","NSFW":"SAFE"},
|
||||
{"name":"Ombi","url":"home.halfaperture.com/requests","icon":"magnify","urlbase":"/Ombi","NSFW":"NSFW"},
|
||||
{"name":"Organizr","url":"home.halfaperture.com","icon":"home","urlbase":"/Organizr","NSFW":"SAFE"},
|
||||
{"name":"Radarr","url":"home.halfaperture.com/radarr","icon":"movie-open","urlbase":"/Radarr","NSFW":"NSFW"},
|
||||
{"name":"Readarr","url":"home.halfaperture.com/readarr","icon":"library","urlbase":"/Readarr","NSFW":"NSFW"},
|
||||
{"name":"SABnzbd","url":"home.halfaperture.com/sabnzbd","icon":"download","urlbase":"/SABnzbd","NSFW":"NSFW"},
|
||||
{"name":"Sonarr","url":"home.halfaperture.com/sonarr","icon":"television-classic","urlbase":"/Sonarr","NSFW":"NSFW"},
|
||||
{"name":"Tautulli","url":"home.halfaperture.com/stats","icon":"chart-bar","urlbase":"/Stats","NSFW":"NSFW"},
|
||||
{"name":"uBooquity","url":"home.halfaperture.com/ubooquity","icon":"book-open-outline","urlbase":"/uBooquity","NSFW":"SAFE"},
|
||||
{"name":"Wiki","url":"home.halfaperture.com/wiki","icon":"wikipedia","urlbase":"/Wiki","NSFW":"SAFE"}
|
||||
{"name":"Deluge","url":"sean.bet/deluge","icon":"water","urlbase":"/Deluge","NSFW":"NSFW"},
|
||||
{"name":"Gitea","url":"sean.bet/gitea","icon":"tea","urlbase":"/Gitea","NSFW":"SAFE"},
|
||||
{"name":"Grafana","url":"sean.bet/grafana","icon":"chart-areaspline-variant","urlbase":"/Grafana","NSFW":"SAFE"},
|
||||
{"name":"Guacamole","url":"sean.bet/guacamole","icon":"remote-desktop","urlbase":"/Guacamole","NSFW":"SAFE"},
|
||||
{"name":"Jackett","url":"sean.bet/jackett","icon":"tshirt-crew","urlbase":"/Jackett","NSFW":"NSFW"},
|
||||
{"name":"Lidarr","url":"sean.bet/lidarr","icon":"music-circle","urlbase":"/Lidarr","NSFW":"NSFW"},
|
||||
{"name":"NextCloud","url":"sean.bet/nextcloud","icon":"cloud","urlbase":"/NextCloud","NSFW":"SAFE"},
|
||||
{"name":"NZBHydra","url":"sean.bet/nzbhydra","icon":"snake","urlbase":"/NZBHydra","NSFW":"NSFW"},
|
||||
{"name":"PiHole","url":"sean.bet/admin","icon":"pi-hole","urlbase":"/Admin","NSFW":"SAFE"},
|
||||
{"name":"Plex","url":"sean.bet/plex","icon":"plex","urlbase":"/Plex","NSFW":"SAFE"},
|
||||
{"name":"OctoPrint","url":"sean.bet/octoprint","icon":"printer-3d","urlbase":"/octoprint","NSFW":"SAFE"},
|
||||
{"name":"Ombi","url":"sean.bet/requests","icon":"magnify","urlbase":"/Ombi","NSFW":"NSFW"},
|
||||
{"name":"Organizr","url":"sean.bet","icon":"home","urlbase":"/Organizr","NSFW":"SAFE"},
|
||||
{"name":"Radarr","url":"sean.bet/radarr","icon":"movie-open","urlbase":"/Radarr","NSFW":"NSFW"},
|
||||
{"name":"Readarr","url":"sean.bet/readarr","icon":"library","urlbase":"/Readarr","NSFW":"NSFW"},
|
||||
{"name":"SABnzbd","url":"sean.bet/sabnzbd","icon":"download","urlbase":"/SABnzbd","NSFW":"NSFW"},
|
||||
{"name":"Sonarr","url":"sean.bet/sonarr","icon":"television-classic","urlbase":"/Sonarr","NSFW":"NSFW"},
|
||||
{"name":"Tautulli","url":"sean.bet/stats","icon":"chart-bar","urlbase":"/Stats","NSFW":"NSFW"},
|
||||
{"name":"uBooquity","url":"sean.bet/ubooquity","icon":"book-open-outline","urlbase":"/uBooquity","NSFW":"SAFE"},
|
||||
{"name":"Wiki","url":"sean.bet/wiki","icon":"wikipedia","urlbase":"/Wiki","NSFW":"SAFE"}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@ export function greet() {
|
||||
let currentTime = new Date();
|
||||
let greet = Math.floor(currentTime.getHours() / 6);
|
||||
let easterEggChance = Math.floor(Math.random() * 100);
|
||||
let greetings = require('../messages.json');
|
||||
let rawgreetings = fetch("/sui/api/messages");
|
||||
let greetings = rawgreetings.json();
|
||||
let timeBased = [];
|
||||
let easterEggs = [];
|
||||
for (var i = 0; i < greetings.messages.length; i++) {
|
||||
|
||||
@@ -13,7 +13,7 @@ const ApplicationSettings = () => {
|
||||
const addRow = () => {
|
||||
setState([
|
||||
...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() {
|
||||
const [state, setState] = useState([]);
|
||||
|
||||
const getData = async () => {
|
||||
const getData = async () => {
|
||||
const response = await fetch("/sui/api/messages");
|
||||
const data = await response.json();
|
||||
setState(data);
|
||||
@@ -13,14 +13,13 @@ function MessageInfo() {
|
||||
useEffect(() => {
|
||||
getData();
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
<div id="messageForm">
|
||||
{state.map((greetings, index) => (
|
||||
<Messages
|
||||
key={index}
|
||||
group={index+1}
|
||||
index={greetings.index}
|
||||
greeting={greetings.message}
|
||||
easterEgg={greetings.easteregg}
|
||||
/>
|
||||
@@ -29,4 +28,4 @@ function MessageInfo() {
|
||||
);
|
||||
}
|
||||
|
||||
export default MessageInfo
|
||||
export default MessageInfo
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
function Messages(props) {
|
||||
|
||||
var eeChecked;
|
||||
if(props.easterEgg === "TRUE") {
|
||||
if(props.easterEgg === 1) {
|
||||
eeChecked = true;
|
||||
} else if(props.easterEgg === "FALSE") {
|
||||
} else if(props.easterEgg === 0) {
|
||||
eeChecked = false;
|
||||
} else {
|
||||
eeChecked = false;
|
||||
}
|
||||
return (
|
||||
<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>
|
||||
<input id="greeting" type="text" defaultValue={props.greeting}></input>
|
||||
<label htmlFor="Easter Egg">Easter Egg</label>
|
||||
@@ -20,4 +18,4 @@ function Messages(props) {
|
||||
);
|
||||
}
|
||||
|
||||
export default Messages;
|
||||
export default Messages;
|
||||
|
||||
@@ -23,4 +23,4 @@ function PersonalInfo() {
|
||||
);
|
||||
}
|
||||
|
||||
export default PersonalInfo;
|
||||
export default PersonalInfo;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"links": [
|
||||
{
|
||||
"name": "Nextcloud",
|
||||
"url": "https://home.halfaperture.com/nextcloud/apps/files"
|
||||
"url": "https://sean.bet/nextcloud/apps/files"
|
||||
},
|
||||
{
|
||||
"name": "OneDrive",
|
||||
@@ -144,7 +144,7 @@
|
||||
},
|
||||
{
|
||||
"name": "Guacamole",
|
||||
"url": "https://home.halfaperture.com/guacamole"
|
||||
"url": "https://sean.bet/guacamole"
|
||||
},
|
||||
{
|
||||
"name": "Unifi",
|
||||
|
||||
Reference in New Issue
Block a user