⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
Added 404 page + Improvements.
Danielac73f4fe09ed
diff --git a/api/pages/404.html b/api/pages/404.htmlnew file mode 100644index 00000000..7cd5206a--- /dev/null+++ b/api/pages/404.html@@ -0,0 +1,15 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta http-equiv="X-UA-Compatible" content="IE=edge">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Document</title>+</head>+<body style="text-align: center; background-color: rgb(0, 51, 78); color:white;">+ <h1>404: NOT FOUND</h1>+ <h3>If you are trying to access a recently added Screenshot/PDF, just wait a bit more for it to be uploaded.</h3>+ <h3>If the problem persists, looks like the file wasn't created...</h3>+ <h1>¯\_(ツ)_/¯</h1>+</body>+</html>\ No newline at end of filediff --git a/api/server.js b/api/server.jsindex 553025dd..0de71710 100644--- a/api/server.js+++ b/api/server.js@@ -6,6 +6,7 @@ const config = require('../src/config.js');const getData = require('./modules/getData.js');const fs = require('fs');const fetch = require('cross-fetch');+const { dirname } = require('path');const port = config.API.PORT;@@ -27,11 +28,19 @@ app.get('/api', async (req, res) => {});app.get('/screenshots/:id', async (req, res) => {- res.sendFile(config.API.STORAGE_LOCATION + '/LinkWarden/screenshot\'s/' + req.params.id);+ res.sendFile(config.API.STORAGE_LOCATION + '/LinkWarden/screenshot\'s/' + req.params.id, (err) => {+ if (err) {+ res.sendFile(__dirname +'/pages/404.html');+ }+ });});app.get('/pdfs/:id', async (req, res) => {- res.sendFile(config.API.STORAGE_LOCATION + '/LinkWarden/pdf\'s/' + req.params.id);+ res.sendFile(config.API.STORAGE_LOCATION + '/LinkWarden/pdf\'s/' + req.params.id, (err) => {+ if (err) {+ res.sendFile(__dirname +'/pages/404.html');+ }+ });});app.post('/api', async (req, res) => {diff --git a/src/componets/AddItem.js b/src/componets/AddItem.jsindex 6f878bee..7e576f75 100644--- a/src/componets/AddItem.js+++ b/src/componets/AddItem.js@@ -1,5 +1,5 @@import { useState } from 'react';-import '../styles/AddItem.css';+import '../styles/SendItem.css';import TagSelection from './TagSelection';import addItem from '../modules/send';@@ -38,13 +38,13 @@ const AddItem = ({onExit, reFetch, tags, SetLoader}) => {<fieldset className='box'><legend >New bookmark</legend><div className='AddItem-content'>+ <h3><span style={{color:"red"}}>* </span>Link:</h3>+ <input onChange={SetLink} className="AddItem-input" type="search" placeholder="e.g. https://example.com/"/><h3>Name:</h3><input onChange={SetName} className="AddItem-input" type="search" placeholder="e.g. Example Tutorial"/>- <h3>Link:</h3>- <input onChange={SetLink} className="AddItem-input" type="search" placeholder="e.g. https://example.com/"/><h3>Tags:</h3><TagSelection setTags={SetTags} tags={tags} />- <button onClick={newItem} className="upload-btn">Upload </button>+ <button onClick={newItem} className="send-btn">Add </button></div></fieldset></>diff --git a/src/componets/EditItem.js b/src/componets/EditItem.jsindex df39c4cc..7a33c822 100644--- a/src/componets/EditItem.js+++ b/src/componets/EditItem.js@@ -1,6 +1,6 @@import { useState } from 'react';import deleteEntity from '../modules/deleteEntity';-import '../styles/AddItem.css';+import '../styles/SendItem.css';import TagSelection from './TagSelection';import editItem from '../modules/send';@@ -49,7 +49,7 @@ const EditItem = ({tags, item, onExit, SetLoader, reFetch}) => {<input onChange={SetName} className="AddItem-input" type="search" value={name} placeholder={"e.g. Example Tutorial"} /><h3>Tags:</h3><TagSelection setTags={SetTags} tags={tags} tag={tag} />- <button onClick={EditItem} className="upload-btn">Update </button>+ <button onClick={EditItem} className="send-btn">Update </button></div></fieldset></>diff --git a/src/modules/send.js b/src/modules/send.jsindex a21ab015..54ec0d73 100644--- a/src/modules/send.js+++ b/src/modules/send.js@@ -34,6 +34,9 @@ const addItem = async (name, link, tag, reFetch, onExit, SetLoader, method, id=n.then(() => {SetLoader(false)});onExit();+ } else if(name === '' && link === '') {+ onExit()+ SetLoader(false)} else {SetLoader(false)alert('Please make sure the link is valid.\n\n(i.e. starts with "http"/"https")');diff --git a/src/styles/AddItem.css b/src/styles/SendItem.csssimilarity index 94%rename from src/styles/AddItem.cssrename to src/styles/SendItem.cssindex 49825857..94aa1906 100644--- a/src/styles/AddItem.css+++ b/src/styles/SendItem.css@@ -51,10 +51,10 @@box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px;}-.upload-btn {+.send-btn {font-family: 'Font Awesome 5 Free';- font-size: 1.1rem;- padding: 5px;+ font-size: 1.2rem;+ padding: 10px;cursor: pointer;box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset;color: #ffffffb6;@@ -67,11 +67,11 @@transition: background-color 0.1s;}-.upload-btn:hover {+.send-btn:hover {background-color: rgb(76, 117, 170);}-.upload-btn:active {+.send-btn:active {box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px;}