mirror of
https://github.com/KevinMidboe/seasoned.git
synced 2026-05-14 01:55:42 +00:00
Feat/settings page redesign (#104)
* include credentials on login fetch requests, allows set header response * Add theme composable and utility improvements - Create useTheme composable for centralized theme management - Update main.ts to use useTheme for initialization - Generalize getCookie utility in user module - Add utility functions for data formatting * Add Plex integration composables and icons - Create usePlexAuth composable for Plex OAuth flow - Create usePlexApi composable for Plex API interactions - Create useRandomWords composable for password generation - Add Plex-related icons (IconPlex, IconServer, IconSync) - Add Plex helper utilities - Update API with Plex-related endpoints * Add storage management components for data & privacy section - Create StorageManager component for browser storage overview - Create StorageSectionBrowser for localStorage/sessionStorage/cookies - Create StorageSectionServer for server-side data (mock) - Create ExportSection for data export functionality - Refactor DataExport component with modular sections - Add storage icons (IconCookie, IconDatabase, IconTimer) - Implement collapsible sections with visual indicators - Add colored borders per storage type - Display item counts and total size in headers * Add theme, password, and security settings components - Create ThemePreferences with visual theme selector - Create PasswordGenerator with passphrase and random modes - Create SecuritySettings wrapper for password management - Update ChangePassword to work with new layout - Implement improved slider UX with visual feedback - Add theme preview cards with gradients - Standardize component styling and typography * Add Plex settings and authentication components - Create PlexSettings component for Plex account management - Create PlexAuthButton with improved OAuth flow - Create PlexServerInfo for server details display - Use icon components instead of inline SVGs - Add sync and unlink functionality - Implement user-friendly authentication flow * Redesign settings page with two-column layout and ProfileHero - Create ProfileHero component with avatar and user info - Create RequestHistory component for Plex requests (placeholder) - Redesign SettingsPage with modern two-column grid layout - Add shared-settings.scss for consistent styling - Organize sections: Appearance, Security, Integrations, Data & Privacy - Implement responsive mobile layout - Standardize typography (h2: 1.5rem, 700 weight) - Add compact modifier for tighter sections
This commit is contained in:
34
src/api.ts
34
src/api.ts
@@ -262,17 +262,22 @@ const getRequestStatus = async (
|
||||
.catch(err => Promise.reject(err));
|
||||
};
|
||||
|
||||
/*
|
||||
const watchLink = async (title, year) => {
|
||||
const watchLink = async (title: string, year: string) => {
|
||||
const url = new URL("/api/v1/plex/watch-link", API_HOSTNAME);
|
||||
url.searchParams.append("title", title);
|
||||
url.searchParams.append("year", year);
|
||||
|
||||
return fetch(url.href)
|
||||
const options: RequestInit = {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
credentials: "include"
|
||||
};
|
||||
|
||||
return fetch(url.href, options)
|
||||
.then(resp => resp.json())
|
||||
.then(response => response.link);
|
||||
};
|
||||
|
||||
/*
|
||||
const movieImages = id => {
|
||||
const url = new URL(`v2/movie/${id}/images`, API_HOSTNAME);
|
||||
|
||||
@@ -373,9 +378,9 @@ const updateSettings = async (settings: any) => {
|
||||
|
||||
// - - - Authenticate with plex - - -
|
||||
|
||||
const linkPlexAccount = async (username: string, password: string) => {
|
||||
const linkPlexAccount = async (authToken: string) => {
|
||||
const url = new URL("/api/v1/user/link_plex", API_HOSTNAME);
|
||||
const body = { username, password };
|
||||
const body = { authToken };
|
||||
|
||||
const options: RequestInit = {
|
||||
method: "POST",
|
||||
@@ -387,7 +392,7 @@ const linkPlexAccount = async (username: string, password: string) => {
|
||||
return fetch(url.href, options)
|
||||
.then(resp => resp.json())
|
||||
.catch(error => {
|
||||
console.error(`api error linking plex account: ${username}`); // eslint-disable-line no-console
|
||||
console.error("api error linking plex account"); // eslint-disable-line no-console
|
||||
throw error;
|
||||
});
|
||||
};
|
||||
@@ -408,6 +413,20 @@ const unlinkPlexAccount = async () => {
|
||||
});
|
||||
};
|
||||
|
||||
const plexRecentlyAddedInLibrary = async (id: number) => {
|
||||
const url = new URL(`/api/v2/plex/recently_added/${id}`, API_HOSTNAME);
|
||||
const options: RequestInit = {
|
||||
credentials: "include"
|
||||
};
|
||||
|
||||
return fetch(url.href, options)
|
||||
.then(resp => resp.json())
|
||||
.catch(error => {
|
||||
console.error(`api error fetch plex recently added`); // eslint-disable-line no-console
|
||||
throw error;
|
||||
});
|
||||
};
|
||||
|
||||
// - - - User graphs - - -
|
||||
|
||||
const fetchGraphData = async (
|
||||
@@ -538,6 +557,7 @@ const elasticSearchMoviesAndShows = async (query: string, count = 22) => {
|
||||
};
|
||||
|
||||
export {
|
||||
API_HOSTNAME,
|
||||
getMovie,
|
||||
getShow,
|
||||
getPerson,
|
||||
@@ -554,12 +574,14 @@ export {
|
||||
getRequestStatus,
|
||||
linkPlexAccount,
|
||||
unlinkPlexAccount,
|
||||
plexRecentlyAddedInLibrary,
|
||||
register,
|
||||
login,
|
||||
logout,
|
||||
getSettings,
|
||||
updateSettings,
|
||||
fetchGraphData,
|
||||
watchLink,
|
||||
getEmoji,
|
||||
elasticSearchMoviesAndShows
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user