Archived
1
0
This commit is contained in:
2022-11-21 12:02:03 -06:00
4 changed files with 21731 additions and 33 deletions

View File

@@ -3,10 +3,52 @@ const bodyParser = require("body-parser");
const cors = require("cors"); const cors = require("cors");
const fs = require("fs"); const fs = require("fs");
const links = require('../src/links.json');
try {
var links = require('../src/links.json');
} catch(err) {
let body = `{
"bookmarks" : [
{
"category": "Example",
"links": [
{
"name": "Gitea",
"url": "https://home.halfaperture.com/gitea"
}
]
}
]
}`;
fs.writeFileSync('../src/links.json',body);
var links = require('../src/links.json');
}
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');
}
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);
}
const providers = require('../src/providers.json'); const providers = require('../src/providers.json');
const themes = require('../src/themes.json'); const themes = require('../src/themes.json');
const personaldata = require('../src/personaldata.json');
const messages = require('../src/messages.json'); const messages = require('../src/messages.json');
// initializing app // initializing app
@@ -20,8 +62,8 @@ var jsonParser = bodyParser.json();
app.get("/sui/api/apps", (req, res) => { app.get("/sui/api/apps", (req, res) => {
fs.readFile('../src/apps.json', (err, data) => { fs.readFile('../src/apps.json', (err, data) => {
if (err) throw err; if (err) throw err;
let test = JSON.parse(data); let apps = JSON.parse(data);
res.status(200).send(test.apps); res.status(200).send(apps.apps);
}); });
}); });
@@ -58,4 +100,4 @@ app.post("/sui/api/appUpdate", jsonParser, (req, res) => {
// app is listening on port 5000 // app is listening on port 5000
app.listen(5000, () => { app.listen(5000, () => {
console.log("node server is running on port 5000"); console.log("node server is running on port 5000");
}); });

21702
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

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

View File

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