Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated variable name #76

Merged
merged 1 commit into from
Dec 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/common/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface TargetPlatformSettings {
theme: string
}

export const TargetPlatformSettings: Record<TargetPlatformName, TargetPlatformSettings> = {
export const targetPlatformSettings: Record<TargetPlatformName, TargetPlatformSettings> = {
'madiator.com': {
domainPrefix: 'https://madiator.com/',
displayName: 'Madiator.com',
Expand All @@ -37,7 +37,7 @@ export const TargetPlatformSettings: Record<TargetPlatformName, TargetPlatformSe
};

export const getTargetPlatfromSettingsEntiries = () => {
return Object.entries(TargetPlatformSettings) as any as [Extract<keyof typeof TargetPlatformSettings, string>, TargetPlatformSettings][]
return Object.entries(targetPlatformSettings) as any as [Extract<keyof typeof targetPlatformSettings, string>, TargetPlatformSettings][]
}


Expand All @@ -51,7 +51,7 @@ export interface SourcePlatfromSettings {
}
}

export const SourcePlatfromSettings: Record<SourcePlatfromName, SourcePlatfromSettings> = {
export const sourcePlatfromSettings: Record<SourcePlatfromName, SourcePlatfromSettings> = {
"yewtu.be": {
hostnames: ['yewtu.be'],
htmlQueries: {
Expand All @@ -69,7 +69,7 @@ export const SourcePlatfromSettings: Record<SourcePlatfromName, SourcePlatfromSe
}

export function getSourcePlatfromSettingsFromHostname(hostname: string) {
const values = Object.values(SourcePlatfromSettings)
const values = Object.values(sourcePlatfromSettings)
for (const settings of values)
if (settings.hostnames.includes(hostname)) return settings
return null
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/ytContent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getSourcePlatfromSettingsFromHostname, TargetPlatformName, TargetPlatformSettings } from '../common/settings'
import { getSourcePlatfromSettingsFromHostname, TargetPlatformName, targetPlatformSettings } from '../common/settings'
import type { UpdateContext } from '../scripts/tabOnUpdated'
import { h, JSX, render } from 'preact'

Expand Down Expand Up @@ -44,7 +44,7 @@ interface ButtonParameters

export function WatchOnLbryButton({ targetPlatform = 'app', lbryPathname, time }: ButtonParameters = {}) {
if (!lbryPathname || !targetPlatform) return null;
const targetPlatformSetting = TargetPlatformSettings[targetPlatform];
const targetPlatformSetting = targetPlatformSettings[targetPlatform];
const buttonSetting = buttonSettings[targetPlatform];

const url = new URL(`${targetPlatformSetting.domainPrefix}${lbryPathname}`)
Expand Down Expand Up @@ -137,7 +137,7 @@ function redirectTo({ targetPlatform, lbryPathname }: UpdateContext): void {
return total.toString()
}

const targetPlatformSetting = TargetPlatformSettings[targetPlatform];
const targetPlatformSetting = targetPlatformSettings[targetPlatform];
const url = new URL(`${targetPlatformSetting.domainPrefix}${lbryPathname}`)
const time = new URL(location.href).searchParams.get('t')

Expand Down
4 changes: 2 additions & 2 deletions src/tools/YTtoLBRY.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { h, render } from 'preact'
import { useState } from 'preact/hooks'
import { getExtensionSettingsAsync, TargetPlatformSettings } from '../common/settings'
import { getExtensionSettingsAsync, targetPlatformSettings } from '../common/settings'
import { getFileContent, ytService } from '../common/yt'
import readme from './README.md'

Expand All @@ -21,7 +21,7 @@ async function lbryChannelsFromFile(file: File) {
ytService.readJson)(await getFileContent(file)))
const lbryUrls = await ytService.resolveById(...Array.from(ids).map(id => ({ id, type: 'channel' } as const)));
const { targetPlatform: platform } = await getExtensionSettingsAsync('targetPlatform');
const urlPrefix = TargetPlatformSettings[platform].domainPrefix;
const urlPrefix = targetPlatformSettings[platform].domainPrefix;
return lbryUrls.map(channel => urlPrefix + channel);
}

Expand Down