Merge pull request #18 from Frooodle/main

Reverse proxy with location fix
This commit is contained in:
Anthony Stirling 2023-01-31 17:17:17 +00:00 committed by GitHub
commit c5dd94f3e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 169 additions and 31 deletions

13
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1,13 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: ['https://paypal.me/froodleplex?country.x=GB&locale.x=en_GB'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

109
.gitignore vendored Normal file
View file

@ -0,0 +1,109 @@
### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
# Gradle
.gradle
.lock
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
.apt_generated_test/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
# Uncomment this line if you wish to ignore the project description file.
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project
### Eclipse Patch ###
# Spring Boot Tooling
.sts4-cache/
### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

View file

@ -1,7 +1,9 @@
# Stirling-PDF (Made in 1 day with 100% ChatGPT, Even this readme!) # Stirling-PDF
This is a locally hosted web application that allows you to perform various operations on PDF files, such as splitting and adding images. This is a locally hosted web application that allows you to perform various operations on PDF files, such as splitting and adding images.
Started off as a 100% ChatGPT made application, slowly moving away from that as more features are added
I will support and fix/add things to this if there is a demand [Discord](https://discord.gg/Cn8pWhQRxZ) I will support and fix/add things to this if there is a demand [Discord](https://discord.gg/Cn8pWhQRxZ)
@ -15,11 +17,14 @@ I will support and fix/add things to this if there is a demand [Discord](https:/
- Convert PDFs to and from images - Convert PDFs to and from images
- Reorganize PDF pages into different orders. - Reorganize PDF pages into different orders.
- Add images to PDFs at specified locations. - Add images to PDFs at specified locations.
- Rotating PDFs in 90 degree increments.
- Compressing PDFs to decrease their filesize.
- Dark mode support. - Dark mode support.
## Technologies used ## Technologies used
- Spring Boot + Thymeleaf - Spring Boot + Thymeleaf
- PDFBox - PDFBox
- e-iceblue spire.pdf.free (for PDF compression untill i find a nicer way)
- HTML, CSS, JavaScript - HTML, CSS, JavaScript
- Docker - Docker
@ -29,20 +34,29 @@ I will support and fix/add things to this if there is a demand [Discord](https:/
Prerequisites Prerequisites
- Java 17 or later - Java 17 or later
- Gradle 6.0 or later - Gradle 7.0 or later
1. Clone or download the repository. 1. Clone or download the repository.
2. Build the project using Gradle by running `./gradlew build` 2. Build the project using Gradle by running `./gradlew build`
3. Start the application by running `./gradlew bootRun` 3. Start the application by running `./gradlew bootRun` or by calling the build jar in build/libs with java -jar jarName.jar
### Docker ### Docker
https://hub.docker.com/r/frooodle/s-pdf https://hub.docker.com/r/frooodle/s-pdf
docker pull frooodle/s-pdf Docker Run
```
docker run -p 8080:8080 frooodle/s-pdf docker run -p 8080:8080 frooodle/s-pdf
```
Docker Compose
```
version: '3.3'
services:
s-pdf:
ports:
- '8080:8080'
image: frooodle/s-pdf
```
## How to View ## How to View
1. Open a web browser and navigate to `http://localhost:8080/` 1. Open a web browser and navigate to `http://localhost:8080/`

View file

@ -5,7 +5,7 @@ plugins {
} }
group = 'stirling.software' group = 'stirling.software'
version = '0.2.1' version = '0.2.2'
sourceCompatibility = '17' sourceCompatibility = '17'
repositories { repositories {

View file

@ -7,3 +7,5 @@ multipart.max-request-size=1000MB
spring.servlet.multipart.max-file-size=1000MB spring.servlet.multipart.max-file-size=1000MB
spring.servlet.multipart.max-request-size=1000MB spring.servlet.multipart.max-request-size=1000MB
server.forward-headers-strategy=NATIVE

View file

@ -17,7 +17,7 @@
<form method="post" th:action="@{/add-image}" <form method="post" th:action="@{add-image}"
enctype="multipart/form-data"> enctype="multipart/form-data">
<div class="custom-file"> <div class="custom-file">

View file

@ -17,7 +17,7 @@
<form action="#" th:action="@{/compress-pdf}" th:object="${rotateForm}" <form action="#" th:action="@{compress-pdf}" th:object="${rotateForm}"
method="post" enctype="multipart/form-data"> method="post" enctype="multipart/form-data">
<p>Warning: This process can take up to a minute depending on file-size</p> <p>Warning: This process can take up to a minute depending on file-size</p>
<div class="custom-file"> <div class="custom-file">

View file

@ -15,7 +15,7 @@
<h2>Image to PDF</h2> <h2>Image to PDF</h2>
<form method="post" enctype="multipart/form-data" <form method="post" enctype="multipart/form-data"
th:action="@{/convert-to-pdf}"> th:action="@{convert-to-pdf}">
<div class="custom-file"> <div class="custom-file">
<input type="file" class="custom-file-input" id="fileInput" <input type="file" class="custom-file-input" id="fileInput"
name="fileInput" required> <label name="fileInput" required> <label
@ -35,7 +35,7 @@
<div class="col-md-6"> <div class="col-md-6">
<h2>PDF to img</h2> <h2>PDF to img</h2>
<form method="post" enctype="multipart/form-data" <form method="post" enctype="multipart/form-data"
th:action="@{/convert-from-pdf}"> th:action="@{convert-from-pdf}">
<div class="custom-file"> <div class="custom-file">
<input type="file" class="custom-file-input" id="fileInput" <input type="file" class="custom-file-input" id="fileInput"
name="fileInput" required> <label name="fileInput" required> <label

View file

@ -27,7 +27,7 @@
<div class="card-body"> <div class="card-body">
<h5 class="card-title">Merge PDFs</h5> <h5 class="card-title">Merge PDFs</h5>
<p class="card-text">Easily merge multiple PDFs into one.</p> <p class="card-text">Easily merge multiple PDFs into one.</p>
<a href="#" class="btn btn-primary" th:href="@{/merge-pdfs}">Go</a> <a href="#" class="btn btn-primary" th:href="@{merge-pdfs}">Go</a>
</div> </div>
</div> </div>
</div> </div>
@ -36,7 +36,7 @@
<div class="card-body"> <div class="card-body">
<h5 class="card-title">Split PDFs</h5> <h5 class="card-title">Split PDFs</h5>
<p class="card-text">Split PDFs into multiple documents</p> <p class="card-text">Split PDFs into multiple documents</p>
<a href="#" class="btn btn-primary" th:href="@{/split-pdfs}">Go</a> <a href="#" class="btn btn-primary" th:href="@{split-pdfs}">Go</a>
</div> </div>
</div> </div>
</div> </div>
@ -45,7 +45,7 @@
<div class="card-body"> <div class="card-body">
<h5 class="card-title">Add image to PDF</h5> <h5 class="card-title">Add image to PDF</h5>
<p class="card-text">Adds image/watermark to a PDF</p> <p class="card-text">Adds image/watermark to a PDF</p>
<a href="#" class="btn btn-primary" th:href="@{/add-image}">Go</a> <a href="#" class="btn btn-primary" th:href="@{add-image}">Go</a>
</div> </div>
</div> </div>
</div> </div>
@ -57,7 +57,7 @@
<div class="card-body"> <div class="card-body">
<h5 class="card-title">Convert to/from PDF</h5> <h5 class="card-title">Convert to/from PDF</h5>
<p class="card-text">Convert images to/from PDF.</p> <p class="card-text">Convert images to/from PDF.</p>
<a href="#" class="btn btn-primary" th:href="@{/convert-pdf}">Go</a> <a href="#" class="btn btn-primary" th:href="@{convert-pdf}">Go</a>
</div> </div>
</div> </div>
</div> </div>
@ -67,7 +67,7 @@
<div class="card-body"> <div class="card-body">
<h5 class="card-title">PDF Organizer</h5> <h5 class="card-title">PDF Organizer</h5>
<p class="card-text">Remove/Rearrange pages in any order</p> <p class="card-text">Remove/Rearrange pages in any order</p>
<a href="#" class="btn btn-primary" th:href="@{/pdf-organizer}">Go</a> <a href="#" class="btn btn-primary" th:href="@{pdf-organizer}">Go</a>
</div> </div>
</div> </div>
</div> </div>
@ -77,7 +77,7 @@
<div class="card-body"> <div class="card-body">
<h5 class="card-title">Rotate PDFs</h5> <h5 class="card-title">Rotate PDFs</h5>
<p class="card-text">Easily rotate your PDFs.</p> <p class="card-text">Easily rotate your PDFs.</p>
<a href="#" class="btn btn-primary" th:href="@{/rotate-pdf}">Go</a> <a href="#" class="btn btn-primary" th:href="@{rotate-pdf}">Go</a>
</div> </div>
</div> </div>
</div> </div>
@ -95,7 +95,7 @@
<div class="card-body"> <div class="card-body">
<h5 class="card-title">Compress PDFs</h5> <h5 class="card-title">Compress PDFs</h5>
<p class="card-text">Compress PDFs to reduce their file size.</p> <p class="card-text">Compress PDFs to reduce their file size.</p>
<a href="#" class="btn btn-primary" th:href="@{/compress-pdf}">Go</a> <a href="#" class="btn btn-primary" th:href="@{compress-pdf}">Go</a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -15,7 +15,7 @@
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-6" > <div class="col-md-6" >
<h2>Merge multiple PDFs (2+)</h2> <h2>Merge multiple PDFs (2+)</h2>
<form action="/merge-pdfs" method="post" <form action="merge-pdfs" method="post"
enctype="multipart/form-data"> enctype="multipart/form-data">
<div class="form-group"> <div class="form-group">
<label>Select (or drag & drop) all PDFs to merge</label> <label>Select (or drag & drop) all PDFs to merge</label>

View file

@ -1,7 +1,7 @@
<div th:fragment="navbar"> <div th:fragment="navbar">
<nav class="navbar navbar-expand-lg navbar-light bg-light"> <nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container"> <div class="container">
<a class="navbar-brand" href="#" th:href="@{/home}">Stirling PDF</a> <a class="navbar-brand" href="#" th:href="@{home}">Stirling PDF</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" <button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarNav" aria-controls="navbarNav" data-target="#navbarNav" aria-controls="navbarNav"
aria-expanded="false" aria-label="Toggle navigation"> aria-expanded="false" aria-label="Toggle navigation">
@ -11,30 +11,30 @@
<ul class="navbar-nav"> <ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" href="#" <li class="nav-item"><a class="nav-link" href="#"
th:href="@{/merge-pdfs}" th:href="@{merge-pdfs}"
th:classappend="${currentPage}=='merge-pdfs' ? 'active' : ''">Merge th:classappend="${currentPage}=='merge-pdfs' ? 'active' : ''">Merge
PDFs</a></li> PDFs</a></li>
<li class="nav-item"><a class="nav-link" href="#" <li class="nav-item"><a class="nav-link" href="#"
th:href="@{/split-pdfs}" th:href="@{split-pdfs}"
th:classappend="${currentPage}=='split-pdfs' ? 'active' : ''">Split th:classappend="${currentPage}=='split-pdfs' ? 'active' : ''">Split
PDFs</a></li> PDFs</a></li>
<li class="nav-item"><a class="nav-link" href="#" <li class="nav-item"><a class="nav-link" href="#"
th:href="@{/convert-pdf}" th:href="@{convert-pdf}"
th:classappend="${currentPage}=='convert-pdf' ? 'active' : ''">Convert th:classappend="${currentPage}=='convert-pdf' ? 'active' : ''">Convert
to/from PDF</a></li> to/from PDF</a></li>
<li class="nav-item"><a class="nav-link" href="#" <li class="nav-item"><a class="nav-link" href="#"
th:href="@{/add-image}" th:href="@{add-image}"
th:classappend="${currentPage}=='add-image' ? 'active' : ''">Add th:classappend="${currentPage}=='add-image' ? 'active' : ''">Add
image to PDF</a></li> image to PDF</a></li>
<li class="nav-item"><a class="nav-link" href="#" <li class="nav-item"><a class="nav-link" href="#"
th:href="@{/pdf-organizer}" th:href="@{pdf-organizer}"
th:classappend="${currentPage}=='pdf-organizer' ? 'active' : ''">PDF th:classappend="${currentPage}=='pdf-organizer' ? 'active' : ''">PDF
Organizer</a></li> Organizer</a></li>
<li class="nav-item"><a class="nav-link" href="#" <li class="nav-item"><a class="nav-link" href="#"
th:href="@{/rotate-pdf}" th:href="@{rotate-pdf}"
th:classappend="${currentPage}=='rotate-pdf' ? 'active' : ''">Rotate PDF</a></li> th:classappend="${currentPage}=='rotate-pdf' ? 'active' : ''">Rotate PDF</a></li>
<li class="nav-item"><a class="nav-link" href="#" <li class="nav-item"><a class="nav-link" href="#"
th:href="@{/compress-pdf}" th:href="@{compress-pdf}"
th:classappend="${currentPage}=='compress-pdf' ? 'active' : ''">Compress PDF</a></li> th:classappend="${currentPage}=='compress-pdf' ? 'active' : ''">Compress PDF</a></li>
<input type="checkbox" id="toggle-dark-mode" <input type="checkbox" id="toggle-dark-mode"

View file

@ -16,7 +16,7 @@
<form th:action="@{/rearrange-pages}" method="post" <form th:action="@{rearrange-pages}" method="post"
enctype="multipart/form-data"> enctype="multipart/form-data">
<div class="custom-file"> <div class="custom-file">
<input type="file" class="custom-file-input" id="fileInput" <input type="file" class="custom-file-input" id="fileInput"

View file

@ -17,7 +17,7 @@
<form action="#" th:action="@{/rotate-pdf}" th:object="${rotateForm}" <form action="#" th:action="@{rotate-pdf}" th:object="${rotateForm}"
method="post" enctype="multipart/form-data"> method="post" enctype="multipart/form-data">
<div class="custom-file"> <div class="custom-file">
<input type="file" class="custom-file-input" id="fileInput" <input type="file" class="custom-file-input" id="fileInput"

View file

@ -24,7 +24,7 @@
<p>Document #5: Page 8</p> <p>Document #5: Page 8</p>
<p>Document #6: Page 9 and 10</p> <p>Document #6: Page 9 and 10</p>
<form th:action="@{/split-pages}" method="post" <form th:action="@{split-pages}" method="post"
enctype="multipart/form-data"> enctype="multipart/form-data">
<div class="custom-file"> <div class="custom-file">
<input type="file" class="custom-file-input" id="fileInput" <input type="file" class="custom-file-input" id="fileInput"