Initial commit
This commit is contained in:
parent
464057700d
commit
d20288cada
0
.dockerignore
Normal file → Executable file
0
.dockerignore
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
Dockerfile
Normal file → Executable file
0
Dockerfile
Normal file → Executable file
|
@ -1,8 +0,0 @@
|
|||
services:
|
||||
pills:
|
||||
image: n0rdye/pills
|
||||
container_name: nodejs_pills
|
||||
ports:
|
||||
- 70:8080
|
||||
volumes:
|
||||
- ./:/usr/src/app
|
23
index.js
Normal file → Executable file
23
index.js
Normal file → Executable file
|
@ -37,10 +37,13 @@ setInterval(function() {
|
|||
let comment = "";
|
||||
fs.readFile('./pills.json', 'utf8', (err, data) => {
|
||||
let jdata = JSON.parse(data);
|
||||
console.log(jdata);
|
||||
let num = j_max(jdata) + 1;
|
||||
let name = `pill_${num}`;
|
||||
let c_date = get_date(last);
|
||||
if(Object.values(jdata).at(-1)["date"] != c_date){
|
||||
jwrite_pill(name, pill, c_date, comment);
|
||||
}
|
||||
})
|
||||
console.log(pill);
|
||||
today = timeu;
|
||||
|
@ -77,6 +80,26 @@ app.get('/', (req, res) => {
|
|||
res.redirect("/user");
|
||||
})
|
||||
|
||||
app.post('/nfc', (req, res) => {
|
||||
console.log("nfc");
|
||||
res.send("good");
|
||||
let inpraw = JSON.stringify(req.body);
|
||||
let inp = JSON.parse(inpraw);
|
||||
let pill = `[${inp["pill"]}]`;
|
||||
let comment = "";
|
||||
fs.readFile('./pills.json', 'utf8', (err, data) => {
|
||||
let jdata = JSON.parse(data);
|
||||
let num = j_max(jdata) + 1;
|
||||
let name = `pill_${num}`;
|
||||
let c_date = get_date(today);
|
||||
console.log("nfc good");
|
||||
console.log(name, pill, c_date, comment);
|
||||
jwrite_pill(name, pill, c_date, comment);
|
||||
})
|
||||
// console.log(js);
|
||||
})
|
||||
|
||||
|
||||
console.log(get_date(today));
|
||||
|
||||
function dict_reverse(obj) {
|
||||
|
|
3
package-lock.json
generated
Normal file → Executable file
3
package-lock.json
generated
Normal file → Executable file
|
@ -13,7 +13,8 @@
|
|||
"ejs": "^3.1.8",
|
||||
"express": "^4.18.2",
|
||||
"express-session": "^1.17.3"
|
||||
}
|
||||
},
|
||||
"devDependencies": {}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
"version": "1.3.8",
|
||||
|
|
5
package.json
Normal file → Executable file
5
package.json
Normal file → Executable file
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"name": "pills",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
|
@ -14,5 +13,7 @@
|
|||
"ejs": "^3.1.8",
|
||||
"express": "^4.18.2",
|
||||
"express-session": "^1.17.3"
|
||||
}
|
||||
},
|
||||
"devDependencies": {},
|
||||
"description": ""
|
||||
}
|
||||
|
|
2
pills.json
Normal file → Executable file
2
pills.json
Normal file → Executable file
File diff suppressed because one or more lines are too long
0
sacrap/fx.js
Normal file → Executable file
0
sacrap/fx.js
Normal file → Executable file
0
sacrap/i2.ejs
Normal file → Executable file
0
sacrap/i2.ejs
Normal file → Executable file
0
sacrap/inde2.js
Normal file → Executable file
0
sacrap/inde2.js
Normal file → Executable file
0
sacrap/index.ejs
Normal file → Executable file
0
sacrap/index.ejs
Normal file → Executable file
0
sacrap/pills copy.json
Normal file → Executable file
0
sacrap/pills copy.json
Normal file → Executable file
0
sacrap/vars.js
Normal file → Executable file
0
sacrap/vars.js
Normal file → Executable file
1
views/edit.ejs
Normal file → Executable file
1
views/edit.ejs
Normal file → Executable file
|
@ -1,6 +1,7 @@
|
|||
<style>
|
||||
* {
|
||||
text-align: center;
|
||||
font-size: 30pt;
|
||||
}
|
||||
</style>
|
||||
<form action="/scripts" method="post">
|
||||
|
|
3
views/inputs.ejs
Normal file → Executable file
3
views/inputs.ejs
Normal file → Executable file
|
@ -29,6 +29,9 @@
|
|||
input {
|
||||
text-align: center;
|
||||
}
|
||||
*{
|
||||
font-size: 30pt;
|
||||
}
|
||||
</style>
|
||||
<form class="f1" action="/scripts" method="post">
|
||||
<input type="submit" value="add">
|
||||
|
|
3
views/user.ejs
Normal file → Executable file
3
views/user.ejs
Normal file → Executable file
|
@ -18,6 +18,9 @@
|
|||
body{
|
||||
margin-inline: 50px;
|
||||
}
|
||||
*{
|
||||
font-size: 30pt;
|
||||
}
|
||||
ul{
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
|
|
Loading…
Reference in New Issue
Block a user