Archived
1
0

21 Commits

Author SHA1 Message Date
c340821d39 Added new categories table 2022-12-31 12:03:02 -06:00
9bc1abe9a5 SQL related changes 2022-12-30 18:55:12 -06:00
91e70f8a34 Merge branch 'SQLBackend' of https://home.halfaperture.com/gitea/smedmunds/home-page into SQLBackend 2022-12-30 18:30:13 -06:00
22957f6159 Trying to change grettings 2022-12-30 18:29:58 -06:00
010c8fd0bb Reading some data from SQL 2022-12-30 18:25:05 -06:00
eea19594e2 Merge branch 'SQLBackend' of https://sean.bet/gitea/smedmunds/home-page into SQLBackend 2022-12-30 16:43:35 -06:00
8a3db49489 Merging 2022-12-30 16:42:25 -06:00
7e7434d7e2 Not sure lmao 2022-12-30 16:34:08 -06:00
09f3b6dfc3 Function testing getting data 2022-12-30 16:10:05 -06:00
b159318494 Added line 2022-12-30 13:10:42 -06:00
89a64a8fef New SQL def & added code example to read from SQL 2022-12-30 12:25:46 -06:00
e639989424 Fixed folder name and sql definition file 2022-12-28 17:06:26 -06:00
88b63a3291 Starting move from JSON to SQL. Removed old domain 2022-12-28 12:29:59 -06:00
ea8d98b940 Switched to get instead of post for wol 2022-12-16 14:53:01 -06:00
4a01fe4b3b Testing WoL 2022-12-16 14:05:56 -06:00
56f700c423 Merge branch 'master' of https://home.halfaperture.com/gitea/smedmunds/home-page 2022-11-21 12:02:03 -06:00
becf4fa546 Added new search provider 2022-11-21 12:01:29 -06:00
Sean Edmunds
7c36a566f1 Logic for missing json files 2022-07-30 11:29:28 -05:00
Sean Edmunds
fb23c9cf55 fixed mismatch with 'baseurl' and 'urlbase' 2022-07-30 09:51:53 -05:00
17e9255405 created new start up script for node express server 2022-07-29 15:18:41 -05:00
c305fec4f3 updated to add new bento theme 2022-07-29 15:18:14 -05:00
16 changed files with 1723 additions and 104 deletions

