mirror of
https://github.com/jellyfin/jellyfin-chromecast.git
synced 2024-11-22 21:49:44 +00:00
Remove "RECEIVERVERSION" global
This commit is contained in:
parent
c2ac0632d9
commit
02301a799e
@ -215,7 +215,7 @@ describe('getting security headers', () => {
|
||||
|
||||
// @ts-expect-error Since the method is private.
|
||||
const result = JellyfinApi.getSecurityHeaders();
|
||||
const correctAuth = `MediaBrowser Client="Chromecast", Token="thisIsAccessToken", Version="${version}", DeviceId="${btoa(
|
||||
const correctAuth = `MediaBrowser Client="Chromecast", Version="${version}", Token="thisIsAccessToken", DeviceId="${btoa(
|
||||
'thisIsReceiverName'
|
||||
)}", Device="thisIsReceiverName"`;
|
||||
|
||||
@ -233,7 +233,7 @@ describe('getting security headers', () => {
|
||||
// @ts-expect-error Since the method is private.
|
||||
const result = JellyfinApi.getSecurityHeaders();
|
||||
const correct = {
|
||||
Authorization: `MediaBrowser Client="Chromecast", Token="thisIsAccessToken", Version="${version}", DeviceId="thisIsSenderId", Device="Google%20Cast"`
|
||||
Authorization: `MediaBrowser Client="Chromecast", Version="${version}", Token="thisIsAccessToken", DeviceId="thisIsSenderId", Device="Google%20Cast"`
|
||||
};
|
||||
|
||||
expect(result).toMatchObject(correct);
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { version as packageVersion } from '../../package.json';
|
||||
import { ajax } from './fetchhelper';
|
||||
|
||||
export abstract class JellyfinApi {
|
||||
@ -16,9 +17,6 @@ export abstract class JellyfinApi {
|
||||
// unique id
|
||||
public static deviceId = '';
|
||||
|
||||
// version
|
||||
public static versionNumber = RECEIVERVERSION;
|
||||
|
||||
public static setServerInfo(
|
||||
userId?: string,
|
||||
accessToken?: string,
|
||||
@ -54,17 +52,14 @@ export abstract class JellyfinApi {
|
||||
// create the necessary headers for authentication
|
||||
private static getSecurityHeaders(): { Authorization?: string } {
|
||||
const parameters: Record<string, string> = {
|
||||
Client: 'Chromecast'
|
||||
Client: 'Chromecast',
|
||||
Version: packageVersion
|
||||
};
|
||||
|
||||
if (this.accessToken) {
|
||||
parameters['Token'] = this.accessToken;
|
||||
}
|
||||
|
||||
if (this.versionNumber) {
|
||||
parameters['Version'] = this.versionNumber;
|
||||
}
|
||||
|
||||
if (this.deviceId) {
|
||||
parameters['DeviceId'] = this.deviceId;
|
||||
}
|
||||
|
1
src/types/global.d.ts
vendored
1
src/types/global.d.ts
vendored
@ -90,7 +90,6 @@ interface SupportedCommands {
|
||||
// /From commandHandler
|
||||
|
||||
declare global {
|
||||
export const RECEIVERVERSION: string;
|
||||
export interface Window {
|
||||
mediaElement: HTMLElement | null;
|
||||
playerManager: PlayerManager;
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
import { version } from './package.json';
|
||||
|
||||
export default defineConfig({
|
||||
root: 'src',
|
||||
@ -14,8 +13,5 @@ export default defineConfig({
|
||||
},
|
||||
server: {
|
||||
port: 9000
|
||||
},
|
||||
define: {
|
||||
RECEIVERVERSION: JSON.stringify(version)
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user