Commit Graph

40 Commits

Author SHA1 Message Date
lovasoa 1af44a79d0 fmt 2026-04-13 02:44:47 +02:00
lovasoa c4b398b21c simplify icon _img helper 2025-11-04 16:51:16 +01:00
lovasoa 5c41f16481 Simlplify icon generation in build.rs 2025-11-04 16:46:42 +01:00
lovasoa df1e6c2184 IconImgHelper: use raw string literals for SVG output 2025-11-04 14:00:02 +01:00
lovasoa 923cb6262f icon image helper: logging and error handling
- Changed debug logs to warning logs for invalid icon names and missing icons in the IconImgHelper.
- Updated the way icons are retrieved from the ICON_MAP for better clarity and performance.
2025-11-04 13:57:36 +01:00
lovasoa 52e11df5b6 Implement faster icon loading by inlining icons from the Tabler sprite. The previous method required downloading and parsing a large file, causing delays in icon rendering. Now, icons are generated and cached, improving page load times. Update the icon helper to utilize the new inline method. 2025-11-04 13:38:05 +01:00
lovasoa c5fbb4be54 form select: loose equality testing for option values
the form component now considers numbers and their string representation as equal when comparing the `value` parameter and the values from the `options` parameter in dropdowns

see https://github.com/sqlpage/SQLPage/discussions/1002
2025-08-30 18:16:53 +02:00
lovasoa 4eb8008a7d clippy 2025-08-18 14:57:24 +02:00
Ophir LOJKINE adcbaa680b Single Sign-On via OpenID Connect (#888)
* add oidc config variables

* setup a basic middleware

* implement an async http client that uses oidc

* initialize provider_metadata in OidcService

* better error handling in oidc config

* HTTP client initialization in oidc now follows global config

* oidc: implement redirects

- Add `host` configuration option for specifying the application's web address in configuration.md and app_config.rs.
- Update docker-compose.yaml to include SQLPAGE_HOST and SQLPAGE_OIDC_ISSUER_URL environment variables.
- Enhance OIDC middleware to utilize the new `host` setting for redirect URLs and improve cookie handling in oidc.rs.

* improve local oidc configurability

* log

* Update warning message in OIDC configuration to clarify how to disable it by providing a host setting

* Update OIDC redirect logging to use info level with client ID

* Refactor unauthenticated request handling in OIDC service

- Extracted logic for handling unauthenticated requests into a separate method `handle_unauthenticated_request`.
- Updated the main request handling flow to utilize the new method for improved readability and maintainability.

* Enhance OIDC service with callback handling and token processing

- Introduced `handle_oidc_callback` method to manage OIDC callback requests.
- Added `process_oidc_callback` and `exchange_code_for_token` methods for token exchange logic.
- Updated `handle_unauthenticated_request` to check for callback URL and redirect accordingly.
- Refactored `build_redirect_response` to improve clarity in response handling.

* in handle_oidc_callback use service_request.into_response

* fmt

* Implement oidc code exchange and token storage

* validate oidc cookies

- Updated `get_sqlpage_auth_cookie` to return a result for better error handling and validation of the SQLPage auth cookie.
- Improved logging throughout the OIDC service for better traceability of requests and responses.
- Adjusted the handling of OIDC callback parameters to include context in error messages.

* OIDC callback: redirect to the auth URL on failure.

* oidc use localhost for redirect config instead of 0.0.0.0 by default

* Enhance OIDC provider metadata discovery with improved logging and error context

* maintain the initial URL during OIDC authentication

- Added state cookie handling to maintain the initial URL during OIDC authentication.
- Refactored `build_auth_url` to accept the initial URL as a parameter.
- Enhanced `process_oidc_callback` to retrieve the state from the cookie and redirect accordingly.

* implement csrf token

* update deps

* update sso examples

* nonce verification

- Improved error logging for invalid auth cookies and ID token verification.
- Introduced nonce verification logic to ensure security during OIDC authentication.
- Adjusted parameters for nonce hashing to optimize for short-lived tokens.

* Refactor OIDC logging and improve documentation

- Updated logging statements for better clarity and context.
- Refactored code for nonce verification and error handling.
- Enhanced documentation in `app_config.rs` for clarity on `https_domain` usage.

* Remove unused app_state field from OidcService struct

* Enhance OIDC client error handling and refactor HTTP request types

- Added context to OIDC client creation error handling.
- Updated HTTP request and response types for better integration with the openidconnect library.
- Introduced AwcWrapperError for improved error management in HTTP calls.

* clippy fixes

- Changed http_client from Arc to Rc in OidcService for improved memory efficiency.
- Updated related code to reflect the new ownership model for the HTTP client.

* initialize the oidc and http clients only once

- Added OidcState struct to encapsulate OIDC configuration and client.
- Refactored OidcMiddleware to utilize OidcState for improved state management.
- Updated HTTP client handling in OIDC service methods for better integration with app data.
- Enhanced logging for OIDC middleware initialization and request processing.

* functions for accessing user claims from OIDC tokens + documentation

- Updated SQLPage authentication component documentation for clarity on usage and options.
- Removed deprecated login and redirect handler scripts to streamline the SSO implementation.
- Enhanced logout functionality to properly clear session cookies and redirect users.
- Improved request handling to include OIDC claims in the request context for better user information retrieval.

* better sso troubleshooting info

* fmt

* add sso to the changelog
2025-05-05 17:59:07 +02:00
lovasoa c31f960c4b clippy 2025-04-20 05:42:49 +02:00
lovasoa 757389c16b tests 2025-03-17 16:38:16 +01:00
lovasoa 2bf0a2fc9f get_preset_options 2025-03-17 15:48:30 +01:00
lovasoa 3957c59557 update markdown preset logic 2025-03-17 15:28:42 +01:00
Gus Power 2cfbe4bda6 clippy fix 2025-03-17 10:27:54 +00:00
Gus Power 1fe7687917 format and switch to use arg.value() and args.get(1) 2025-03-17 10:22:04 +00:00
Gus Power 8c7d6c7582 inline markdown::Option import 2025-03-17 10:07:05 +00:00
Gus Power 2702cbcc36 introduce MarkdownConfig trait to simplify testing; introduce allow_unsafe optional parameter to MarkdownHelper, add tests for various permutations, extend text.handlebars to pass through parameter 2025-03-13 11:15:20 +00:00
lovasoa 8b6f9eab69 add support for data url images in markdown
fixes https://github.com/sqlpage/SQLPage/discussions/803
2025-03-01 22:33:38 +01:00
lovasoa 2fce6becd3 #[allow(clippy::upper_case_acronyms)] 2025-02-27 14:03:30 +01:00
lovasoa ddf4259041 fmt 2025-02-27 14:02:59 +01:00
lovasoa befef0d7b8 Merge remote-tracking branch 'refs/remotes/origin/main' 2025-02-27 13:44:13 +01:00
lovasoa 8284501d8c escape css class names 2025-02-27 13:43:16 +01:00
Ophir LOJKINE b7b1b2123c Add markdown rendering options to the sqlpage configuration (#823)
* Add markdown rendering options to the sqlpage configuration

* fmt

* silence clippy

* revert changes to conf

* docs

* fmt
2025-02-25 19:05:39 +01:00
Floflobel fbc4f29d7e fix cards that have embedded contents (#744)
* fix https://github.com/sqlpage/SQLPage/issues/743

* fix https://github.com/sqlpage/SQLPage/issues/743

* handle icons separately

* remove description test, since descriptions are overwritten by card embeds anyway

---------

Co-authored-by: Florian Bellencontre <fbellencontre@cosium.com>
Co-authored-by: lovasoa <contact@ophir.dev>
2024-12-22 20:41:36 +01:00
lovasoa e0733522bd fmt 2024-09-24 23:02:47 +02:00
lovasoa 38dbde4ca0 fix https://github.com/lovasoa/SQLpage/discussions/600 2024-09-24 22:39:57 +02:00
lovasoa c5392c7f90 fix csv escapes 2024-08-11 18:37:52 +02:00
lovasoa 1a83eaa669 fix https://github.com/lovasoa/SQLpage/issues/525 2024-08-11 16:19:48 +02:00
lovasoa e99e386a5f include a default favicon in sqlpage
this fixes the Unable to read file "favicon.ico" error that was displayed by default in the console when opening a page in a browser
2024-06-23 18:19:21 +02:00
lovasoa 721ced629f new handlebars helper for custom components: app_config 2024-06-18 00:20:08 +02:00
lovasoa 9e7cb56a64 fix icon display when using site_prefix
fix https://github.com/lovasoa/SQLpage/issues/377
2024-06-09 21:48:01 +02:00
lovasoa d02c7557b2 less verbose handlebars helpers 2024-06-09 21:36:45 +02:00
lovasoa a016cdb815 embed prefix addition in the static_path helper 2024-05-14 00:17:20 +02:00
Daniel Sheffield 831df7945b remove lint 2024-05-13 21:49:42 +12:00
Daniel Sheffield 013eb8f6c4 require trailing slash on site_prefix to avoid multiple strip_prefix calls 2024-05-13 21:28:19 +12:00
Daniel Sheffield f37c0ec683 address lint issues 2024-05-12 19:30:23 +12:00
Daniel Sheffield e09e1dbb5a support site prefix for use with reverse proxy 2024-05-12 18:57:15 +12:00
lovasoa fe268f45ed bundle tomselect with sqlpage 2024-04-14 18:52:59 +02:00
lovasoa 6f7642390f bugfix: fix missing helper 2024-03-08 11:49:47 +01:00
olivierauverlot eaee6987d8 New RSS component (#252)
* Produces a data flow in the RSS format

* add documentation and rss reference

* more complete rss component, with support for podcasts

* podcast changes

* documentation

* format dates as rfc2822

* extract template helpers

* extract more helpers

* remove unnecassary error handling

* fmt

* two-param helpers

* rfc2822_date_helper

* test rfc date formatter

* accept dates with or without time

* remove unneeded line breaks

---------

Co-authored-by: Olivier Auverlot <oauv@duck.com>
Co-authored-by: lovasoa <pere.jobs@gmail.com>
2024-03-05 19:42:44 +01:00