@@ -176,8 +177,8 @@ export {};
目前已经支持的策略有:
-| Package | Meta | Changelog |
-| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
+| Package | Meta | Changelog |
+| ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| [@svelte-dev/auth-oauth2](https://github.com/willin/svelte-turbo/tree/main/packages/auth-oauth2/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-oauth2?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-oauth2) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-oauth2?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-oauth2) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-oauth2?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-oauth2) | [Changelog](https://github.com/willin/svelte-turbo/tree/main/packages/auth-oauth2/CHANGELOG.md) |
| [@svelte-dev/auth-github](https://github.com/willin/svelte-turbo/tree/main/packages/auth-github/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-github?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-github) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-github?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-github) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-github?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-github) | [Changelog](https://github.com/willin/svelte-turbo/tree/main/packages/auth-github/CHANGELOG.md) |
| [@svelte-dev/auth-alipay](https://github.com/willin/svelte-turbo/tree/main/packages/auth-alipay/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-alipay?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-alipay) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-alipay?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-alipay) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-alipay?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-alipay) | [Changelog](https://github.com/willin/svelte-turbo/tree/main/packages/auth-alipay/CHANGELOG.md) |
diff --git a/apps/web/src/routes/en/auth/+page.md b/apps/web/src/routes/en/auth/+page.md
index 9810a3e..2f56d69 100644
--- a/apps/web/src/routes/en/auth/+page.md
+++ b/apps/web/src/routes/en/auth/+page.md
@@ -4,7 +4,7 @@ desc: A simple and easy-to-use Svelte identity management library
---
![Logo](https://repository-images.githubusercontent.com/726691357/f09bf6fc-3844-4584-8eee-6bfb425d8a38)
@@ -29,6 +29,7 @@ As with Passport.js, it uses the strategy pattern to support the different authe
## Demo
{#if $page && $page.data.user}
+
{JSON.stringify($page.data.user, null, 2)}
@@ -175,8 +176,8 @@ export {};
### Strategies
-| Package | Meta | Changelog |
-| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
+| Package | Meta | Changelog |
+| ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| [@svelte-dev/auth-oauth2](https://github.com/willin/svelte-turbo/tree/main/packages/auth-oauth2/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-oauth2?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-oauth2) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-oauth2?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-oauth2) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-oauth2?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-oauth2) | [Changelog](https://github.com/willin/svelte-turbo/tree/main/packages/auth-oauth2/CHANGELOG.md) |
| [@svelte-dev/auth-github](https://github.com/willin/svelte-turbo/tree/main/packages/auth-github/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-github?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-github) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-github?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-github) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-github?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-github) | [Changelog](https://github.com/willin/svelte-turbo/tree/main/packages/auth-github/CHANGELOG.md) |
| [@svelte-dev/auth-alipay](https://github.com/willin/svelte-turbo/tree/main/packages/auth-alipay/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-alipay?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-alipay) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-alipay?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-alipay) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-alipay?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-alipay) | [Changelog](https://github.com/willin/svelte-turbo/tree/main/packages/auth-alipay/CHANGELOG.md) |
diff --git a/apps/web/src/routes/logout/+page.server.ts b/apps/web/src/routes/logout/+page.server.ts
new file mode 100644
index 0000000..e396432
--- /dev/null
+++ b/apps/web/src/routes/logout/+page.server.ts
@@ -0,0 +1,7 @@
+import type { Load } from '@sveltejs/kit';
+
+export const load: Load = async ({ url, locals }) => {
+ throw await locals.auth.logout({
+ redirectTo: url?.searchParams?.get('redirectTo') ?? '/'
+ });
+};
diff --git a/bun.lockb b/bun.lockb
index c848cd7..658b0e0 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/package.json b/package.json
index a85499b..301d1cf 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
"lint-staged": "latest",
"prettier": "^3.1.0",
"prettier-plugin-svelte": "^3.1.2",
- "turbo": "latest"
+ "turbo": "^1.11.2"
},
"engines": {
"node": ">=18"
diff --git a/packages/auth/typedoc.json b/packages/auth/typedoc.json
index 81532f9..351babb 100644
--- a/packages/auth/typedoc.json
+++ b/packages/auth/typedoc.json
@@ -10,8 +10,9 @@
"hideParameterTypesInTitle": false,
"navigationLinks": {
"Home": "https://svelte.js.cool/",
- "I18n": "https://svelte.js.cool/docs/i18n",
"Session": "https://svelte.js.cool/docs/session",
+ "Auth": "https://svelte.js.cool/docs/auth",
+ "I18n": "https://svelte.js.cool/docs/i18n",
"GitHub": "https://github.com/willin/svelte-turbo",
"NPM": "https://npmjs.com/package/@svelte-dev/auth",
"Willin": "https://willin.wang"
diff --git a/packages/i18n/typedoc.json b/packages/i18n/typedoc.json
index 31fa778..0ea6626 100644
--- a/packages/i18n/typedoc.json
+++ b/packages/i18n/typedoc.json
@@ -10,8 +10,9 @@
"hideParameterTypesInTitle": false,
"navigationLinks": {
"Home": "https://svelte.js.cool/",
- "Auth": "https://svelte.js.cool/docs/auth",
"Session": "https://svelte.js.cool/docs/session",
+ "Auth": "https://svelte.js.cool/docs/auth",
+ "I18n": "https://svelte.js.cool/docs/i18n",
"GitHub": "https://github.com/willin/svelte-turbo",
"NPM": "https://npmjs.com/package/@svelte-dev/session",
"Willin": "https://willin.wang"
diff --git a/packages/session/src/lib/session/implements/cookie.ts b/packages/session/src/lib/session/implements/cookie.ts
index b03ac34..a1cd4bc 100644
--- a/packages/session/src/lib/session/implements/cookie.ts
+++ b/packages/session/src/lib/session/implements/cookie.ts
@@ -106,7 +106,13 @@ export class CookieStrategy
* Deletes data for a given session id from the data store.
*/
async deleteData(id: string): Promise {
- this.#cookies.delete(id, this.#options);
+ if (!this.#chunk) {
+ return this.#cookies.delete(id, this.#options);
+ }
+ const allCookies = this.#cookies.getAll().filter((cookie) => cookie.name.startsWith(id));
+ for (const cookie of allCookies) {
+ this.#cookies.delete(cookie.name, this.#options);
+ }
}
#chunkString(str: string, chunkSize: number) {
diff --git a/packages/session/typedoc.json b/packages/session/typedoc.json
index 823b9a4..be4d2ca 100644
--- a/packages/session/typedoc.json
+++ b/packages/session/typedoc.json
@@ -10,6 +10,7 @@
"hideParameterTypesInTitle": false,
"navigationLinks": {
"Home": "https://svelte.js.cool/",
+ "Session": "https://svelte.js.cool/docs/session",
"Auth": "https://svelte.js.cool/docs/auth",
"I18n": "https://svelte.js.cool/docs/i18n",
"GitHub": "https://github.com/willin/svelte-turbo",