mirror of
https://github.com/LBRYFoundation/Watch-on-LBRY.git
synced 2025-08-23 17:47:26 +00:00
Updated variable name
- source/target platfrom setthing variable and the type had the same name
This commit is contained in:
parent
8f30825edd
commit
6b4a377058
3 changed files with 9 additions and 9 deletions
|
@ -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',
|
||||
|
@ -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][]
|
||||
}
|
||||
|
||||
|
||||
|
@ -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: {
|
||||
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
@ -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}`)
|
||||
|
@ -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')
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue