2660 Commits

Author SHA1 Message Date
lovasoa 865476ebf9 update dependencies
CI / compile_and_lint (push) Has been cancelled
CI / test (mssql, mssql, mssql://root:Password123!@127.0.0.1/sqlpage) (push) Has been cancelled
CI / test (mysql, mysql, mysql://root:Password123!@127.0.0.1/sqlpage) (push) Has been cancelled
CI / test (postgres, odbc, Driver=PostgreSQL Unicode;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!, true) (push) Has been cancelled
CI / test (postgres, postgres, postgres://root:Password123!@127.0.0.1/sqlpage) (push) Has been cancelled
CI / windows_test (push) Has been cancelled
CI / docker_build (linux/amd64) (push) Has been cancelled
CI / docker_build (linux/arm/v7) (push) Has been cancelled
CI / docker_build (linux/arm64) (push) Has been cancelled
CI / docker_push (push) Has been cancelled
Create Release / Build sqlpage binaries (macOS & Windows) (.exe, , windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
Create Release / Build sqlpage binaries (macOS & Windows) (odbc-static, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
Create Release / Build sqlpage binaries (Linux) (push) Has been cancelled
Create Release / Build AWS Lambda Serverless zip image (push) Has been cancelled
Create Release / Create Github Release (push) Has been cancelled
Create Release / Publish to crates.io (push) Has been cancelled
v0.41.0
2025-12-28 01:03:44 +01:00
lovasoa 3b2a99232f re-enable text drop shadow in chart data labels 2025-12-28 01:00:08 +01:00
Ophir LOJKINE a5964526fb credits where due
Updated default chart color palette to use Open Colors.
2025-12-28 00:25:47 +01:00
Ophir LOJKINE 12e1c10cd3 CHANGELOG new color palette screenshot
Updated changelog with new features, fixes, and updates.
2025-12-28 00:24:01 +01:00
lovasoa dc8e861893 update default chart color palette 2025-12-28 00:21:17 +01:00
lovasoa 5d74fa98e1 re-add the lime color to charts
fixes https://github.com/sqlpage/SQLPage/issues/1162
2025-12-28 00:01:09 +01:00
lovasoa baf3454086 update apexcharts 2025-12-27 23:52:40 +01:00
Ophir Lojkine d9078ac076 simplify oidc tests 2025-12-24 16:01:31 +01:00
Ophir Lojkine 1d82940d00 fix doc error
closes https://github.com/sqlpage/SQLPage/issues/1153#issuecomment-3669485250
2025-12-23 19:12:27 +01:00
Ophir Lojkine 34e361ca4a tests: cap actix workers to prevent fd exhaustion
cargo test was failing with too many open files because each test server
spawned a worker per CPU, quickly exhausting file descriptors when tests ran
in parallel. Set test servers to one worker so they use a bounded number of
sockets/threads, avoiding fd exhaustion and letting OIDC and migration tests
start reliably.
2025-12-23 14:16:37 +01:00
lovasoa 7d2de51231 Refactor OIDC test utilities
This commit introduces a macro for handling requests with cookies, simplifying the OIDC test flow. It also removes redundant session management functions, enhancing code clarity and maintainability. The setup function for OIDC tests is updated to improve readability and streamline the initialization process.
2025-12-12 01:10:13 +01:00
lovasoa 01391715a0 cleanup oidc tests deps 2025-12-12 00:55:08 +01:00
lovasoa 36c037455a cleanup oidc tests
Refactor OIDC login simulation by extracting query parameter logic into a separate function and renaming the callback function for clarity. This improves code readability and maintainability.
2025-12-12 00:37:04 +01:00
lovasoa 01102d76c2 add tests for the oidc code 2025-12-12 00:25:30 +01:00
Ophir LOJKINE 6cc9b1da37 Fix: Prevent infinite OIDC redirects (#1135)
* Fix: Prevent infinite OIDC redirects

This commit adds a mechanism to prevent infinite redirects in the OIDC
callback flow. It does this by:

- Tracking the number of redirects using a cookie.
- Setting a maximum number of redirects (3).
- Returning an error if the maximum is exceeded.

* Merge branch 'main' into prevent-oidc-infinite-redirects

* simplify OIDC infinite redirect prevention logic

This update introduces a new function, `handle_oidc_callback_error`, to streamline error handling during OIDC callback processing. It enhances the management of redirect counts and separates the logic for handling maximum redirect limits into `handle_max_redirect_count_reached`. Additionally, the `build_auth_provider_redirect_response` function is updated to accept the redirect count, ensuring accurate tracking of redirects. This refactor aims to prevent infinite redirect loops and improve code clarity.
2025-12-11 22:49:11 +01:00
Ophir LOJKINE a40b70d215 Fix capitalization of 'SQLPage' in README 2025-12-07 17:00:54 +01:00
lovasoa 730d8ca8a0 update odbc sys 2025-12-07 13:57:19 +01:00
lovasoa 6c35de7cdc updated sql parser
https://github.com/apache/datafusion-sqlparser-rs/blob/main/changelog/0.60.0.md
2025-12-07 13:52:55 +01:00
lovasoa 7531921e67 0.41.0 2025-12-07 10:15:21 +01:00
lovasoa b9f5864d18 update dependencies 2025-12-07 10:14:59 +01:00
Ophir LOJKINE 083593d927 Implement secure oidc logout endpoint and sql function (#1141)
* Checkpoint before follow-up message

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

* Checkpoint before follow-up message

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

* Checkpoint before follow-up message

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

* Checkpoint before follow-up message

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

* feat: Add OIDC logout functionality

This commit introduces the `oidc_logout_url` function, allowing users to securely log out of OIDC-authenticated applications. It includes CSRF protection and handles redirection to the OIDC provider's logout endpoint.

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

* Refactor OIDC logout cookie removal

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

* feat: Implement OIDC logout with CSRF protection

This commit implements secure OIDC logout by:

- Using sqlpage.oidc_logout_url() to generate the logout URL.
- Ensuring CSRF protection during the logout process.
- Redirecting to the OIDC provider's logout endpoint.
- Redirecting back to the homepage after logout.
- Adding absolute URI for post logout redirect URI.

* refactor: Enhance build_absolute_uri function to accept scheme parameter

This commit modifies the build_absolute_uri function to include a scheme parameter, allowing for more flexible URL construction. The function now dynamically sets the URL scheme based on the request context, improving compatibility with different environments.

* refactor: Simplify OIDC logout processing and enhance logout token handling

This commit refactors the OIDC logout process by introducing a new function, `parse_logout_params`, to streamline the extraction of logout parameters from the request. It also updates the logout token creation and verification logic, improving security by ensuring the signature is computed correctly. Additionally, the `create_logout_url` function is modified to include a timestamp and signature in the generated URL, enhancing the logout flow's integrity.

* refactor: Improve logout URL generation and parameter parsing

This commit refines the `create_logout_url` function to utilize a query string builder for constructing the logout URL, enhancing readability and maintainability. Additionally, the `parse_logout_params` function is updated to use `Query::into_inner`, streamlining the extraction of logout parameters from the request.

* refactor: Streamline cookie removal in OIDC logout process

This commit simplifies the removal of authentication and nonce cookies during the OIDC logout process by consolidating the cookie removal logic into a single method call for each cookie, enhancing code clarity and maintainability.

* refactor: Enhance cookie removal logic in OIDC logout process

This commit updates the cookie removal process during OIDC logout by utilizing the `Cookie::build` method to specify cookie attributes, improving clarity and ensuring proper cookie handling.

* chore: Update CHANGELOG for version 0.40.1

- Added new function `sqlpage.oidc_logout_url(redirect_uri)` to generate secure logout URLs for OIDC users, supporting RP-Initiated Logout.
- Fixed compatibility issues with Auth0 for OpenID-Connect authentication.
2025-12-07 01:06:52 +01:00
lovasoa 3ada9b496d update rust 2025-11-29 01:27:37 +01:00
lovasoa 4624f47c90 v0.40.1 2025-11-29 01:15:28 +01:00
lovasoa 681c884f71 Fix compatibility with Auth0 for OpenID-Connect authentification.
See https://github.com/ramosbugs/openidconnect-rs/issues/23
2025-11-29 01:10:43 +01:00
lovasoa 6e9063930c v0.40.0
CI / compile_and_lint (push) Has been cancelled
CI / test (mssql, mssql, mssql://root:Password123!@127.0.0.1/sqlpage) (push) Has been cancelled
Create Release / Build sqlpage binaries (macOS & Windows) (.exe, , windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
CI / test (mysql, mysql, mysql://root:Password123!@127.0.0.1/sqlpage) (push) Has been cancelled
CI / test (postgres, odbc, Driver=PostgreSQL Unicode;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!, true) (push) Has been cancelled
CI / test (postgres, postgres, postgres://root:Password123!@127.0.0.1/sqlpage) (push) Has been cancelled
CI / windows_test (push) Has been cancelled
CI / docker_build (linux/amd64) (push) Has been cancelled
CI / docker_build (linux/arm/v7) (push) Has been cancelled
CI / docker_build (linux/arm64) (push) Has been cancelled
CI / docker_push (push) Has been cancelled
Create Release / Build sqlpage binaries (macOS & Windows) (odbc-static, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
Create Release / Build sqlpage binaries (Linux) (push) Has been cancelled
Create Release / Build AWS Lambda Serverless zip image (push) Has been cancelled
Create Release / Create Github Release (push) Has been cancelled
Create Release / Publish to crates.io (push) Has been cancelled
v0.40.0
2025-11-28 18:12:42 +01:00
Ophir LOJKINE b808ccfdcf Use HTTP 303 instead of 307 for oidc redirects (#1133)
* Use SeeOther for redirects, not TemporaryRedirect

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

* Fix OIDC login redirect to use HTTP 303

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

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-11-28 17:22:25 +01:00
Ophir LOJKINE 747cc78a91 sqlpage.fetch(null) = null (#1131)
* Fix: fetch(null) and fetch_with_meta(null) return null

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

* clean up implementation

* update docs

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-11-26 22:02:51 +01:00
lovasoa 26612c7260 update dependencies 2025-11-26 22:01:34 +01:00
lovasoa 9c89f02c9b fix regression: SET x = NULL now works even when ?x=something is set in
the URL

fix https://github.com/sqlpage/SQLPage/issues/1130
2025-11-26 21:29:14 +01:00
Ophir LOJKINE 95f228f383 simplify SQL test files (#1129)
* simplify SQL test files

- Simplified SQL test files by removing unnecessary components and restructuring queries to focus on expected vs actual results.
- Updated the request handling in `run_sql_test` to differentiate between JSON and HTML responses based on test file content.
- Enhanced error handling and assertions for both JSON and HTML responses to improve test reliability and clarity.
- Removed redundant code and improved readability in the test execution flow.

* move more tests to the new expected/actual format

* migrate more tests to the expected/actual format

- Changed references in various test files to point to the new `simple.sql` instead of the outdated `it_works_simple.sql`.
- Removed several obsolete SQL test files that are no longer needed, streamlining the test suite.
- Updated assertions and request paths in the test cases to reflect the new structure and improve clarity.

* Enhance error handling in SQL tests and update SQL syntax

- Added a new function `format_error` to improve error reporting in SQL test assertions, capturing detailed error descriptions and backtraces.
- Updated SQL syntax in `sqrt.sql` to use `INT` instead of `integer` for consistency with SQL standards.

* sqrt test
2025-11-26 00:45:13 +01:00
Ophir LOJKINE 2af95a041f Accept header JSON responses (#1127)
* Support JSON responses via Accept header

* no update in migrations

* No UPDATE in official site migrations

- Updated the JSON component description to clarify its integration with external services and the ability to serve both HTML and JSON based on the HTTP Accept header.
- Added examples demonstrating how to request JSON responses using `curl`.
- Removed the obsolete migration file that documented the JSON response format feature, consolidating information into the main documentation.

* revert stupid docs example change

stupid bot

* simplify tests

* avoid string then json in tests, parse as json directly

* changelog
2025-11-24 23:17:19 +01:00
DofSekai 24d6057649 add delay property (#1126) 2025-11-24 12:56:06 +01:00
Ophir LOJKINE e93056e6d8 Add sqlpage.set_variable(name, value) function and update docs (#1124)
* feat: Add sqlpage.set_variable function

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

* Refactor: Fix set_variable serialization and update tests

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

* fix tests: no json_extract on mssql

* Refactor: Update URLParameters handling in set_variable function

- Replaced serde_json::Map with a custom URLParameters struct for better management of URL parameters.
- Introduced methods for handling single and vector values in URLParameters.
- Updated tests to reflect changes in the set_variable function's behavior.

* cargo fmt

* clippy

* retsore set var test

* remove redundant test

* ensure set_variable only takes into account GET variables, not SET

* factor url parameter setting code

* v0.40

* sqlpage.set_variable links to "?" when no parameter is present

- Renamed URLParameters module for clarity and removed the deprecated url_parameter_deserializer.
- Updated the set_variable function to return parameters directly instead of appending to a URL.
- Adjusted related function calls to reflect changes in URL parameter management.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-11-24 12:55:32 +01:00
olivierauverlot 8289bc69ba Pagination (#1093)
* Pagination component

* New pagination component

* Some changes

* Adding a warning about the use of LIMIT and OFFSET in the blog post

* Use icon_img for icons

* Correction of the icons size

* enhance pagination docs examples

* update pagination docs

---------

Co-authored-by: Olivier Auverlot <olivier.auverlot@icloud.com>
Co-authored-by: lovasoa <contact@ophir.dev>
2025-11-23 00:40:37 +01:00
olivierauverlot 17d892584f Adding an alias named contents to the html property of the shell-empty component (#1122)
* Adding an alias named contents to the html property of the shell-empty component

* Changes for the shell-empty documentation

* improve shell comoonent description

* shell-empty docs clarification

---------

Co-authored-by: Olivier Auverlot <olivier.auverlot@icloud.com>
Co-authored-by: lovasoa <contact@ophir.dev>
2025-11-22 23:46:52 +01:00
lovasoa 215170e6ff clear up the docs for the login component 2025-11-21 16:57:47 +01:00
Ophir LOJKINE a52b20cc35 remove docker build cruft (#1115)
* remove docker build cruft

- Simplified environment variable sourcing in build scripts by using a single build-env.sh file.
- Updated Dockerfile to streamline the build process and reduce unnecessary comments.
- Enhanced setup-cross-compilation.sh to directly set target and linker variables without temporary files.
- Improved clarity and maintainability of build scripts.

* fix setup-cross-compilation.sh

- Updated the script to use a more concise syntax for exporting environment variables.
- Improved readability by using echo and conditional checks for BINDGEN_EXTRA_CLANG_ARGS.
- This change simplifies the script while maintaining functionality.

* Refactor setup-cross-compilation.sh for improved readability

- Changed the syntax for checking BINDGEN_EXTRA_CLANG_ARGS to use a conditional statement for clarity.
- This enhances the script's maintainability while preserving its functionality.
2025-11-20 00:36:41 +01:00
lovasoa 25fe2e66b6 clarify login footer docs 2025-11-19 23:53:37 +01:00
lovasoa 20ae45f2b4 fix missing parameter from login component docs
see https://github.com/sqlpage/SQLPage/discussions/1114
2025-11-19 23:51:00 +01:00
Zoé Cappe c7a5c76e0c fix text-center for the edit_url action in table component (#1113) 2025-11-19 16:06:43 +01:00
Ophir LOJKINE 75ade135da Refactor request handling to separate data and state (#1111)
* Make URL and POST parameters immutable, separate from SET variables

- URL and POST parameters are now immutable after request initialization
- SET command creates user-defined variables in separate namespace
- Variable lookup: SET variables shadow request parameters
- Added sqlpage.variables('set') to inspect user-defined variables
- Simplified API: most functions now use &RequestInfo instead of &mut
- All tests passing (151 total)

* Restore deprecation warning for SET on POST variable names

* Restore deprecation warnings for $var accessing POST variables

- Warn when both URL and POST have same variable name
- Warn when $var is used for POST-only variable (should use :var)

* Simplify run_sql: always use clone_without_variables

No need to branch on whether variables are provided since we clone in both cases anyway.

* Revert "Simplify run_sql: always use clone_without_variables"

This reverts commit 60f5a05446.

* WIP: Add ExecutionContext to separate mutable state from RequestInfo

This is a draft refactoring to avoid cloning large immutable data (headers,
cookies, body) when creating nested execution contexts in run_sql().

Changes:
- RequestInfo now contains only immutable request data
- ExecutionContext wraps Rc<RequestInfo> + mutable execution state
- Avoids cloning potentially large strings in nested run_sql() calls

Status: NOT COMPILING YET - this is work in progress

* Refactor: Rename RequestInfo to ExecutionContext

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

* avoid cloning request

* improve run_sql invalid variables error message

* changelog

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-11-19 12:27:23 +01:00
Ophir LOJKINE 34f5d7f4ae Refactor spy function documentation for clarity (#1112)
fixes https://github.com/sqlpage/SQLPage/discussions/1108#discussioncomment-15007105
2025-11-19 03:13:40 +01:00
Ophir LOJKINE b11e7bf0ff Make URL and POST parameters immutable (#1109)
* Make URL and POST parameters immutable, separate from SET variables

- URL and POST parameters are now immutable after request initialization
- SET command creates user-defined variables in separate namespace
- Variable lookup: SET variables shadow request parameters
- Added sqlpage.variables('set') to inspect user-defined variables
- Simplified API: most functions now use &RequestInfo instead of &mut
- All tests passing (151 total)

* Restore deprecation warning for SET on POST variable names

* Restore deprecation warnings for $var accessing POST variables

- Warn when both URL and POST have same variable name
- Warn when $var is used for POST-only variable (should use :var)

* Simplify run_sql: always use clone_without_variables

No need to branch on whether variables are provided since we clone in both cases anyway.

* Revert "Simplify run_sql: always use clone_without_variables"

This reverts commit 60f5a05446.

* Fix cross-database test compatibility for immutable variables

Renamed test to run only on SQLite since json_extract() is SQLite-specific.
Other databases (PostgreSQL, MySQL, MSSQL) have different JSON functions.

* Fix test to work across all databases without json_extract

PostgreSQL doesn't have json_extract, so compare the full JSON string instead.

* Document variable system improvements in CHANGELOG

* Make CHANGELOG more explicit about breaking changes with examples

* Fix CHANGELOG: SET overwrites GET parameters, not POST

* Add database-specific examples for accessing original URL parameters
2025-11-19 03:10:54 +01:00
Ophir LOJKINE 7cbf5034d8 Improve run_sql error messages (#1105)
* Refactor: Improve run_sql variable parsing

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

* Refactor: Use serde_path_to_error for better error reporting

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

* Remove serde_path_to_error, use serde_json error reporting

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

* Refactor: Move SingleOrVec tests to end of file

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

* fix SingleOrVec serialization

* Refactor: Move SingleOrVec to a dedicated module and update imports

* Move SingleOrVec tests from http.rs to single_or_vec.rs for better organization

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-11-19 01:52:38 +01:00
lovasoa 3276b5a786 Add a visual identity page to the website 2025-11-13 12:12:13 +01:00
Ophir LOJKINE f2c8164fee Test postgresql range type decoding (#1097)
* Add support for PostgreSQL range types in SQL to JSON conversion

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

* add support for postgres range types

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-11-12 18:05:44 +01:00
lovasoa 8498b76e5f update deps 2025-11-12 10:34:04 +01:00
Phoenix79-spec f4dab9ff1c Suppressed clippy redundant else error in http.rs using expect syntax. (#1096) 2025-11-12 02:44:44 +01:00
lovasoa d8e6a280fc Update CI configuration to use a shared cache key for Rust builds and adjust cache saving conditions. The shared key is now set to 'rust-sqlpage-proj-test' for both main and test branches, with the test branch cache saving disabled. 2025-11-08 01:25:39 +01:00
lovasoa e8ba8f7f1a Update CHANGELOG for v0.39.1 release, adding release date and summarizing key changes including improved server timing tracking and enhanced error messages.
Create Release / Build sqlpage binaries (macOS & Windows) (.exe, , windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
Create Release / Build sqlpage binaries (macOS & Windows) (odbc-static, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
CI / compile_and_lint (push) Has been cancelled
CI / test (mssql, mssql, mssql://root:Password123!@127.0.0.1/sqlpage) (push) Has been cancelled
CI / test (mysql, mysql, mysql://root:Password123!@127.0.0.1/sqlpage) (push) Has been cancelled
CI / test (postgres, odbc, Driver=PostgreSQL Unicode;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!, true) (push) Has been cancelled
CI / test (postgres, postgres, postgres://root:Password123!@127.0.0.1/sqlpage) (push) Has been cancelled
CI / windows_test (push) Has been cancelled
CI / docker_build (linux/amd64) (push) Has been cancelled
CI / docker_build (linux/arm/v7) (push) Has been cancelled
CI / docker_build (linux/arm64) (push) Has been cancelled
CI / docker_push (push) Has been cancelled
Create Release / Build sqlpage binaries (Linux) (push) Has been cancelled
Create Release / Build AWS Lambda Serverless zip image (push) Has been cancelled
Create Release / Create Github Release (push) Has been cancelled
Create Release / Publish to crates.io (push) Has been cancelled
v0.39.1
2025-11-08 00:42:41 +01:00