Fix: Resolve Plex authentication cookie and polling issues

- Export CLIENT_IDENTIFIER and APP_NAME as module-level constants
  - Ensures same identifier used across all composables and API calls
  - Prevents auth failures from mismatched client identifiers

- Refactor PlexSettings.vue to use composable auth flow
  - Remove duplicate authentication logic (138 lines removed)
  - Use openAuthPopup() from usePlexAuth composable
  - Use cleanup() function in onUnmounted hook
  - Reduced from 498 lines to 360 lines (28% further reduction)

- Fix usePlexAuth to import constants directly
  - Previously tried to get constants from usePlexApi() instance
  - Now imports as shared module exports
  - Ensures consistent CLIENT_IDENTIFIER across auth flow

Total PlexSettings.vue reduction: 2094 → 360 lines (83% reduction)
Authentication flow now properly sets cookies and completes polling ✓
This commit is contained in:
2026-02-27 17:46:38 +01:00
parent ac591cbebe
commit 368ad70096
3 changed files with 22 additions and 163 deletions

View File

@@ -1,9 +1,7 @@
import { ref } from "vue";
import { usePlexApi } from "./usePlexApi";
import { CLIENT_IDENTIFIER, APP_NAME } from "./usePlexApi";
export function usePlexAuth() {
const { CLIENT_IDENTIFIER, APP_NAME } = usePlexApi();
const loading = ref(false);
const plexPopup = ref<Window | null>(null);
const pollInterval = ref<number | null>(null);