diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md index fccad72a..da329d35 100644 --- a/CONTRIBUTE.md +++ b/CONTRIBUTE.md @@ -20,16 +20,16 @@ This file should introduce you with the concepts and tools used in this project. ## Folder structure -- (abandoned) client-ionic- An old test of -- client-tauri - The frontend -- (abandoned) client-vanilla - The initial test to see if it is possible to run Operators in the browser environment of the user in addition to having a backend. Will be removed once development on the fronend/client-tauri has started. -- server-node - Functions and Classes that are shared between frontend and backend e.g. Operators +- client-tauri - The frontend - Can be built to web and to a desktop app (with extra functions) using tauri. +- server-node - The backend - Provides extra functionality for the web client. +- shared-operatons - Components (e.g. Operators) that are shared between frontend and backend. -## Adding a PDF Operation -StirlingPDF aims to support as many types of operations as possible, including some that cannot be executed in the client. Because of this, we have decided to move some of the shared functionality into it's own node module so that it can be shared by both client and server. +## Adding a PDF Operator + +An Operator is either shared by the server and the client or it might have different implementations based on if its executed by the client, desktop-backend or web-backend. The current structure allows us to define where the Operator can be run. ## PDF Library Docs - [pdf-lib](https://pdf-lib.js.org) - js +- [mozilla's pdfjs-dist/pdf.js](https://www.npmjs.com/package/pdfjs-dist) - js - [pdfcpu](https://pdfcpu.io) - go-wasm -- [opencv-wasm](https://www.npmjs.com/package/opencv-wasm) - ?-wasm -- [mozilla's pdfjs-dist/pdf.js](https://www.npmjs.com/package/pdfjs-dist) - js \ No newline at end of file +- [opencv-wasm](https://www.npmjs.com/package/opencv-wasm) - c++-wasm \ No newline at end of file diff --git a/README.md b/README.md index 887d3914..b127e920 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ This is the development repository for the new StirlingPDF backend. With the power of JS, WASM & GO this will provide almost all functionality SPDF can do currently directly on the client. For automation purposes this will still provide an API to automate your workflows. +![alt text](https://media.discordapp.net/attachments/1174462312904663120/1272615545719619674/image.png?ex=6700d5d6&is=66ff8456&hm=3e36a0c2214f2de07ba4ff4833f86aed5f2f3447f61fe80f5396654b202139b8&=&format=webp&quality=lossless) +This image is here to reflect current progress and will be updated accordingly. + ## Try the new API! [![Run in Postman](https://run.pstmn.io/button.svg)](https://documenter.getpostman.com/view/30633786/2s9YRB1Wto) @@ -77,146 +80,80 @@ If you are interested in learning about this, take a look at the Example workflo ### Rewrite Roadmap -* [x] Client side PDF-Manipulation -* [x] Workflows +* [X] Client side PDF-Manipulation +* [X] Workflows +* [X] passportjs backend (auth) +* [ ] Auth in frontend * [ ] Feature equivalent with S-PDF v1 * [ ] Stateful UI * [ ] Node based editing of Workflows -* [ ] Propper auth using passportjs ### Functions Current functions of spdf and their progress in this repo. -#### Page Operations -| Status | Feature | Description | -| ------ | ------------------------ | ----------- | -| 🚧A | Merge | | -| 🚧A | Split | | -| 🚧A | Organize | | -| 🚧S | Rotate | | -| 🚧A | Remove Pages | | -| 🚧A | Multi-Page Layout | | -| ❌ | Adjust page size/scale | | -| 🚧A | Auto Split Pages | | -| ❌ | Adjust Colours/Contrast | | -| ❌ | Crop | | -| 🚧A | Extract Pages | | -| ❌ | PDF to Single large Page | | +#### PDF Functions +| Status | Feature | Description | +| ------ | -------------------------------------------------- | ----------- | +| βœ”οΈ | arrange | | +| βœ”οΈ | extract | | +| βœ”οΈ | impose | | +| βœ”οΈ | merge | | +| βœ”οΈ | remove blank | | +| βœ”οΈ | remove | | +| βœ”οΈ | rotate pages | | +| βœ”οΈ | scale content | | +| βœ”οΈ | scale pages | | +| βœ”οΈ | split by preset | | +| βœ”οΈ | split by index | | +| βœ”οΈ | update metadata | | +| βœ”οΈ | pdf to single large page | | +| 🚧 | remove annotations | | +| 🚧 | flatten | | +| 🚧 | overlay pdfs | | +| 🚧 | compress | | +| 🚧 | change permissions | | +| 🚧 | pdf to pdf/a | | +| 🚧 | add page numbers | | +| 🚧 | add image | | +| 🚧 | add watermark | | +| 🚧 | auto rename | | +| 🚧 | add stamp | | +| ❌ | repair | | +| ❌ | sign with cert | | +| ❌ | ocr | | +| ❌ | auto split by size/count (+split by preset) | | +| ❌ | split pdfs by sections/chapters (+split by preset) | | +| ❌ | adjust colors/contrast | | +| ❌ | adjust colors/contrast | | +| ❌ | sanitize | | +| ❌ | sign | | +| ❌ | basic text editing | | +| ❌ | auto redact | | + +#### Generic Filetype (Filetypes are not supported by workflows yet. Coming Soonβ„’) -#### Convert | Status | Feature | Description | | ------ | ------------------- | ----------- | -| ❌ | Image to PDF | | -| 🚧S | Convert file to PDF | | -| ❌ | URL to PDF | | -| ❌ | HTML to PDF | | -| ❌ | Markdown to PDF | | -| ❌ | PDF to Image | | -| ❌ | PDF to Word | | -| ❌ | PDF to Presentation | | -| ❌ | PDF to Text/RTF | | -| ❌ | PDF to HTML | | -| ❌ | PDF to PDF/A | | +| 🚧 | image to pdf | | +| 🚧 | pdf to image | | +| 🚧 | extract images | | +| 🚧 | show javascript | | +| ❌ | convert file to pdf | | +| ❌ | pdf to word | | +| ❌ | pdf to presentation | | +| ❌ | pdf to rtf | | +| ❌ | pdf to html | | +| ❌ | pdf to xml | | +| ❌ | url/website to pdf | | +| ❌ | markdown to pdf | | +| ❌ | pdf to csv | | +| ❌ | get all info | | +| ❌ | compare | | -#### Security -| Status | Feature | Description | -| ------ | --------------------- | ----------- | -| ❌ | Add Password | | -| ❌ | Remove Password | | -| ❌ | Change Permissions | | -| ❌ | Add Watermark | | -| ❌ | Sign with Certificate | | -| ❌ | Sanitize | | -| ❌ | Auto Redact | | - -#### Miscellaneous -| Status | Feature | Description | -| ------ | --------------------------- | ----------- | -| ❌ | OCR | | -| ❌ | Add image | | -| ❌ | Compress | | -| ❌ | Extract Images | | -| 🚧S | Change Metadata | | -| 🚧A | Detect/Split Scanned photos | | -| ❌ | Sign | | -| ❌ | Flatten | | -| ❌ | Repair | | -| 🚧A | Remove Blank Pages | | -| ❌ | Compare/Diff | | -| ❌ | Add Page Numbers | | -| ❌ | Auto Rename | | -| ❌ | Get info | | -| ❌ | Show JS | | - - - - -βœ”οΈ: Done, 🚧: Started Developement, ❌: Planned Feature -A: Available in the internal API, S: Available on the node server, C: Available in the client +βœ”οΈ: Done, 🚧: Possible with current Libraries, ❌: Planned Feature ## Contribute -For initial instructions look at [CONTRIBUTE.md](./CONTRIBUTE.md) - - \ No newline at end of file +For initial instructions look at [CONTRIBUTE.md](./CONTRIBUTE.md) \ No newline at end of file diff --git a/client-tauri/src/App.tsx b/client-tauri/src/App.tsx index 5dfb30b7..c353078f 100644 --- a/client-tauri/src/App.tsx +++ b/client-tauri/src/App.tsx @@ -13,6 +13,9 @@ import i18next from "i18next"; import resourcesToBackend from "i18next-resources-to-backend"; import { listOperatorNames } from "@stirling-pdf/shared-operations/src/workflow/operatorAccessor"; import AuthenticatedRoute from "./components/AuthenticatedRoute"; +import Login from "./pages/Auth/Login"; +import Logout from "./pages/Auth/Logout"; +import Register from "./pages/Auth/Register"; i18next.use(LanguageDetector).use(initReactI18next).use(resourcesToBackend((language: string, namespace: string) => import(`@stirling-pdf/shared-operations/public/locales/${namespace}/${language}.json`).catch((e) => console.warn("some component tried to render with an unsupported language, falling back to en", e)))) .init({ @@ -35,9 +38,9 @@ export default function App() { }> }/> - - - + }> + }> + }> } /> diff --git a/client-tauri/src/pages/Auth/Auth.module.css b/client-tauri/src/pages/Auth/Auth.module.css new file mode 100644 index 00000000..e69de29b diff --git a/client-tauri/src/pages/Auth/Login.tsx b/client-tauri/src/pages/Auth/Login.tsx index 743fdbf9..74fd3536 100644 --- a/client-tauri/src/pages/Auth/Login.tsx +++ b/client-tauri/src/pages/Auth/Login.tsx @@ -2,3 +2,12 @@ // TODO: Check if user login is enabled on this server +import styles from './Auth.module.css'; + +function Login() { + return ( + "Login Test Page" + ); +} + +export default Login; \ No newline at end of file diff --git a/client-tauri/src/pages/Auth/Logout.tsx b/client-tauri/src/pages/Auth/Logout.tsx index efa831c6..b77a13b7 100644 --- a/client-tauri/src/pages/Auth/Logout.tsx +++ b/client-tauri/src/pages/Auth/Logout.tsx @@ -1,2 +1,13 @@ -// TODO: Delete user info in localstorage. Send request to logout endport session cookie will be removed automatically. -// TODO: Check if user login is enabled on this server \ No newline at end of file +// TODO: Delete user info in localstorage. Send request to logout endpoint -> session cookie will be removed automatically. + +// TODO: Check if user login is enabled on this server + +import styles from './Auth.module.css'; + +function Logout() { + return ( + "Logout Test Page" + ); +} + +export default Logout; \ No newline at end of file diff --git a/client-tauri/src/pages/Auth/Register.tsx b/client-tauri/src/pages/Auth/Register.tsx index b8911ea1..b1614ca7 100644 --- a/client-tauri/src/pages/Auth/Register.tsx +++ b/client-tauri/src/pages/Auth/Register.tsx @@ -1,2 +1,13 @@ -// TODO: Register user and login in the same request. -// TODO: Check if user registration & login is enabled on this server \ No newline at end of file +// TODO: Register user and login in the same request. + +// TODO: Check if user registration & login is enabled on this server + +import styles from './Auth.module.css'; + +function Register() { + return ( + "Register Test Page" + ); +} + +export default Register; \ No newline at end of file diff --git a/shared-operations/src/functions/common/detectEmptyPages.ts b/shared-operations/src/functions/common/detectEmptyPages.ts index 3219d4e6..d5a3e11f 100644 --- a/shared-operations/src/functions/common/detectEmptyPages.ts +++ b/shared-operations/src/functions/common/detectEmptyPages.ts @@ -1,4 +1,3 @@ - import { PdfFile } from "../../wrappers/PdfFile"; import { PDFPageProxy } from "pdfjs-dist/types/src/display/api"; import { Image, ImageKind } from "image-js"; diff --git a/shared-operations/src/functions/common/detectQRCodePages.ts b/shared-operations/src/functions/common/detectQRCodePages.ts index 2011378f..ae68f5c2 100644 --- a/shared-operations/src/functions/common/detectQRCodePages.ts +++ b/shared-operations/src/functions/common/detectQRCodePages.ts @@ -1,4 +1,3 @@ - import jsQR from "jsqr"; import { PdfFile } from "../../wrappers/PdfFile"; diff --git a/shared-operations/src/functions/common/getImagesOnPage.ts b/shared-operations/src/functions/common/getImagesOnPage.ts index 00dc957b..4be8c1c4 100644 --- a/shared-operations/src/functions/common/getImagesOnPage.ts +++ b/shared-operations/src/functions/common/getImagesOnPage.ts @@ -1,4 +1,3 @@ - import { PDFPageProxy } from "pdfjs-dist/types/src/display/api"; import * as PDFJS from "pdfjs-dist"; diff --git a/shared-operations/src/functions/common/getPagesByIndex.ts b/shared-operations/src/functions/common/getPagesByIndex.ts index ab575dbb..063e3628 100644 --- a/shared-operations/src/functions/common/getPagesByIndex.ts +++ b/shared-operations/src/functions/common/getPagesByIndex.ts @@ -1,4 +1,3 @@ - import { PdfFile, RepresentationType } from "../../wrappers/PdfFile"; import { PDFDocument } from "pdf-lib"; diff --git a/shared-operations/src/functions/common/pageIndexesSorting.ts b/shared-operations/src/functions/common/pageIndexesSorting.ts index 22226e12..39beb860 100644 --- a/shared-operations/src/functions/common/pageIndexesSorting.ts +++ b/shared-operations/src/functions/common/pageIndexesSorting.ts @@ -1,4 +1,3 @@ - /** * @param pages A list of page indexes, or the number of total pages in the document (which will be converted into a list of page indexes). * @returns A reversed list of page indexes. diff --git a/shared-operations/src/functions/common/pageIndexesUtils.ts b/shared-operations/src/functions/common/pageIndexesUtils.ts index 7fd568a2..ea797fd2 100644 --- a/shared-operations/src/functions/common/pageIndexesUtils.ts +++ b/shared-operations/src/functions/common/pageIndexesUtils.ts @@ -1,4 +1,3 @@ - /** * @param selection An array of page indexes already selected. * @param pageCount The number of pages of the pdfDocument. diff --git a/shared-operations/src/functions/common/sortPdfArray.ts b/shared-operations/src/functions/common/sortPdfArray.ts index 70e10d16..cb5728ff 100644 --- a/shared-operations/src/functions/common/sortPdfArray.ts +++ b/shared-operations/src/functions/common/sortPdfArray.ts @@ -1,4 +1,3 @@ - import { PdfFile } from "../../wrappers/PdfFile"; export async function sortPdfArray( diff --git a/shared-operations/src/functions/common/splitPagesByIndex.ts b/shared-operations/src/functions/common/splitPagesByIndex.ts index 4d5107e5..acd6ff9e 100644 --- a/shared-operations/src/functions/common/splitPagesByIndex.ts +++ b/shared-operations/src/functions/common/splitPagesByIndex.ts @@ -1,4 +1,3 @@ - import { PdfFile } from "../../wrappers/PdfFile"; import { getPages } from "./getPagesByIndex"; diff --git a/shared-operations/src/functions/index.ts b/shared-operations/src/functions/index.ts index b12778d7..d97c69a5 100644 --- a/shared-operations/src/functions/index.ts +++ b/shared-operations/src/functions/index.ts @@ -3,7 +3,6 @@ import { Action } from "../../declarations/Action"; import Joi from "@stirling-tools/joi"; import { MaterialSymbolProps } from "react-material-symbols"; - export interface ValidationResult { valid: boolean, reason?: string