63
SQLDefinitions/tables.sql Normal file
View 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`)
);

View File

@@ -2,13 +2,65 @@ const express = require("express");
const bodyParser = require("body-parser");
const cors = require("cors");
const fs = require("fs");
const wol = require("wol");
const mysql = require("mysql");
const sql = "SELECT * FROM "
const links = require('../src/links.json');
const providers = require('../src/providers.json');
var con = mysql.createConnection({
host: "localhost",
user: "hpadmin",
password: "changeme",
database: "home_page"
});
//Read bookmarks
try {
var links = require('../src/links.json');
} catch(err) {
let body = `{
"bookmarks" : [
{
"category": "Example",
"links": [
{
"name": "Gitea",
"url": "https://sean.bet/gitea"
}
]
}
]
}`;
fs.writeFileSync('../src/links.json',body);
var links = require('../src/links.json');
}
//Read personal data
try {
var personaldata = require('../src/personaldata.json');
} catch(err) {
let body = `{
"fname":"",
"lname":"",
"email":""
}`;
fs.writeFileSync('../src/personaldata.json',body);
var personaldata = require('../src/personaldata.json');
}
//Read app list
if (fs.existsSync('../src/apps.json')) {
console.log("apps.json exists");
}else {
let body = `{
"apps" : [
{"name":"Example","url":"your.site.com/example","icon":"web","urlbase":"/Example","NSFW":"SAFE"}
]
}`;
fs.writeFileSync('../src/apps.json',body);
}
//Read everything else
const themes = require('../src/themes.json');
const personaldata = require('../src/personaldata.json');
const messages = require('../src/messages.json');
// initializing app
const app = express();
@@ -20,10 +72,10 @@ var jsonParser = bodyParser.json();
app.get("/sui/api/apps", (req, res) => {
fs.readFile('../src/apps.json', (err, data) => {
if (err) throw err;
let test = JSON.parse(data);
res.status(200).send(test.apps);
let apps = JSON.parse(data);
res.status(200).send(apps.apps);
});
});
app.get("/sui/api/links", (req, res) => {
@@ -31,19 +83,31 @@ 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) => {
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) => {
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) => {
@@ -53,9 +117,13 @@ app.post("/sui/api/appUpdate", jsonParser, (req, res) => {
res.status(200).send(applications.apps)
});
app.get("/sui/api/wakeDakota", (req, res) => {
wol.wake('18:C0:4D:81:57:68', function(err, res){
console.log(res);
});
});
// app is listening on port 5000
app.listen(5000, () => {
console.log("node server is running on port 5000");
});
});

1545
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -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",

View File

@@ -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":"LazyLibrarian","url":"home.halfaperture.com/lazylibrarian","icon":"library","urlbase":"/LazyLibrarian","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":"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"}
]
}
}

View File

@@ -23,7 +23,7 @@ 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 greetings = require("../messages.json");
let timeBased = [];
let easterEggs = [];
for (var i = 0; i < greetings.messages.length; i++) {
@@ -159,9 +159,12 @@ export function updateLabel(text) {
case "t":
document.getElementById("searchType").innerHTML = "Trakt search";
break;
case "y":
case "yt":
document.getElementById("searchType").innerHTML = "YouTube search";
break;
case "y":
document.getElementById("searchType").innerHTML = "You search";
break;
case "w":
document.getElementById("searchType").innerHTML = "Wikipedia search";
break;
@@ -218,9 +221,12 @@ export function search(text) {
case "tv":
window.location = "https://www.thetvdb.com/search?query=" + subtext;
break;
case "y":
case "yt":
window.location = "https://www.youtube.com/results?search_query=" + subtext;
break;
case "y":
window.location = "https://www.you.com/search?q=" + subtext;
break;
case "w":
window.location = "https://en.wikipedia.org/w/index.php?search=" + subtext;
break;
@@ -239,7 +245,7 @@ export function search(text) {
case "d":
window.location = "https://www.duckduckgo.com";
break;
case "y":
case "yt":
window.location = "https://www.youtube.com";
break;
case "r":
@@ -281,4 +287,4 @@ export function replaceAll(search, replacement) {
export default function main () {
return;
}
}

View File

@@ -14,10 +14,10 @@ function ApplicationDetails(props) {
<input id="name" className="settingsText" type="text" defaultValue={props.name}></input>
<input id="url" className="settingsText" type="text" defaultValue={props.url}></input>
<input id="icon" className="settingsText" type="text" defaultValue={props.icon}></input>
<input id="baseurl" className="settingsText" type="text" defaultValue={props.urlbase}></input>
<input id="urlbase" className="settingsText" type="text" defaultValue={props.urlbase}></input>
<input id="NSFW" className="settingsCheckbox" type="checkbox" defaultChecked={nsfwChecked}></input>
</div>
);
}
export default ApplicationDetails;
export default ApplicationDetails;

View File

@@ -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}
]);
};
@@ -43,7 +43,7 @@ const ApplicationSettings = () => {
case "icon":
icons.push(item.value)
break;
case "baseurl":
case "urlbase":
urlbases.push(item.value)
break;
default:
@@ -62,7 +62,7 @@ const ApplicationSettings = () => {
"name" : names[index],
"url" : urls[index],
"icon" : icons[index],
"baseurl" : urlbases[index],
"urlbase" : urlbases[index],
"NSFW" : NSFWs[index]
});
}
@@ -108,4 +108,4 @@ const ApplicationSettings = () => {
);
}
export default ApplicationSettings;
export default ApplicationSettings;

View File

@@ -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

View File

@@ -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;

View File

@@ -7,7 +7,7 @@ function PersonalInfo() {
const getData = async () => {
const response = await fetch("/sui/api/personaldata");
const data = await response.json();
setState(data);
setState(data[0]);
};
useEffect(() => {
@@ -23,4 +23,4 @@ function PersonalInfo() {
);
}
export default PersonalInfo;
export default PersonalInfo;

View File

@@ -882,6 +882,11 @@ table a{
border: 4px solid #49C4B1;
color: #a3b2c8;
}
.theme-bento{
background-color: #456F85;
border: 4px solid #F97E82;
color: #FDF1EF;
}
/* MEDIA QUERIES */

View File

@@ -22,7 +22,7 @@
"links": [
{
"name": "Nextcloud",
"url": "https://home.halfaperture.com/nextcloud"
"url": "https://sean.bet/nextcloud/apps/files"
},
{
"name": "OneDrive",
@@ -98,15 +98,15 @@
"links": [
{
"name": "Plex",
"url": "http://plex.tv"
"url": "https://app.plex.tv"
},
{
"name": "Twitch",
"url": "http://twitch.tv"
"url": "https://twitch.tv"
},
{
"name": "Netflix",
"url": "http://netflix.com"
"url": "https://netflix.com"
},
{
"name": "YouTube",
@@ -144,7 +144,7 @@
},
{
"name": "Guacamole",
"url": "https://home.halfaperture.com/guacamole"
"url": "https://sean.bet/guacamole"
},
{
"name": "Unifi",

View File

@@ -11,7 +11,8 @@
{"name":"Spotify","url":"https://open.spotify.com/search/results/","prefix":"/s"},
{"name":"TheTVDB","url":"https://www.thetvdb.com/search?query=","prefix":"/tv"},
{"name":"Trakt","url":"https://trakt.tv/search?query=","prefix":"/t"},
{"name":"YouTube","url":"https://www.youtube.com/results?search_query=","prefix":"/y"},
{"name":"YouTube","url":"https://www.youtube.com/results?search_query=","prefix":"/yt"},
{"name":"You","url":"https://www.you.com/search?q=","prefix":"/y"},
{"name":"Wikipedia","url":"https://en.wikipedia.org/w/index.php?search=","prefix":"/w"},
{"name":"Plex","url":"https://app.plex.tv/desktop/#!/search?query=","prefix":"/p"},
{"name":"Rotten Tomatoes","url":"https://www.rottentomatoes.com/search?search=","prefix":"/rt"}

View File

@@ -170,6 +170,15 @@
"colortextpri": "#a3b2c8",
"colortextacc": "#49C4B1",
"colorborder": "#49C4B1"
}
},
{
"name": "bento",
"imagebackground": "none",
"colorbackground": "#456F85",
"colorserachbackground": "#F97E8259",
"colortextpri": "#FDF1EF",
"colortextacc": "#F97E82",
"colorborder": "#F97E82"
}
]
}

3
start-node.sh Executable file
View File

@@ -0,0 +1,3 @@
cd /home/magnum/home-page/api
node server.js