Files
jellyfin-plugin-floatplane/doc/research/reference-sources/fpdl_logins.ts
claude 9e33a343ab
Some checks failed
release / build-release (push) Has been cancelled
Floatplane channel plugin for Jellyfin 10.10.x: browse, HLS proxy, cookie session, CI release
- IChannel: creators -> sub-channels -> video posts (public listing API, search mapped)
- IRequiresMediaInfoCallback -> signed proxy URLs; stream controller rewrites HLS so the
  AES-128 key is fetched server-side with the session cookie, segments stay on the CDN
- delivery/info cached per token lifetime and throttled (~2/min)
- config page: paste sails.sid + validate, extra creators, quality, search test
- scripts/package.sh -> plugin folder + zip + md5 + manifest.json; Gitea release workflow
- research docs, HAR analysis (HAR itself gitignored), install-pi5.sh

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 09:42:27 +01:00

46 lines
1.6 KiB
TypeScript

import { MyPlexAccount } from "@ctrl/plex";
import { loopError } from "@inrixia/helpers";
import { args, fApi } from "./lib/helpers/index";
import { plex } from "./lib/prompts/index";
import type { Self } from "floatplane/user";
export type User = Self;
export const loginFloatplane = async (): Promise<User> => {
const loginResponse = await fApi.deviceLogin();
console.log(`\nSigned in as \u001b[36m${loginResponse.username}\u001b[0m!\n`);
return loginResponse;
};
export const loginPlex = async (): Promise<string> => {
let plexToken: string;
if (args.headless === true) {
if (args.plexUsername === undefined || args.plexPassword === undefined)
throw new Error('Need plex username/password to login. Please pass them as --plexUsername="" --plexPassword="" or enviroment variables!');
plexToken = (await loopError(
async () =>
(
await new MyPlexAccount({
username: args.plexUsername,
password: args.plexPassword,
}).connect()
).token,
async (err) => console.error(`\nLooks like those login details didnt work, Please try again... ${err}`),
)) as string;
} else {
console.log("\n> Please enter your plex details. (Username and Password is not saved, only used to generate a token.)");
plexToken = (await loopError(
async () =>
(
await new MyPlexAccount({
username: await plex.username(),
password: await plex.password(),
}).connect()
).token,
async (err) => console.error(`\nLooks like those login details didnt work, Please try again... ${err}`),
)) as string;
console.log(`> Fetched plex token: \u001b[36m${plexToken}\u001b[0m!\n`);
}
return plexToken;
};