diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml deleted file mode 100644 index 71666c9..0000000 --- a/.github/workflows/contributors.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Add contributors -on: - schedule: - - cron: '20 20 * * *' - push: - branches: - - master - -jobs: - add-contributors: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: BobAnkh/add-contributors@master - with: - CONTRIBUTOR: '## Contributors' - COLUMN_PER_ROW: '6' - ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}} - IMG_WIDTH: '100' - FONT_SIZE: '14' - PATH: '/README.md' - COMMIT_MESSAGE: 'docs(README): update contributors' - AVATAR_SHAPE: 'round' diff --git a/src/assets/icons/wol/icon128.png b/src/assets/icons/wol/icon128.png index 525efe9..b75239f 100644 Binary files a/src/assets/icons/wol/icon128.png and b/src/assets/icons/wol/icon128.png differ diff --git a/src/assets/icons/wol/icon16.png b/src/assets/icons/wol/icon16.png index 48a46f6..4b76645 100644 Binary files a/src/assets/icons/wol/icon16.png and b/src/assets/icons/wol/icon16.png differ diff --git a/src/assets/icons/wol/icon48.png b/src/assets/icons/wol/icon48.png index 1abb364..adb2123 100644 Binary files a/src/assets/icons/wol/icon48.png and b/src/assets/icons/wol/icon48.png differ diff --git a/src/assets/styles/common.css b/src/assets/styles/common.css index bf219fb..816f217 100644 --- a/src/assets/styles/common.css +++ b/src/assets/styles/common.css @@ -1,6 +1,6 @@ :root { - --color-master: #499375; - --color-slave: #43889d; + --color-master: #cf3352; + --color-slave: #f77937; --color-error: rgb(245, 81, 69); --color-gradient-0: linear-gradient(130deg, var(--color-master), var(--color-slave)); --color-gradient-1: linear-gradient(130deg, #ff7a18, #af002d 41.07%, #319197 76.05%); diff --git a/src/modules/yt/urlResolve.ts b/src/modules/yt/urlResolve.ts index 212108e..d6a1c7c 100644 --- a/src/modules/yt/urlResolve.ts +++ b/src/modules/yt/urlResolve.ts @@ -1,7 +1,6 @@ import { chunk } from "lodash" import path from "path" import { getExtensionSettingsAsync, ytUrlResolversSettings } from "../../settings" -import { sign } from "../crypto" import { lbryUrlCache } from "./urlCache" const QUERY_CHUNK_SIZE = 100 @@ -18,7 +17,7 @@ interface ApiResponse { } export async function resolveById(params: Paramaters, progressCallback?: (progress: number) => void): Promise { - const { urlResolver: urlResolverSettingName, privateKey, publicKey } = await getExtensionSettingsAsync() + const { urlResolver: urlResolverSettingName } = await getExtensionSettingsAsync() const urlResolverSetting = ytUrlResolversSettings[urlResolverSettingName] async function requestChunk(params: Paramaters) { @@ -46,11 +45,6 @@ export async function resolveById(params: Paramaters, progressCallback?: (progre url.pathname = path.join(url.pathname, '/resolve') url.searchParams.set('video_ids', params.filter((item) => item.type === 'video').map((item) => item.id).join(',')) url.searchParams.set('channel_ids', params.filter((item) => item.type === 'channel').map((item) => item.id).join(',')) - if (urlResolverSetting.signRequest && publicKey && privateKey) - url.searchParams.set('keys', JSON.stringify({ - signature: await sign(url.searchParams.toString(), privateKey), - publicKey - })) const apiResponse = await fetch(url.toString(), { cache: 'no-store' }) if (apiResponse.ok) { diff --git a/src/pages/popup/main.tsx b/src/pages/popup/main.tsx index 41bc743..01dc12f 100644 --- a/src/pages/popup/main.tsx +++ b/src/pages/popup/main.tsx @@ -1,23 +1,14 @@ import { h, render } from 'preact' import { useState } from 'preact/hooks' import { createDialogManager, Dialogs } from '../../components/dialogs' -import { exportProfileKeysAsFile, friendlyPublicKey, generateProfileAndSetNickname, getProfile, purgeProfile, resetProfileSettings } from '../../modules/crypto' import { lbryUrlCache } from '../../modules/yt/urlCache' -import { getTargetPlatfromSettingsEntiries, getYtUrlResolversSettingsEntiries, setExtensionSetting, useExtensionSettings } from '../../settings' -import { openImportPopup } from '../import/main' +import { setExtensionSetting, targetPlatformSettings, useExtensionSettings } from '../../settings' - -/** Gets all the options for redirect destinations as selection options */ -const targetPlatforms = getTargetPlatfromSettingsEntiries() -const ytUrlResolverOptions = getYtUrlResolversSettingsEntiries() - -function WatchOnLbryPopup(params: { profile: Awaited> | null }) { - const { redirect, targetPlatform, urlResolver, privateKey, publicKey } = useExtensionSettings() +function WatchOnLbryPopup(params: {}) { + const { redirect } = useExtensionSettings() let [loading, updateLoading] = useState(() => false) - let [route, updateRoute] = useState(() => null) const dialogManager = createDialogManager() - const nickname = params.profile ? params.profile.nickname ?? 'No Nickname' : '...' async function loads(operation: Promise) { @@ -35,151 +26,38 @@ function WatchOnLbryPopup(params: { profile: Awaited { - publicKey - ?
-
- -

{friendlyPublicKey(publicKey)}

- Score: {params.profile?.score ?? '...'} - 🔗Leaderboard - {urlResolver !== 'madiatorFinder' && You need to use Madiator Finder API for scoring to work} -
-
- { - route === 'profile' - ? updateRoute('')} className="filled">⇐ Back - : updateRoute('profile')} href="#profile">Profile Settings - } -
-
- :
- { - route === 'profile' - ? updateRoute('')} className="filled">⇐ Back - : updateRoute('profile')} href="#profile">Profile Settings - } -
+
+
+ + +
+
} { - route === 'profile' ? - publicKey ? -
-
- -
-
- -

Import and export your unique keypair.

- -
-
- -

Purge your profile data online and offline.

- -
-
- -

Generate a new keypair.

- -
-
- : -
-
- -

You can either import keypair for an existing profile or generate a new profile keypair.

- -
-
- : -
-
- - -
-
- - -
-
- - - loads(lbryUrlCache.clearAll().then(() => dialogManager.alert("Cleared Cache!")))} className={`button active`}> - Clear Resolver Cache +
+
+ +
-
- - - Subscription Converter + setExtensionSetting('redirect', false)} className={`button ${redirect ? '' : 'active'}`}> + Show a button -
-
+ +
+
+ loads(lbryUrlCache.clearAll().then(() => dialogManager.alert("Cleared Cache!")))} className={`button active`}> + Clear Resolver Cache + +
+
+ + + Subscription Converter + +
+
} {loading &&
Loading... @@ -188,8 +66,7 @@ function WatchOnLbryPopup(params: { profile: Awaited, document.getElementById('root')!) - getProfile().then((profile) => render(, document.getElementById('root')!)) + render(, document.getElementById('root')!) } renderPopup() diff --git a/src/pages/popup/style.css b/src/pages/popup/style.css index bb6f577..09cceb0 100644 --- a/src/pages/popup/style.css +++ b/src/pages/popup/style.css @@ -8,6 +8,10 @@ header { justify-items: center; } +#logo { + width: 5em; +} + main { display: grid; gap: 2em; diff --git a/src/scripts/ytContent.tsx b/src/scripts/ytContent.tsx index a986107..b4addad 100644 --- a/src/scripts/ytContent.tsx +++ b/src/scripts/ytContent.tsx @@ -143,23 +143,7 @@ async function requestResolveById(...params: Parameters): Re videoElement.pause() }) - if (platfrom === targetPlatformSettings.app) { - if (document.hidden) await new Promise((resolve) => document.addEventListener('visibilitychange', resolve, { once: true })) - - // On redirect with app, people might choose to cancel browser's dialog - // So we dont destroy the current window automatically for them - // And also we are keeping the same window for less distiraction - if (settings.redirect) { - location.replace(url.toString()) - } - else { - open(url.toString(), '_blank') - if (window.history.length === 1) window.close() - else window.history.back() - } - } - else - location.replace(url.toString()) + location.replace(url.toString()) } let removeVideoTimeUpdateListener: (() => void) | null = null diff --git a/src/settings/index.ts b/src/settings/index.ts index d2d8bc5..ac70dc4 100644 --- a/src/settings/index.ts +++ b/src/settings/index.ts @@ -5,16 +5,12 @@ export interface ExtensionSettings { redirect: boolean targetPlatform: TargetPlatformName urlResolver: YTUrlResolverName - publicKey: string | null, - privateKey: string | null } export const DEFAULT_SETTINGS: ExtensionSettings = { redirect: true, targetPlatform: 'odysee', - urlResolver: 'odyseeApi', - privateKey: null, - publicKey: null + urlResolver: 'odyseeApi' } export function getExtensionSettingsAsync(): Promise { @@ -74,19 +70,6 @@ export const getTargetPlatfromSettingsEntiries = () => { return Object.entries(targetPlatformSettings) as any as [Extract, TargetPlatform][] } export const targetPlatformSettings = { - 'madiator.com': targetPlatform({ - domainPrefix: 'https://madiator.com/', - displayName: 'Madiator.com', - theme: 'linear-gradient(130deg, #499375, #43889d)', - button: { - text: 'Watch on', - icon: chrome.runtime.getURL('assets/icons/lbry/madiator-logo.svg'), - style: { - button: { flexDirection: 'row-reverse' }, - icon: { transform: 'scale(1.2)' } - } - } - }), odysee: targetPlatform({ domainPrefix: 'https://odysee.com/', displayName: 'Odysee', @@ -95,16 +78,7 @@ export const targetPlatformSettings = { text: 'Watch on Odysee', icon: chrome.runtime.getURL('assets/icons/lbry/odysee-logo.svg') } - }), - app: targetPlatform({ - domainPrefix: 'lbry://', - displayName: 'LBRY App', - theme: 'linear-gradient(130deg, #499375, #43889d)', - button: { - text: 'Watch on LBRY', - icon: chrome.runtime.getURL('assets/icons/lbry/lbry-logo.svg') - } - }), + }) } @@ -125,19 +99,19 @@ export function getSourcePlatfromSettingsFromHostname(hostname: string) { return null } export const sourcePlatfromSettings = { - "yewtu.be": sourcePlatform({ - hostnames: ['yewtu.be', 'vid.puffyan.us', 'invidio.xamh.de', 'invidious.kavin.rocks'], - htmlQueries: { - mountButtonBefore: '#watch-on-youtube', - videoPlayer: '#player-container video' - } - }), "youtube.com": sourcePlatform({ hostnames: ['www.youtube.com'], htmlQueries: { mountButtonBefore: 'ytd-video-owner-renderer~#subscribe-button', videoPlayer: '#ytd-player video' } + }), + "yewtu.be": sourcePlatform({ + hostnames: ['yewtu.be', 'vid.puffyan.us', 'invidio.xamh.de', 'invidious.kavin.rocks'], + htmlQueries: { + mountButtonBefore: '#watch-on-youtube', + videoPlayer: '#player-container video' + } }) } @@ -154,15 +128,5 @@ export const ytUrlResolversSettings = { name: "Odysee", href: "https://api.odysee.com/yt", signRequest: false - }), - madiatorFinder: ytUrlResolver({ - name: "Madiator Finder", - href: "https://finder.madiator.com/api/v1", - signRequest: true - }), - /* madiatorFinderLocal: ytUrlResolver({ - name: "Madiator Finder Local", - href: "http://127.0.0.1:3001/api/v1", - signRequest: true - }) */ + }) } \ No newline at end of file