mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-12 21:20:14 +00:00
feat: display all accessible oidc clients in the dashboard (#832)
Co-authored-by: Kyle Mendell <ksm@ofkm.us>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type {
|
||||
AuthorizedOidcClient,
|
||||
AccessibleOidcClient,
|
||||
AuthorizeResponse,
|
||||
OidcClient,
|
||||
OidcClientCreate,
|
||||
@@ -115,18 +115,12 @@ class OidcService extends APIService {
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async listAuthorizedClients(options?: SearchPaginationSortRequest) {
|
||||
async listOwnAccessibleClients(options?: SearchPaginationSortRequest) {
|
||||
const res = await this.api.get('/oidc/users/me/clients', {
|
||||
params: options
|
||||
});
|
||||
return res.data as Paginated<AuthorizedOidcClient>;
|
||||
}
|
||||
|
||||
async listAuthorizedClientsForUser(userId: string, options?: SearchPaginationSortRequest) {
|
||||
const res = await this.api.get(`/oidc/users/${userId}/clients`, {
|
||||
params: options
|
||||
});
|
||||
return res.data as Paginated<AuthorizedOidcClient>;
|
||||
return res.data as Paginated<AccessibleOidcClient>;
|
||||
}
|
||||
|
||||
async revokeOwnAuthorizedClient(clientId: string) {
|
||||
|
||||
@@ -4,9 +4,9 @@ import { writable } from 'svelte/store';
|
||||
|
||||
const userStore = writable<User | null>(null);
|
||||
|
||||
const setUser = (user: User) => {
|
||||
const setUser = async (user: User) => {
|
||||
if (user.locale) {
|
||||
setLocale(user.locale, false);
|
||||
await setLocale(user.locale, false);
|
||||
}
|
||||
userStore.set(user);
|
||||
};
|
||||
|
||||
@@ -53,7 +53,6 @@ export type AuthorizeResponse = {
|
||||
issuer: string;
|
||||
};
|
||||
|
||||
export type AuthorizedOidcClient = {
|
||||
scope: string;
|
||||
client: OidcClientMetaData;
|
||||
export type AccessibleOidcClient = OidcClientMetaData & {
|
||||
lastUsedAt: Date | null;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,26 @@
|
||||
import { setLocale as setParaglideLocale, type Locale } from '$lib/paraglide/runtime';
|
||||
import { setDefaultOptions } from 'date-fns';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
export function setLocale(locale: Locale, reload = true) {
|
||||
import(`../../../node_modules/zod/v4/locales/${locale}.js`)
|
||||
.then((zodLocale) => z.config(zodLocale.default()))
|
||||
.finally(() => {
|
||||
setParaglideLocale(locale, { reload });
|
||||
export async function setLocale(locale: Locale, reload = true) {
|
||||
const [zodResult, dateFnsResult] = await Promise.allSettled([
|
||||
import(`../../../node_modules/zod/v4/locales/${locale}.js`),
|
||||
import(`../../../node_modules/date-fns/locale/${locale}.js`)
|
||||
]);
|
||||
|
||||
if (zodResult.status === 'fulfilled') {
|
||||
z.config(zodResult.value.default());
|
||||
} else {
|
||||
console.warn(`Failed to load zod locale for ${locale}:`, zodResult.reason);
|
||||
}
|
||||
|
||||
setParaglideLocale(locale, { reload });
|
||||
|
||||
if (dateFnsResult.status === 'fulfilled') {
|
||||
setDefaultOptions({
|
||||
locale: dateFnsResult.value.default
|
||||
});
|
||||
} else {
|
||||
console.warn(`Failed to load date-fns locale for ${locale}:`, dateFnsResult.reason);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user