Skip to content

Commit

Permalink
Merge remote-tracking branch 'source/master' into misc-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tnyeanderson committed Mar 24, 2022
2 parents f613aee + c5b0165 commit 3bb63c3
Show file tree
Hide file tree
Showing 11 changed files with 349 additions and 400 deletions.
30 changes: 0 additions & 30 deletions .github/dependabot.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/[email protected]

- name: Setup node env
uses: actions/setup-node@v2.2.0
uses: actions/setup-node@v2.3.0
with:
node-version: 14

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/[email protected]

- name: Setup node env
uses: actions/setup-node@v2.2.0
uses: actions/setup-node@v2.3.0
with:
node-version: 14

Expand Down
14 changes: 0 additions & 14 deletions CHANGELOG.md

This file was deleted.

625 changes: 308 additions & 317 deletions package-lock.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@
"axios": "^0.21.1"
},
"devDependencies": {
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"@types/chromecast-caf-receiver": "^5.0.12",
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@types/chromecast-caf-receiver": "^5.0.15",
"@types/jest": "^26.0.24",
"@types/node": "^16.0.0",
"@types/node": "^16.4.7",
"@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^3.11.5",
"@types/webpack-merge": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^4.28.2",
"@typescript-eslint/parser": "^4.28.2",
"@typescript-eslint/eslint-plugin": "^4.28.5",
"@typescript-eslint/parser": "^4.28.5",
"clean-webpack-plugin": "^3.0.0",
"cross-env": "^7.0.3",
"css-loader": "^5.2.6",
"css-loader": "^6.2.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.30.0",
"eslint": "^7.31.0",
"eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jsdoc": "^35.4.1",
"eslint-plugin-jsdoc": "^36.0.6",
"eslint-plugin-json": "^3.0.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-promise": "^5.1.0",
Expand All @@ -40,17 +40,17 @@
"jest": "^26.6.3",
"prettier": "^2.3.2",
"source-map-loader": "^3.0.0",
"style-loader": "^3.0.0",
"style-loader": "^3.2.1",
"stylelint": "^13.13.1",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-standard": "^22.0.0",
"ts-jest": "^26.5.6",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"ts-loader": "^9.2.4",
"ts-node": "^10.1.0",
"tsconfig-paths": "^3.10.1",
"typescript": "^4.3.5",
"url-loader": "^4.1.1",
"webpack": "^5.43.0",
"webpack": "^5.47.1",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^5.8.0"
Expand Down
11 changes: 6 additions & 5 deletions src/__tests__/credentialManager.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Configuration } from '../api/generated/configuration';

import { credentialManager } from '../api/credentialManager';
import {
credentialManager,
ServerCredential
} from '../components/credentialManager';

const serverId1 = 'f4486b851af24255b3305fe614b81f01';
const serverConfig1: Configuration = {
const serverConfig1: ServerCredential = {
apiKey: 'b49268e51af24255b3305fe614b81f01'
};

const serverId2 = 'af72hb851af24255b3305fe614b81f01';
const serverConfig2: Configuration = {
const serverConfig2: ServerCredential = {
apiKey: 'd4286b8119f24a55b3305fe614b81f01'
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { Configuration } from './generated/configuration';
export interface ServerCredential {
apiKey?: string;
accessToken?: string;
serverBasePath?: string;
}

interface CredentialStore {
[id: string]: Configuration;
[id: string]: ServerCredential;
}

export class credentialManager {
Expand All @@ -28,7 +32,7 @@ export class credentialManager {
* @returns Credentials for the provided server ID.
* or undefined if the store has no server with that ID.
*/
get(serverId: string): Configuration | undefined {
get(serverId: string): ServerCredential | undefined {
if (serverId in this.credentialStore) {
return this.credentialStore[serverId];
}
Expand All @@ -38,12 +42,12 @@ export class credentialManager {
* Update credentials for the provided server ID.
*
* @param serverId - ID of the server to update.
* @param newConfig - Updated Credentials.
* @param newCredentials - Updated Credentials.
* @returns True if the value was updated, false if it wasn't.
*/
update(serverId: string, newConfig: Configuration): boolean {
update(serverId: string, newCredentials: ServerCredential): boolean {
if (serverId in this.credentialStore) {
this.credentialStore[serverId] = newConfig;
this.credentialStore[serverId] = newCredentials;

return true;
}
Expand All @@ -55,15 +59,15 @@ export class credentialManager {
* Add a new credential to store. Only accepts new entries.
*
* @param serverId - ID of the server the credentials belong to.
* @param configuration - Credentials of the server.
* @param credentials - Credentials of the server.
* @returns True if server was added, false if it wasn't.
*/
add(serverId: string, configuration: Configuration): boolean {
add(serverId: string, credentials: ServerCredential): boolean {
if (serverId in this.credentialStore) {
return false;
}

this.credentialStore[serverId] = configuration;
this.credentialStore[serverId] = credentials;

return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/jellyfinApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export abstract class JellyfinApi {
userId: string,
accessToken: string,
serverAddress: string,
receiverName: string
receiverName = ''
): void {
console.debug(
`JellyfinApi.setServerInfo: user:${userId}, token:${accessToken}, ` +
Expand Down Expand Up @@ -58,7 +58,7 @@ export abstract class JellyfinApi {
// TODO throw error if this fails

let auth =
`Emby Client="Chromecast", Device="${this.deviceName}", ` +
`Jellyfin Client="Chromecast", Device="${this.deviceName}", ` +
`DeviceId="${this.deviceId}", Version="${this.versionNumber}"`;

if (this.userId) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/maincontroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ window.playerManager.addEventListener(
window.playerManager.addEventListener(
cast.framework.events.EventType.ENDED,
(): void => {
// Ignore
// If we're changing streams, do not report playback ended.
if ($scope.isChangingStream) {
return;
}
Expand Down Expand Up @@ -277,7 +277,7 @@ export function processMessage(data: any): void {
data.userId,
data.accessToken,
data.serverAddress,
data.receiverName || ''
data.receiverName
);

if (data.subtitleAppearance) {
Expand Down
9 changes: 3 additions & 6 deletions src/components/playbackManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
getIntros,
getNextPlaybackItemInfo,
broadcastConnectionErrorMessage,
createStreamInfo
} from '../helpers';
Expand Down Expand Up @@ -48,9 +49,9 @@ export abstract class PlaybackManager {
static isPlaying(): boolean {
return (
this.playerManager.getPlayerState() ===
cast.framework.messages.PlayerState.PLAYING ||
cast.framework.messages.PlayerState.PLAYING ||
this.playerManager.getPlayerState() ===
cast.framework.messages.PlayerState.PAUSED
cast.framework.messages.PlayerState.PAUSED
);
}

Expand All @@ -61,10 +62,6 @@ export abstract class PlaybackManager {
return this.playFromOptionsInternal(options);
}

const intros = await getIntros(firstItem);

options.items = intros.Items?.concat(options.items);

return this.playFromOptionsInternal(options);
}

Expand Down

0 comments on commit 3bb63c3

Please sign in to comment.