feat(oauth2): add SVG icon support for OAuth2 providers (#825)

- Add optional `icon` field to UserOauth2Settings type
- Include preset SVG icons for GitHub, Linux Do, and Authentik templates
- Render icons on OAuth2 login buttons
- Add icon configuration UI with preview in admin panel

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Dream Hunter
2026-02-01 21:00:15 +08:00
committed by GitHub
parent f0da9289fc
commit d367bc92b2
6 changed files with 59 additions and 3 deletions

View File

@@ -146,6 +146,7 @@ export class WebhookSettings {
export type UserOauth2Settings = {
name: string;
icon?: string; // SVG icon string for the provider
clientID: string;
clientSecret: string;
authorizationURL: string;

View File

@@ -11,13 +11,14 @@ export default {
openSettings: async (c: Context<HonoCustomType>) => {
const value = await getJsonSetting(c, CONSTANTS.USER_SETTINGS_KEY);
const settings = new UserSettings(value);
const oauth2ClientIDs = [] as { clientID: string, name: string }[];
const oauth2ClientIDs = [] as { clientID: string, name: string, icon?: string }[];
try {
const oauth2Settings = await getJsonSetting<UserOauth2Settings[]>(c, CONSTANTS.OAUTH2_SETTINGS_KEY);
oauth2ClientIDs.push(
...oauth2Settings?.map(s => ({
clientID: s.clientID,
name: s.name
name: s.name,
icon: s.icon,
})) || []
);
} catch (e) {