making changes towards login. gitignore the db finally

main
Shoofle 3 weeks ago
parent 7fa3b42a77
commit b2bc4dfa79
  1. 2
      .gitignore
  2. 21
      client/src/landing/GraphRender.jsx
  3. 1
      client/src/login/LogIn.jsx
  4. 1
      db/initialize_db.js
  5. 19
      db/populate_db.js
  6. 0
      db/the_big_db.db/dbs/default/.sentinel
  7. 2
      db/the_big_db.db/dbs/default/stats.json
  8. 16
      server/api.js
  9. 6
      server/server.js

2
.gitignore vendored

@ -1,5 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
the_big_db.db
# dependencies
node_modules
/.pnp

@ -1,3 +1,4 @@
import { useEffect } from 'react';
import { SigmaContainer } from "@react-sigma/core";
import "@react-sigma/core/lib/react-sigma.min.css";
@ -13,17 +14,23 @@ export default function GraphRender() {
queryFn: fetchGraph
});
let outputStuff;
if (isPending) outputStuff = "Loading...";
else if (error) outputStuff = `Error encountered: ${error}`;
else outputStuff = (
useEffect(() => {
if (data) {
const supervisor = new ForceSupervisor(data, {allowInvalidContainer: true});
supervisor.start();
return () => supervisor.stop();
}
});
if (isPending) return "Loading...";
else if (error) return `Error encountered: ${error}`;
else return (
<SigmaContainer
allowInvalidContainer
graph={data}
style={{height: "400px", width: "100%", background: 'rgba(0,0,0,0)'}}
/>
);
if (data) (new ForceSupervisor(data, {allowInvalidContainer: true})).start();
return outputStuff;
}

@ -1,7 +1,6 @@
const libsql = require("@libsql/client");
const showdown = require("showdown");
const createPages = `
create table if not exists pages (
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}));
});
// 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;

@ -5,12 +5,6 @@ const port = process.env.PORT || 3001; // Use the port provided by the host or d
const app = express();
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);

Loading…
Cancel
Save