diff --git a/README.md b/README.md index 7fba0db5..50928630 100644 --- a/README.md +++ b/README.md @@ -222,27 +222,47 @@ The Current list of settings is ```yaml security: enableLogin: false # set to 'true' to enable login - csrfDisabled: true + csrfDisabled: true # Set to 'true' to disable CSRF protection (not recommended for production) + loginAttemptCount: 5 # lock user account after 5 tries + loginResetTimeMinutes : 120 # lock account for 2 hours after x attempts + # initialLogin: + # username: "admin" # Initial username for the first login + # password: "stirling" # Initial password for the first login + # oauth2: + # enabled: false # set to 'true' to enable login (Note: enableLogin must also be 'true' for this to work) + # issuer: "" # set to any provider that supports OpenID Connect Discovery (/.well-known/openid-configuration) end-point + # clientId: "" # Client ID from your provider + # clientSecret: "" # Client Secret from your provider + # autoCreateUser: false # set to 'true' to allow auto-creation of non-existing users + # useAsUsername: "email" # Default is 'email'; custom fields can be used as the username + # scopes: "openid, profile, email" # Specify the scopes for which the application will request permissions + # provider: "google" # Set this to your OAuth provider's name, e.g., 'google' or 'keycloak' system: defaultLocale: 'en-US' # Set the default language (e.g. 'de-DE', 'fr-FR', etc) googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow - customStaticFilePath: '/customFiles/static/' # Directory path for custom static files + rootURIPath: '/pdf-app' # ie set to /pdf-app to Set the application's root URI to localhost:8080/pdf-app + customStaticFilePath: '/customFiles/static/' # Customise static files (e.g., logo, images, CSS) by placing them in this directory. + maxFileSize: 10485760 # Maximum file size for uploads in bytes. + enableAlphaFunctionality: false # Set to enable functionality which might need more testing before it fully goes live (This feature might make no changes) showUpdate: true # see when a new update is available showUpdateOnlyAdmin: false # Only admins can see when a new update is available, depending on showUpdate it must be set to 'true' customHTMLFiles: false # enable to have files placed in /customFiles/templates override the existing template html files -#ui: -# appName: exampleAppName # Application's visible name -# homeDescription: I am a description # Short description or tagline shown on homepage. -# appNameNavbar: navbarName # Name displayed on the navigation bar +ui: + appName: null # Application's visible name + homeDescription: null # Short description or tagline shown on homepage. + appNameNavbar: null # Name displayed on the navigation bar endpoints: toRemove: [] # List endpoints to disable (e.g. ['img-to-pdf', 'remove-pages']) groupsToRemove: [] # List groups to disable (e.g. ['LibreOffice']) metrics: - enabled: true # 'true' to enable Info APIs endpoints (view http://localhost:8080/swagger-ui/index.html#/API to learn more), 'false' to disable + enabled: true # 'true' to enable Info APIs (`/api/*`) endpoints, 'false' to disable + +autoPipeline: + outputFolder: /output # Directory for auto-pipeline outputs. ``` There is an additional config file ``/configs/custom_settings.yml`` were users familiar with java and spring application.properties can input their own settings on-top of Stirling-PDFs existing ones diff --git a/src/main/java/stirling/software/SPDF/config/security/InitialSecuritySetup.java b/src/main/java/stirling/software/SPDF/config/security/InitialSecuritySetup.java index 9ec02e17..452de53e 100644 --- a/src/main/java/stirling/software/SPDF/config/security/InitialSecuritySetup.java +++ b/src/main/java/stirling/software/SPDF/config/security/InitialSecuritySetup.java @@ -54,10 +54,8 @@ public class InitialSecuritySetup { && !initialPassword.isEmpty() && !userService.findByUsernameIgnoreCase(initialUsername).isPresent()) { try { - if (userService.isUsernameValid(initialUsername)) { - userService.saveUser(initialUsername, initialPassword, Role.ADMIN.getRoleId()); - logger.info("Admin user created: " + initialUsername); - } + userService.saveUser(initialUsername, initialPassword, Role.ADMIN.getRoleId()); + logger.info("Admin user created: " + initialUsername); } catch (IllegalArgumentException e) { logger.error("Failed to initialize security setup", e); System.exit(1); diff --git a/src/main/java/stirling/software/SPDF/config/security/UserService.java b/src/main/java/stirling/software/SPDF/config/security/UserService.java index 1fcf63f8..0a6898f8 100644 --- a/src/main/java/stirling/software/SPDF/config/security/UserService.java +++ b/src/main/java/stirling/software/SPDF/config/security/UserService.java @@ -197,7 +197,13 @@ public class UserService implements UserServiceInterface { } public boolean hasUsers() { - return userRepository.count() > 0; + long userCount = userRepository.count(); + if (userRepository + .findByUsernameIgnoreCase(Role.INTERNAL_API_USER.getRoleId()) + .isPresent()) { + userCount -= 1; + } + return userCount > 0; } public void updateUserSettings(String username, Map updates) { diff --git a/src/main/resources/settings.yml.template b/src/main/resources/settings.yml.template index d7d1fcfa..d504e82e 100644 --- a/src/main/resources/settings.yml.template +++ b/src/main/resources/settings.yml.template @@ -4,9 +4,12 @@ security: enableLogin: false # set to 'true' to enable login - csrfDisabled: true + csrfDisabled: true # Set to 'true' to disable CSRF protection (not recommended for production) loginAttemptCount: 5 # lock user account after 5 tries loginResetTimeMinutes : 120 # lock account for 2 hours after x attempts + # initialLogin: + # username: "admin" # Initial username for the first login + # password: "stirling" # Initial password for the first login # oauth2: # enabled: false # set to 'true' to enable login (Note: enableLogin must also be 'true' for this to work) # issuer: "" # set to any provider that supports OpenID Connect Discovery (/.well-known/openid-configuration) end-point @@ -20,9 +23,13 @@ security: system: defaultLocale: 'en-US' # Set the default language (e.g. 'de-DE', 'fr-FR', etc) googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow + rootURIPath: '/pdf-app' # ie set to /pdf-app to Set the application's root URI to localhost:8080/pdf-app + customStaticFilePath: '/customFiles/static/' # Customise static files (e.g., logo, images, CSS) by placing them in this directory. + maxFileSize: 10485760 # Maximum file size for uploads in bytes. enableAlphaFunctionality: false # Set to enable functionality which might need more testing before it fully goes live (This feature might make no changes) showUpdate: true # see when a new update is available showUpdateOnlyAdmin: false # Only admins can see when a new update is available, depending on showUpdate it must be set to 'true' + customHTMLFiles: false # enable to have files placed in /customFiles/templates override the existing template html files ui: appName: null # Application's visible name diff --git a/src/main/resources/static/css/multi-tool.css b/src/main/resources/static/css/multi-tool.css index f9c359dc..0e609652 100644 --- a/src/main/resources/static/css/multi-tool.css +++ b/src/main/resources/static/css/multi-tool.css @@ -65,7 +65,7 @@ label { margin-left: auto; } -#bg-card { +.bg-card { background-color: var(--md-sys-color-surface-5); border-radius: 3rem; padding: 25px 0 0; diff --git a/src/main/resources/static/css/theme/componentes.css b/src/main/resources/static/css/theme/componentes.css index d588d686..d767d59d 100644 --- a/src/main/resources/static/css/theme/componentes.css +++ b/src/main/resources/static/css/theme/componentes.css @@ -58,7 +58,7 @@ td { border-bottom: none; } -#bg-card { +.bg-card { background-color: var(--md-sys-color-surface-5); border-radius: 3rem; padding: 2.5rem; diff --git a/src/main/resources/templates/about.html b/src/main/resources/templates/about.html index c29d2ffa..c315ce74 100644 --- a/src/main/resources/templates/about.html +++ b/src/main/resources/templates/about.html @@ -11,7 +11,7 @@

-
+
diff --git a/src/main/resources/templates/account.html b/src/main/resources/templates/account.html index 727de224..e07050ff 100644 --- a/src/main/resources/templates/account.html +++ b/src/main/resources/templates/account.html @@ -21,6 +21,7 @@ Default message if not found +

User!

@@ -28,13 +29,15 @@ Error Message +

Change Username?

-
+
+
@@ -49,10 +52,10 @@

Change Password?

- +
- +
@@ -95,6 +98,76 @@
+

Sync browser settings with Account

-
+

Settings Comparison:

diff --git a/src/main/resources/templates/addUsers.html b/src/main/resources/templates/addUsers.html index e87726cf..4657ecd9 100644 --- a/src/main/resources/templates/addUsers.html +++ b/src/main/resources/templates/addUsers.html @@ -12,7 +12,7 @@

-
+

Admin User Control Settings

diff --git a/src/main/resources/templates/auto-split-pdf.html b/src/main/resources/templates/auto-split-pdf.html index fa6b1d16..3e93c565 100644 --- a/src/main/resources/templates/auto-split-pdf.html +++ b/src/main/resources/templates/auto-split-pdf.html @@ -15,7 +15,7 @@

-
+
cut diff --git a/src/main/resources/templates/change-creds.html b/src/main/resources/templates/change-creds.html index 30e06688..adef8b55 100644 --- a/src/main/resources/templates/change-creds.html +++ b/src/main/resources/templates/change-creds.html @@ -12,7 +12,7 @@

-
+

User Settings

diff --git a/src/main/resources/templates/convert/file-to-pdf.html b/src/main/resources/templates/convert/file-to-pdf.html index f822a593..1386a441 100644 --- a/src/main/resources/templates/convert/file-to-pdf.html +++ b/src/main/resources/templates/convert/file-to-pdf.html @@ -14,7 +14,7 @@

-
+
draft diff --git a/src/main/resources/templates/convert/html-to-pdf.html b/src/main/resources/templates/convert/html-to-pdf.html index 94b4f842..ff0bf143 100644 --- a/src/main/resources/templates/convert/html-to-pdf.html +++ b/src/main/resources/templates/convert/html-to-pdf.html @@ -12,7 +12,7 @@

-
+
html diff --git a/src/main/resources/templates/convert/img-to-pdf.html b/src/main/resources/templates/convert/img-to-pdf.html index ec49e1c4..09d0461b 100644 --- a/src/main/resources/templates/convert/img-to-pdf.html +++ b/src/main/resources/templates/convert/img-to-pdf.html @@ -12,7 +12,7 @@

-
+
image diff --git a/src/main/resources/templates/convert/markdown-to-pdf.html b/src/main/resources/templates/convert/markdown-to-pdf.html index 748c5c66..af93f23c 100644 --- a/src/main/resources/templates/convert/markdown-to-pdf.html +++ b/src/main/resources/templates/convert/markdown-to-pdf.html @@ -12,7 +12,7 @@

-
+
markdown diff --git a/src/main/resources/templates/convert/pdf-to-csv.html b/src/main/resources/templates/convert/pdf-to-csv.html index be78d1da..23f804b0 100644 --- a/src/main/resources/templates/convert/pdf-to-csv.html +++ b/src/main/resources/templates/convert/pdf-to-csv.html @@ -11,7 +11,7 @@

-
+
csv diff --git a/src/main/resources/templates/convert/pdf-to-html.html b/src/main/resources/templates/convert/pdf-to-html.html index 395f9829..5006ad1b 100644 --- a/src/main/resources/templates/convert/pdf-to-html.html +++ b/src/main/resources/templates/convert/pdf-to-html.html @@ -12,7 +12,7 @@

-
+
html diff --git a/src/main/resources/templates/convert/pdf-to-img.html b/src/main/resources/templates/convert/pdf-to-img.html index d6b5f871..a0402fc1 100644 --- a/src/main/resources/templates/convert/pdf-to-img.html +++ b/src/main/resources/templates/convert/pdf-to-img.html @@ -12,7 +12,7 @@

-
+
image diff --git a/src/main/resources/templates/convert/pdf-to-pdfa.html b/src/main/resources/templates/convert/pdf-to-pdfa.html index 7b51a86c..98f1565c 100644 --- a/src/main/resources/templates/convert/pdf-to-pdfa.html +++ b/src/main/resources/templates/convert/pdf-to-pdfa.html @@ -12,7 +12,7 @@

-
+
picture_as_pdf diff --git a/src/main/resources/templates/convert/pdf-to-presentation.html b/src/main/resources/templates/convert/pdf-to-presentation.html index 8d4a4284..fcef6e65 100644 --- a/src/main/resources/templates/convert/pdf-to-presentation.html +++ b/src/main/resources/templates/convert/pdf-to-presentation.html @@ -12,7 +12,7 @@

-
+
slideshow diff --git a/src/main/resources/templates/convert/pdf-to-text.html b/src/main/resources/templates/convert/pdf-to-text.html index 21bf1fae..e0fc5fbb 100644 --- a/src/main/resources/templates/convert/pdf-to-text.html +++ b/src/main/resources/templates/convert/pdf-to-text.html @@ -12,7 +12,7 @@

-
+
text_fields diff --git a/src/main/resources/templates/convert/pdf-to-word.html b/src/main/resources/templates/convert/pdf-to-word.html index cce75d76..c17c2675 100644 --- a/src/main/resources/templates/convert/pdf-to-word.html +++ b/src/main/resources/templates/convert/pdf-to-word.html @@ -12,7 +12,7 @@

-
+
description diff --git a/src/main/resources/templates/convert/pdf-to-xml.html b/src/main/resources/templates/convert/pdf-to-xml.html index 388ed80b..8ee1237e 100644 --- a/src/main/resources/templates/convert/pdf-to-xml.html +++ b/src/main/resources/templates/convert/pdf-to-xml.html @@ -12,7 +12,7 @@

-
+
code diff --git a/src/main/resources/templates/convert/url-to-pdf.html b/src/main/resources/templates/convert/url-to-pdf.html index 26c13ad1..03f26e9d 100644 --- a/src/main/resources/templates/convert/url-to-pdf.html +++ b/src/main/resources/templates/convert/url-to-pdf.html @@ -12,7 +12,7 @@

-
+
link diff --git a/src/main/resources/templates/crop.html b/src/main/resources/templates/crop.html index 0af2509c..fdb248fd 100644 --- a/src/main/resources/templates/crop.html +++ b/src/main/resources/templates/crop.html @@ -11,7 +11,7 @@

-
+
crop diff --git a/src/main/resources/templates/error.html b/src/main/resources/templates/error.html index 61c69c24..fd357afb 100644 --- a/src/main/resources/templates/error.html +++ b/src/main/resources/templates/error.html @@ -10,7 +10,7 @@
-
+

diff --git a/src/main/resources/templates/extract-page.html b/src/main/resources/templates/extract-page.html index 1f8feec2..05d171ce 100644 --- a/src/main/resources/templates/extract-page.html +++ b/src/main/resources/templates/extract-page.html @@ -11,7 +11,7 @@

-
+
upload diff --git a/src/main/resources/templates/licenses.html b/src/main/resources/templates/licenses.html index c91a4507..a2f81653 100644 --- a/src/main/resources/templates/licenses.html +++ b/src/main/resources/templates/licenses.html @@ -11,7 +11,7 @@

-
+

3rd Party licenses

diff --git a/src/main/resources/templates/merge-pdfs.html b/src/main/resources/templates/merge-pdfs.html index c8579fc0..d810fdc4 100644 --- a/src/main/resources/templates/merge-pdfs.html +++ b/src/main/resources/templates/merge-pdfs.html @@ -12,7 +12,7 @@

-
+
add_to_photos diff --git a/src/main/resources/templates/misc/add-image.html b/src/main/resources/templates/misc/add-image.html index 40146ed2..21ecfdc7 100644 --- a/src/main/resources/templates/misc/add-image.html +++ b/src/main/resources/templates/misc/add-image.html @@ -13,7 +13,7 @@

-
+
add_photo_alternate diff --git a/src/main/resources/templates/misc/add-page-numbers.html b/src/main/resources/templates/misc/add-page-numbers.html index a118a4c2..ea8281c8 100644 --- a/src/main/resources/templates/misc/add-page-numbers.html +++ b/src/main/resources/templates/misc/add-page-numbers.html @@ -55,7 +55,7 @@

-
+
123 diff --git a/src/main/resources/templates/misc/adjust-contrast.html b/src/main/resources/templates/misc/adjust-contrast.html index 1f381e03..b4811495 100644 --- a/src/main/resources/templates/misc/adjust-contrast.html +++ b/src/main/resources/templates/misc/adjust-contrast.html @@ -20,7 +20,7 @@

-
+