766 Commits

Author SHA1 Message Date
lovasoa c788655804 Improve login component documentation and usability
Add complete example with database schema, credential processing, and page protection. Update authentication migration to reference new login component. Enhance login template with default icons and autocomplete attributes. Make validate parameter optional with sensible default.
2025-10-27 18:13:52 +01:00
Olivier Auverlot ce4ffd3394 Documentation improved 2025-10-24 08:45:57 +02:00
Olivier Auverlot 2570bda545 Documentation improved 2025-10-24 08:29:35 +02:00
Olivier Auverlot b356cc8904 username_icon and password_icon attributes 2025-10-24 08:04:39 +02:00
Olivier Auverlot 5d5d1f94d7 The login component is an authentication form for users of an application. 2025-10-18 12:19:15 +02:00
lovasoa b577695eee Enhance llms.txt.sql to include detailed parameter documentation
- Updated the SQL file to improve the output format for components, adding sections for top-level and row-level parameters.
- Each parameter now includes its type, requirement status, and description for better clarity in the generated documentation.
2025-10-17 23:51:28 +02:00
lovasoa c5c4a4fcd5 add llms.txt
closes https://github.com/sqlpage/SQLPage/issues/980
2025-10-17 23:43:20 +02:00
lovasoa cf1e585340 update feature and compatibility sections in homepage template with IDs for improved accessibility 2025-10-05 09:26:05 +02:00
lovasoa 2c7cb90729 add compatibility section to homepage 2025-10-04 22:31:12 +02:00
lovasoa e186f13d0d instructions 2025-10-04 21:22:12 +02:00
Ophir LOJKINE 625deb973b Add and document sqlpage.hmac function (#1033)
* feat: Add sqlpage.hmac function for cryptographic signing

Co-authored-by: contact <contact@ophir.dev>

* feat: Add sqlpage.hmac function for secure data signing

Co-authored-by: contact <contact@ophir.dev>

* Test HMAC function with RFC vectors and update tests

Co-authored-by: contact <contact@ophir.dev>

* feat: Add sqlpage.hmac() function for secure signatures

Co-authored-by: contact <contact@ophir.dev>

* feat: Add base64 output option to hmac function

Co-authored-by: contact <contact@ophir.dev>

* Refactor hmac function for cleaner output formatting

Co-authored-by: contact <contact@ophir.dev>

* Add webhook HMAC signature validation tests

Co-authored-by: contact <contact@ophir.dev>

* Refactor HMAC function and update SQL examples for clarity and consistency

- Changed function parameters to remove Option types for data and key in the HMAC function.
- Improved SQL documentation and examples for HMAC usage, including clearer descriptions and updated error handling.
- Enhanced test cases for webhook HMAC validation to ensure accurate signature checks and responses.
- Removed obsolete test file for HMAC with null values.

* Update HMAC validation logic to handle NULL values in SQL queries

- Modified conditions in SQL queries to check for NULL values alongside signature mismatches.
- Enhanced documentation on NULL handling for HMAC checks to improve clarity and portability.

* remove debug logging from ci

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-10-01 21:07:36 +02:00
lovasoa 07c8a03633 Update log component SQL migration to include introduced_in_version field 2025-09-14 01:06:39 +02:00
lovasoa a9b2b2b471 Enhance log component documentation 2025-09-14 00:49:23 +02:00
Lenardt Gerhardts 68b600595e Feature logger component (#1013)
* implemented logger Component

* changed target for logger to "sqlpage::logger" and made the log::Level case insensitive

* changed error message on missing message key, to be more precise

* changed custom method for String to log::Level conversion to builtin method log::Level::from_str()

* switched to utility method get_object_str and inlined constants

* dynamically target based on file and statement

* disabled ci error (large difference in enum variants) for ResponseWithWriter<S>

* added functionality to work in Header context

* Refactor log component to use compact error handling

* Rename comp_str variable to component_name

* Documented log component

* fixxed missing values statement

* fixxed pipeline errors

* very simple test case for logger

---------

Co-authored-by: Lenardt Gerhardts <lenardt.ger+git@gmail.com>
Co-authored-by: lovasoa <contact@ophir.dev>
2025-09-12 13:38:47 +02:00
lovasoa 1fec20826a Update 47_link.sql 2025-09-10 21:22:41 +02:00
lovasoa 963ec10643 Add missing FROM clause to query example 2025-09-10 21:12:59 +02:00
Ophir LOJKINE 60ab81cb1c blob support: decode binary database values as data URLs (#1005)
* feat: Enhanced BLOB support across all database backends

- Add comprehensive BLOB support for all supported databases:
  * PostgreSQL: BYTEA columns with data URL conversion
  * MySQL/MariaDB: BLOB columns with data URL conversion
  * MSSQL: VARBINARY, BIGVARBINARY, BINARY, IMAGE columns
  * SQLite: BLOB columns with data URL conversion

- Create shared data URL conversion functions to eliminate code duplication
- Add comprehensive tests for all database types
- Update CHANGELOG.md with detailed feature description

- All blob data is now consistently converted to data URLs with base64 encoding
- Cross-database compatibility ensures identical blob behavior across all backends
- Comprehensive testing validates functionality across PostgreSQL, MySQL, MariaDB, MSSQL, and SQLite

* update changelog

* fmt

* fix: Address clippy linter issues

- Change blob function parameters from Vec<u8> to &[u8] to avoid unnecessary copying
- Use inline format args in data URL construction
- Update function calls to borrow parameters correctly
- Maintain backward compatibility and functionality

* feat: Add smart MIME type detection for BLOB data

- Implement automatic MIME type detection based on file signatures (magic bytes)
- Support common file formats: PNG, JPEG, GIF, BMP, WebP, SVG, PDF, DOCX, XLSX, PPTX, JSON, XML, ZIP
- Automatic fallback to 'application/octet-stream' for unknown formats
- Update CHANGELOG.md with comprehensive feature description
- Add comprehensive tests for MIME type detection functionality

- BLOB data now automatically returns appropriate data URLs:
  * PNG files: 'data:image/png;base64,...'
  * PDF files: 'data:application/pdf;base64,...'
  * SVG files: 'data:image/svg+xml;base64,...'
  * Unknown files: 'data:application/octet-stream;base64,...'

- Improves user experience by providing correct MIME types for downloads and displays
- Eliminates need for manual MIME type specification in most cases

* refactor: Make MIME type detection more concise

- Use bytes.starts_with() for cleaner magic byte detection
- Remove verbose comments for each MIME type
- Maintain same functionality with cleaner, more readable code
- Reduce code duplication and improve maintainability

* refactor: Improve MIME type detection with byte strings

- Use byte string literals (b"string") for better readability
- Remove UTF-8 parsing for text-based formats, use direct byte comparisons
- Maintain same functionality with cleaner, more performant code
- PNG: b"\x89PNG\r\n\x1a\n" instead of hex arrays
- JPEG: b"\xFF\xD8" instead of [0xFF, 0xD8]
- Text formats: Direct byte matching without String::from_utf8_lossy
- Update all tests to use new byte string format

* refactor: Extract MIME type detection into separate module

- Create new mime_detection.rs module for better code organization
- Move detect_mime_type() function and tests to dedicated module
- Update sql_to_json.rs to import from mime_detection module
- Remove unused import from functions.rs
- Maintain same functionality with improved code structure

Benefits:
- Better separation of concerns
- Improved code organization and maintainability
- Easier to extend MIME detection in the future
- Cleaner module boundaries

File changes:
- NEW: src/webserver/database/mime_detection.rs (MIME detection + tests)
- MOD: src/webserver/database/mod.rs (add mime_detection module)
- MOD: src/webserver/database/sql_to_json.rs (use mime_detection module)
- MOD: src/webserver/database/sqlpage_functions/functions.rs (remove unused import)

* refactor: Rename mime_detection.rs to blob_to_data_url.rs

- Rename module from mime_detection to blob_to_data_url for better clarity
- Follow project naming conventions (similar to sql_to_json.rs)
- Update all imports and references to use new module name
- Maintain same functionality with improved code organization

File changes:
- RENAMED: src/webserver/database/mime_detection.rs → src/webserver/database/blob_to_data_url.rs
- MOD: src/webserver/database/mod.rs (update module declaration)
- MOD: src/webserver/database/sql_to_json.rs (update import path)
- MOD: src/webserver/database/sqlpage_functions/functions.rs (update import path)

* move

- Add #[must_use] attribute to detect_mime_type for better usage indication
- Replace empty byte check with is_empty() for clarity
- Update tests for improved readability with formatted assertions
- Remove unnecessary blank lines in sql_to_json.rs

Benefits:
- Improved code clarity and maintainability
- Enhanced test readability

* remove old file

* refactor: Update sql_to_json.rs to use new blob_to_data_url module

- Replace direct call to vec_to_data_uri_value with updated import from blob_to_data_url
- Remove deprecated vec_to_data_uri and vec_to_data_uri_value functions for cleaner code
- Maintain existing functionality while improving code organization

* refactor: Simplify MIME type detection logic in blob_to_data_url.rs

- Remove unnecessary empty byte check and streamline conditions for text-based formats
- Enhance readability by consolidating checks for XML and JSON formats
- Maintain existing functionality while improving code clarity

* clippy

* Update documentation for BLOB support and data type handling

- CHANGELOG.md : details on BLOB support and automatic MIME type detection
- Add examples in extensions-to-sql.md illustrating data type conversions and JSON object structure
- Update SQL examples in migrations to reflect new BLOB handling capabilities
2025-08-30 09:02:32 +02:00
lovasoa b0dadea0ae feat: add download component
- Introduce a new download component to facilitate file downloads.
- Implement download handling in the header context, supporting data URLs.
- Add a test for the download functionality to ensure correct behavior.

see https://github.com/sqlpage/SQLPage/discussions/996
2025-08-28 22:43:53 +02:00
lovasoa f3189665af add a title to the security page 2025-08-28 09:49:47 +02:00
lovasoa 653f4ad512 add a title to the performance page 2025-08-28 09:45:57 +02:00
lovasoa 5e723f8e22 fix: missing title in functions documentation 2025-08-28 09:43:57 +02:00
lovasoa a76acd74d0 feat: modals have their own URL
- Allow opening modals with a simple link, enabling triggering from
other components. - Persist modal state across page refreshes using URL
hash.
2025-08-27 17:30:27 +02:00
lovasoa 0ddcc355d9 fix official site carousel captions color 2025-08-26 21:30:26 +02:00
lovasoa c03c3d4cc6 refactor: Clarify SSO documentation and user claims access
- Simplify the explanation of default page protection with SSO enabled.
- Emphasize accessing user claims to tailor user experience based on identity.
2025-08-25 16:19:20 +02:00
lovasoa 282c6fcca3 refactor: Update authentication documentation for clarity and completeness
- Revise the authentication section to enhance readability and structure.
- Introduce Single Sign-On (OIDC) details and emphasize security best practices.
- Consolidate information on built-in username/password and session management.
2025-08-25 16:14:13 +02:00
lovasoa db536bad90 feat: Add encoding parameter to fetch function
- Adds a new parameter `response_encoding` to the fetch function. - This
parameter allows the user to specify a charset for decoding the response
body. - It supports all standard web encodings, and also `hex` and
`base64`. - If no encoding is specified, the response is decoded as
utf-8, or as base64 if it contains binary data.
2025-08-21 23:27:33 +02:00
lovasoa 71207a1266 document rows parameter for textarea component
Adds a `rows` parameter to the `textarea` component to control the
number of rows displayed.

https://github.com/sqlpage/SQLPage/discussions/993
2025-08-18 15:51:31 +02:00
lovasoa 627b4789cb improve sso example (logout + auth custom) 2025-07-30 17:26:11 +02:00
Ophir LOJKINE 2a13f62738 Support multiple jwt audiences for oidc (#977)
* Add OIDC multiple audiences support with configurable trust settings

Co-authored-by: contact <contact@ophir.dev>

* Refactor OIDC audience verification with improved configuration options

Co-authored-by: contact <contact@ophir.dev>

* remive verbose docs

* Refactor OIDC audience verification logic

The changes move audience verification into a dedicated type and improve
code organization around ID token verification.

* Use oidc_additional_trusted_audiences in sso example

Add OIDC config comments and improve array syntax

* document oidc_additional_trusted_audiences

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-30 17:10:37 +02:00
lovasoa 4b15bf19b5 Update Keycloak configuration display names to SQLPage SSO Demo 2025-07-29 17:39:53 +02:00
lovasoa 630a9eaef6 fix sso example logout link 2025-07-29 13:35:20 +02:00
lovasoa 7b7e4ccdc0 Escape search input in SQLite FTS queries
The search term is now properly escaped when used in SQLite full-text
search queries to prevent syntax errors with quotes. This ensures
searches containing quotes work correctly.
2025-07-28 18:08:29 +02:00
Ophir LOJKINE 33125565d3 Check for 404 before redirecting on no-extension paths (#972)
* Check for 404 before redirecting on no-extension paths

The commit improves routing logic by checking if a path would result in
a 404

fixes https://github.com/sqlpage/SQLPage/issues/971 before adding a
trailing slash. This prevents unnecessary redirects when a custom 404
handler exists.

* Fix test function signature formatting in routing module (#973)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* Simplify path resolution and redirect logic

The shorter code more clearly handles finding files with .sql extensions
and decides whether to add trailing slashes based on index file
presence.

* clippy

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-28 17:54:23 +02:00
lovasoa ae30d82917 biome fixes 2025-07-27 00:09:39 +02:00
lovasoa 0d7d58c103 update biome 2025-07-26 23:37:32 +02:00
lovasoa 630882ef5c remove large file 2025-07-25 21:30:15 +02:00
Lenardt Gerhardts 84db9b2276 Added configuration option to skip OIDC authorization checks for certain endpoints (#969)
* Added posibility to bypass oidc authentication for certain endpoints

* fixxed missing .clone()

* Fixxed oidc_skip_endpoints not being optional

* feat(oidc): Introduce protected path prefixes

This commit replaces the OIDC endpoint blacklist with a path prefix whitelist. This is a more intuitive and secure approach for managing protected routes.

The new `oidc_protected_paths` configuration option allows users to specify a list of URL prefixes that require OIDC authentication. By default, all paths are protected.

The documentation has been updated to reflect this change, with clear examples and more user-friendly language.

* docs(oidc): Improve OIDC documentation and examples

This commit improves the OIDC documentation and the "single sign on"
example to better demonstrate how to create a selective login system.

The main documentation now includes a section on creating a public
login page and the "single sign on" example has been updated to
reflect this pattern.

* Simplify OIDC middleware request handling for unprotected paths

* docs(oidc): Improve single sign on example

This commit improves the "single sign on" example to better
demonstrate a public information page that adapts to the users
login status and a separate protected page.

* docs(oidc): Document oidc_protected_paths in configuration.md

This commit updates the main configuration documentation to reflect the
new `oidc_protected_paths` option. It removes the outdated
`oidc_skip_endpoints` and provides a more detailed explanation of how
to create a mix of public and private pages.

* Improve SSO demo UX

- Update docker compose command to use `--watch` flag - Add watch
configuration for SQLPage development - Enhance login page with hero
component and better styling - Simplify protected page welcome message -
Fix OIDC middleware path check logic - Update protected paths in config
to use `/protected` instead of `/protected.sql`

* Skip OIDC auth for non-protected paths later in middleware

We still want to be able to access authenticated user's info in
non-authenticated parts of the app.

We crucially need to check request.path() == SQLPAGE_REDIRECT_URI before
the protected_paths check

* Added whitelist option

* Update configuration.md

* Improve OIDC public paths documentation

The documentation now provides clearer examples and explains the
interaction between public and protected paths more precisely. Also
removes the now-unused default_oidc_public_paths function since the
field's default is handled by serde's default for Vec.

* Add OidcConfig method to check public paths

The new `is_public_path` method consolidates the logic for checking if a
path should bypass OIDC authentication. This replaces the previous
inline checks for public and protected paths.

* fix default empty public paths

* Update SSO example with new image path and public access rules

- Change hero image path in login page - Remove protected.sql as it's no
longer needed - Update sqlpage.yaml to allow public access to
/protected/public

---------

Co-authored-by: Lenardt Gerhardts <lenardt.gerhardts@obi.de>
Co-authored-by: lovasoa <contact@ophir.dev>
2025-07-25 21:15:53 +02:00
Ophir LOJKINE a351d6b8fc sso docs: do not mention github, since it is not an oidc provider
github does not implement oidc

see https://github.com/sqlpage/SQLPage/issues/963
2025-07-18 18:09:51 +02:00
lovasoa 21b4287753 test new modal component + changelog 2025-06-27 15:49:34 +02:00
olivierauverlot 3834f18e88 New modal component (#934)
* New modal component and upgrade of the button component to allow the opening of a modal box

* Modal component

* Update examples/official-site/sqlpage/migrations/63_modal.sql

* Support for embed content in modal box
2025-06-27 14:32:37 +02:00
Andrew Straw 7ccf735298 fix docs (#942)
The `:` character is a colon (not a semi-colon).
2025-06-22 17:43:23 +02:00
lovasoa fdee60146f format 2025-06-02 21:19:01 +02:00
lovasoa d0e493fb13 Rich text editor: readonly mode
https://github.com/sqlpage/SQLPage/discussions/913#discussioncomment-13343491
2025-06-02 20:57:19 +02:00
lovasoa 541053f4f7 fix docker image reference 2025-05-28 00:24:44 +02:00
lovasoa 5c38eb1bd7 chart component: fix zero values in stacked bar charts
fixes https://github.com/sqlpage/SQLPage/issues/924
2025-05-27 12:31:54 +02:00
lovasoa 61677ab5b7 landing page links 2025-05-26 01:30:48 +02:00
hanskihyv eaac4c75b6 Add link & target props to big_number.handlebars (#861)
* Add link & target props to big_number.handlebars

* Refactor: added new links in 49_big_number.sql and updated big_number.handlebars

* Refactor: added new links in 49_big_number.sql

* Apply suggestions from code review

* fix broken links in the documentation

* Update CHANGELOG.md

---------

Co-authored-by: Ophir LOJKINE <contact@ophir.dev>
2025-05-20 01:21:26 +02:00
olivierauverlot 29f64479b5 form improvements with new types of field: header and switch (#906)
* form improvements with new types of field: header and switch

* added checked toggle switch example

* add names to the switch checkboxes

* update form header margins

* trailing whitespace

* docs

---------

Co-authored-by: lovasoa <contact@ophir.dev>
2025-05-20 00:54:05 +02:00
lovasoa bbaf2097fa improve official site form field visual appearance 2025-05-20 00:34:13 +02:00
lovasoa 9939c7512c fmt 2025-05-09 02:04:04 +02:00