From 95466ae31ecf365d2fb868c6c6912291fe6ba15e Mon Sep 17 00:00:00 2001
From: Maurice <maurice.golverdingen@infosupport.com>
Date: Thu, 1 Feb 2024 16:11:09 +0100
Subject: [PATCH] Other useful pages

---
 about.html                                    |  8 ++++-
 pastabble-frontend/src/App.svelte             |  9 +++++-
 .../src/lib/components/CodeBlock.svelte       |  6 ++++
 pastabble-frontend/src/lib/pages/About.svelte | 32 +++++++++++++++++++
 pastabble-frontend/src/lib/pages/Home.svelte  |  1 +
 src/main.rs                                   |  3 ++
 6 files changed, 57 insertions(+), 2 deletions(-)
 create mode 100644 pastabble-frontend/src/lib/pages/About.svelte

diff --git a/about.html b/about.html
index 1929a39..19c0f5c 100644
--- a/about.html
+++ b/about.html
@@ -14,7 +14,7 @@
         Pastable is a lightweight and fast pastebin alternative, and URL-shortener made by Plabble and written in Rust.
       
       USAGE
-        Get /: Show this page
+        Get /about: Show this page
         Get /{id}: Get paste by ID and return in plain text
         Post /: Create new paste (plain text raw body or form parameter 'content') and return random generated key 
         Post /{id}: Create new paste (plain text raw body) and return requested key if available, else random generated key
@@ -30,6 +30,12 @@
 
         For links:
         Pipe your input into: curl -F 'link=&lt;-' https://paste.plabble.org/to -w '\n'
+      
+      USING GUI
+          If you want to view a note using the GUI, add /#/ in the URL
+
+          For example:
+            https://paste.plabble.org/YOURID becomes https://paste.plabble.org/#/YOURID
     </pre>
   </body>
 </html>
diff --git a/pastabble-frontend/src/App.svelte b/pastabble-frontend/src/App.svelte
index 4dc6ae6..617a3cf 100644
--- a/pastabble-frontend/src/App.svelte
+++ b/pastabble-frontend/src/App.svelte
@@ -3,8 +3,10 @@
   import Router from 'svelte-spa-router'
   import Home from './lib/pages/Home.svelte';
   import Viewer from "./lib/pages/Viewer.svelte";
+  import About from "./lib/pages/About.svelte";
 
   const routes = {
+    '/about': About,
     '/:id': Viewer,
     '*': Home
   };
@@ -16,7 +18,12 @@
 
 <main class="p-10">
   <a href="/#/" class="text-3xl font-bold">Pastabble</a><br/>
-  <i>Fast and free pastebin alternative brought to you by the Plabble team</i>
+  <i>Fast and free pastebin alternative brought to you by the Plabble team</i><br/>
+  <div>
+    <a class="font-medium text-blue-600 dark:text-blue-500 hover:underline" href="/#/">Home</a>
+    -
+    <a class="font-medium text-blue-600 dark:text-blue-500 hover:underline" href="/#/about">About / using from terminal</a>
+  </div>
   
   <Router {routes} />
 </main>
diff --git a/pastabble-frontend/src/lib/components/CodeBlock.svelte b/pastabble-frontend/src/lib/components/CodeBlock.svelte
index a8793fb..d17d5dc 100644
--- a/pastabble-frontend/src/lib/components/CodeBlock.svelte
+++ b/pastabble-frontend/src/lib/components/CodeBlock.svelte
@@ -65,3 +65,9 @@
         </div>
     </div>
 </div>
+
+<style>
+    :global(.mockup-code pre::before) {
+        margin-right: 0 !important;
+    }
+</style>
\ No newline at end of file
diff --git a/pastabble-frontend/src/lib/pages/About.svelte b/pastabble-frontend/src/lib/pages/About.svelte
new file mode 100644
index 0000000..1e8c372
--- /dev/null
+++ b/pastabble-frontend/src/lib/pages/About.svelte
@@ -0,0 +1,32 @@
+<main>
+    <pre class="mt-10">
+        Welcome at PASTABBLE!
+        
+        ABOUT
+          Pastable is a lightweight and fast pastebin alternative, and URL-shortener made by Plabble and written in Rust.
+        
+        USAGE
+          Get /about: Show this page
+          Get /&#123;id&#125;: Get paste by ID and return in plain text
+          Post /: Create new paste (plain text raw body or form parameter 'content') and return random generated key 
+          Post /&#123;id&#125;: Create new paste (plain text raw body) and return requested key if available, else random generated key
+          
+          Get /to/&#123;id&#125;: Navigate to shortcut link (browser redirect)
+          Post /to: Create new link (plain text raw body or form parameter 'link') and return random generated key
+          Post /to/&#123;id&#125;: Create new link (plain text raw body) and return requested key if available, else random generated key
+        
+        FROM TERMINAL
+          Pipe your input into: curl -F 'content=&lt;-' https://paste.plabble.org -w '\n'
+          Or post it as raw data like: curl https://paste.plabble.org -H 'Content-Type: text/plain' -d @- -w '\n'
+          You can create an alias for this! To get the result: curl https://paste.plabble.org/YOURID
+  
+          For links:
+          Pipe your input into: curl -F 'link=&lt;-' https://paste.plabble.org/to -w '\n'
+
+        USING GUI
+          If you want to view a note using the GUI, add /#/ in the URL
+
+          For example:
+            https://paste.plabble.org/YOURID becomes https://paste.plabble.org/#/YOURID
+      </pre>
+</main>
\ No newline at end of file
diff --git a/pastabble-frontend/src/lib/pages/Home.svelte b/pastabble-frontend/src/lib/pages/Home.svelte
index ab4cea6..67284c8 100644
--- a/pastabble-frontend/src/lib/pages/Home.svelte
+++ b/pastabble-frontend/src/lib/pages/Home.svelte
@@ -107,6 +107,7 @@
 
 <div class="flex flex-col md:flex-row gap-5 justify-around">
     <div class="mt-10">
+        <p>Hint: you can also hit <kbd class="kbd kbd-sm my-3">Enter</kbd> to search/shorten</p>
         <div>
             <h2 class="text-2xl font-bold mb-3">Lookup existing note</h2>
 
diff --git a/src/main.rs b/src/main.rs
index c1d5cb5..9bd7b68 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -79,6 +79,9 @@ fn main() {
                     }
                 }
             },
+            (GET) (/about) => {
+                Response::html(&about)
+            },
             (GET) (/to/{id: String}) => {
                 match links.get(&id).expect("Failed to access links DB") {
                     Some(lnk) => {