making changes towards login. gitignore the db finally
This commit is contained in:
parent
7fa3b42a77
commit
b2bc4dfa79
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,7 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
the_big_db.db
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
node_modules
|
node_modules
|
||||||
/.pnp
|
/.pnp
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { useEffect } from 'react';
|
||||||
import { SigmaContainer } from "@react-sigma/core";
|
import { SigmaContainer } from "@react-sigma/core";
|
||||||
import "@react-sigma/core/lib/react-sigma.min.css";
|
import "@react-sigma/core/lib/react-sigma.min.css";
|
||||||
|
|
||||||
@ -13,17 +14,23 @@ export default function GraphRender() {
|
|||||||
queryFn: fetchGraph
|
queryFn: fetchGraph
|
||||||
});
|
});
|
||||||
|
|
||||||
let outputStuff;
|
useEffect(() => {
|
||||||
if (isPending) outputStuff = "Loading...";
|
if (data) {
|
||||||
else if (error) outputStuff = `Error encountered: ${error}`;
|
const supervisor = new ForceSupervisor(data, {allowInvalidContainer: true});
|
||||||
else outputStuff = (
|
|
||||||
|
supervisor.start();
|
||||||
|
|
||||||
|
return () => supervisor.stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isPending) return "Loading...";
|
||||||
|
else if (error) return `Error encountered: ${error}`;
|
||||||
|
else return (
|
||||||
<SigmaContainer
|
<SigmaContainer
|
||||||
allowInvalidContainer
|
allowInvalidContainer
|
||||||
graph={data}
|
graph={data}
|
||||||
style={{height: "400px", width: "100%", background: 'rgba(0,0,0,0)'}}
|
style={{height: "400px", width: "100%", background: 'rgba(0,0,0,0)'}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
if (data) (new ForceSupervisor(data, {allowInvalidContainer: true})).start();
|
|
||||||
return outputStuff;
|
|
||||||
}
|
}
|
1
client/src/login/LogIn.jsx
Normal file
1
client/src/login/LogIn.jsx
Normal file
@ -0,0 +1 @@
|
|||||||
|
LogIn.jsx
|
@ -1,7 +1,6 @@
|
|||||||
const libsql = require("@libsql/client");
|
const libsql = require("@libsql/client");
|
||||||
const showdown = require("showdown");
|
const showdown = require("showdown");
|
||||||
|
|
||||||
|
|
||||||
const createPages = `
|
const createPages = `
|
||||||
create table if not exists pages (
|
create table if not exists pages (
|
||||||
id integer primary key,
|
id integer primary key,
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
const libsql = require("@libsql/client")
|
|
||||||
|
|
||||||
const insert = `
|
|
||||||
insert into pages (title, description) values (
|
|
||||||
'main',
|
|
||||||
'this is the main page.\n\nit describes a large field in which you stand.'
|
|
||||||
)
|
|
||||||
`
|
|
||||||
|
|
||||||
async function initDb() {
|
|
||||||
const config = {
|
|
||||||
url: "http://127.0.0.1:8000"
|
|
||||||
};
|
|
||||||
const db = libsql.createClient(config);
|
|
||||||
|
|
||||||
const cIns = await db.execute(insert);
|
|
||||||
console.log(cIns);
|
|
||||||
}
|
|
||||||
initDb()
|
|
@ -1 +1 @@
|
|||||||
{"id":"7de13931-444c-4dd2-a19a-5cd1e70b7f36","rows_written":149,"rows_read":14035,"storage_bytes_used":20480,"write_requests_delegated":0,"current_frame_no":151,"top_query_threshold":0,"top_queries":[{"rows_written":0,"rows_read":16,"query":"select id, html from pages"},{"rows_written":0,"rows_read":16,"query":"select id, title from pages"},{"rows_written":0,"rows_read":17,"query":"select id, html from pages"},{"rows_written":0,"rows_read":17,"query":"select id, title from pages"},{"rows_written":0,"rows_read":18,"query":"select id, html from pages"},{"rows_written":0,"rows_read":18,"query":"select id, title from pages"},{"rows_written":0,"rows_read":19,"query":"select id, html from pages"},{"rows_written":0,"rows_read":19,"query":"select id, title from pages"},{"rows_written":0,"rows_read":19,"query":"select id, html from pages"},{"rows_written":0,"rows_read":19,"query":"select id, title from pages"}],"slowest_query_threshold":0,"slowest_queries":[{"elapsed_ms":0,"query":"select title from pages","rows_written":0,"rows_read":1},{"elapsed_ms":0,"query":"select title from pages","rows_written":0,"rows_read":2},{"elapsed_ms":1,"query":"\nalter table pages \nadd column html text\n","rows_written":1,"rows_read":4},{"elapsed_ms":1,"query":"\ncreate table if not exists renders (\n id integer primary key,\n title varchar(255),\n description text\n)\n","rows_written":2,"rows_read":1},{"elapsed_ms":1,"query":"insert into pages (title, description) values (?, ?) returning id","rows_written":1,"rows_read":1},{"elapsed_ms":1,"query":"replace into pages (id, title, description) values (?, ?, ?)","rows_written":1,"rows_read":1},{"elapsed_ms":1,"query":"replace into pages (id, title, description, html) values (?, ?, ?, ?)","rows_written":1,"rows_read":1},{"elapsed_ms":1,"query":"select * from pages where id=@val","rows_written":0,"rows_read":1},{"elapsed_ms":1,"query":"select count(*) as num_pages from pages","rows_written":0,"rows_read":1},{"elapsed_ms":7,"query":"replace into pages (id, title, description) values (?, ?, ?)","rows_written":1,"rows_read":1}],"embedded_replica_frames_replicated":0,"query_count":1996,"query_latency":165200}
|
{"id":"7de13931-444c-4dd2-a19a-5cd1e70b7f36","rows_written":149,"rows_read":15691,"storage_bytes_used":20480,"write_requests_delegated":0,"current_frame_no":151,"top_query_threshold":0,"top_queries":[{"rows_written":0,"rows_read":16,"query":"select id, title from pages"},{"rows_written":0,"rows_read":17,"query":"select id, html from pages"},{"rows_written":0,"rows_read":17,"query":"select id, title from pages"},{"rows_written":0,"rows_read":18,"query":"select id, html from pages"},{"rows_written":0,"rows_read":18,"query":"select id, title from pages"},{"rows_written":0,"rows_read":19,"query":"select id, html from pages"},{"rows_written":0,"rows_read":19,"query":"select id, title from pages"},{"rows_written":0,"rows_read":1,"query":"select * from pages where id=?"},{"rows_written":0,"rows_read":19,"query":"select id, html from pages"},{"rows_written":0,"rows_read":19,"query":"select id, title from pages"}],"slowest_query_threshold":0,"slowest_queries":[{"elapsed_ms":0,"query":"select title from pages","rows_written":0,"rows_read":1},{"elapsed_ms":0,"query":"select title from pages","rows_written":0,"rows_read":2},{"elapsed_ms":1,"query":"\nalter table pages \nadd column html text\n","rows_written":1,"rows_read":4},{"elapsed_ms":1,"query":"\ncreate table if not exists renders (\n id integer primary key,\n title varchar(255),\n description text\n)\n","rows_written":2,"rows_read":1},{"elapsed_ms":1,"query":"insert into pages (title, description) values (?, ?) returning id","rows_written":1,"rows_read":1},{"elapsed_ms":1,"query":"replace into pages (id, title, description) values (?, ?, ?)","rows_written":1,"rows_read":1},{"elapsed_ms":1,"query":"replace into pages (id, title, description, html) values (?, ?, ?, ?)","rows_written":1,"rows_read":1},{"elapsed_ms":1,"query":"select * from pages where id=@val","rows_written":0,"rows_read":1},{"elapsed_ms":1,"query":"select count(*) as num_pages from pages","rows_written":0,"rows_read":1},{"elapsed_ms":7,"query":"replace into pages (id, title, description) values (?, ?, ?)","rows_written":1,"rows_read":1}],"embedded_replica_frames_replicated":0,"query_count":2086,"query_latency":171851}
|
@ -53,4 +53,20 @@ app.get('/graph', (req, res) => {
|
|||||||
.catch((error) => res.status(500).json({"error": error}));
|
.catch((error) => res.status(500).json({"error": error}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// auth stuff
|
||||||
|
app.post('/register', (req, res) => {
|
||||||
|
// parse the body, which miight be url-encoded?
|
||||||
|
// check if the nonce password is correctt
|
||||||
|
// hash the password
|
||||||
|
// add tthe user to the users database
|
||||||
|
});
|
||||||
|
|
||||||
|
app.post('/login', (req, res) => {
|
||||||
|
// hash the password
|
||||||
|
// check if the user/hashed pass matches
|
||||||
|
// if not, throw an error
|
||||||
|
// create a valid ttoken?
|
||||||
|
// return token
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = app;
|
module.exports = app;
|
@ -5,12 +5,6 @@ const port = process.env.PORT || 3001; // Use the port provided by the host or d
|
|||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(function (req, res, next) {
|
|
||||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
||||||
res.setHeader('Access-Control-Allow-Methods', '*');
|
|
||||||
res.setHeader("Access-Control-Allow-Headers", "*");
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
app.use("/api", apiRoutes);
|
app.use("/api", apiRoutes);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user