Merge branch 'dev' into immediate-finds
This commit is contained in:
commit
3562c8ae11
14
package.json
14
package.json
|
@ -19,16 +19,17 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node --require=./scripts/suppressExperimentalWarnings.js scripts/build/build.mjs",
|
"build": "node --require=./scripts/suppressExperimentalWarnings.js scripts/build/build.mjs",
|
||||||
"buildWeb": "node --require=./scripts/suppressExperimentalWarnings.js scripts/build/buildWeb.mjs",
|
"buildWeb": "node --require=./scripts/suppressExperimentalWarnings.js scripts/build/buildWeb.mjs",
|
||||||
|
"watch": "node --require=./scripts/suppressExperimentalWarnings.js scripts/build/build.mjs --watch",
|
||||||
"generatePluginJson": "tsx scripts/generatePluginList.ts",
|
"generatePluginJson": "tsx scripts/generatePluginList.ts",
|
||||||
|
"generateTypes": "tspc --emitDeclarationOnly --declaration --outDir packages/vencord-types",
|
||||||
"inject": "node scripts/runInstaller.mjs",
|
"inject": "node scripts/runInstaller.mjs",
|
||||||
|
"uninject": "node scripts/runInstaller.mjs",
|
||||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx --ignore-pattern src/userplugins",
|
"lint": "eslint . --ext .js,.jsx,.ts,.tsx --ignore-pattern src/userplugins",
|
||||||
"lint-styles": "stylelint \"src/**/*.css\" --ignore-pattern src/userplugins",
|
"lint-styles": "stylelint \"src/**/*.css\" --ignore-pattern src/userplugins",
|
||||||
"lint:fix": "pnpm lint --fix",
|
"lint:fix": "pnpm lint --fix",
|
||||||
"test": "pnpm build && pnpm lint && pnpm lint-styles && pnpm testTsc && pnpm generatePluginJson",
|
"test": "pnpm build && pnpm lint && pnpm lint-styles && pnpm testTsc && pnpm generatePluginJson",
|
||||||
"testWeb": "pnpm lint && pnpm buildWeb && pnpm testTsc",
|
"testWeb": "pnpm lint && pnpm buildWeb && pnpm testTsc",
|
||||||
"testTsc": "tsc --noEmit",
|
"testTsc": "tsc --noEmit"
|
||||||
"uninject": "node scripts/runInstaller.mjs",
|
|
||||||
"watch": "node --require=./scripts/suppressExperimentalWarnings.js scripts/build/build.mjs --watch"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sapphi-red/web-noise-suppressor": "0.3.3",
|
"@sapphi-red/web-noise-suppressor": "0.3.3",
|
||||||
|
@ -65,11 +66,12 @@
|
||||||
"standalone-electron-types": "^1.0.0",
|
"standalone-electron-types": "^1.0.0",
|
||||||
"stylelint": "^15.6.0",
|
"stylelint": "^15.6.0",
|
||||||
"stylelint-config-standard": "^33.0.0",
|
"stylelint-config-standard": "^33.0.0",
|
||||||
|
"ts-patch": "^3.1.2",
|
||||||
"tsx": "^3.12.7",
|
"tsx": "^3.12.7",
|
||||||
"type-fest": "^3.9.0",
|
"type-fest": "^3.9.0",
|
||||||
"typescript": "^5.0.4",
|
"typescript": "^5.4.5",
|
||||||
"zip-local": "^0.3.5",
|
"typescript-transform-paths": "^3.4.7",
|
||||||
"zustand": "^3.7.2"
|
"zip-local": "^0.3.5"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@9.1.0",
|
"packageManager": "pnpm@9.1.0",
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
|
|
7
packages/vencord-types/.gitignore
vendored
Normal file
7
packages/vencord-types/.gitignore
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
*
|
||||||
|
!.*ignore
|
||||||
|
!package.json
|
||||||
|
!*.md
|
||||||
|
!prepare.ts
|
||||||
|
!index.d.ts
|
||||||
|
!globals.d.ts
|
4
packages/vencord-types/.npmignore
Normal file
4
packages/vencord-types/.npmignore
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
node_modules
|
||||||
|
prepare.ts
|
||||||
|
.gitignore
|
||||||
|
HOW2PUB.md
|
5
packages/vencord-types/HOW2PUB.md
Normal file
5
packages/vencord-types/HOW2PUB.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# How to publish
|
||||||
|
|
||||||
|
1. run `pnpm generateTypes` in the project root
|
||||||
|
2. bump package.json version
|
||||||
|
3. npm publish
|
11
packages/vencord-types/README.md
Normal file
11
packages/vencord-types/README.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Vencord Types
|
||||||
|
|
||||||
|
Typings for Vencord's api, published to npm
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm i @vencord/types
|
||||||
|
|
||||||
|
yarn add @vencord/types
|
||||||
|
|
||||||
|
pnpm add @vencord/types
|
||||||
|
```
|
24
packages/vencord-types/globals.d.ts
vendored
Normal file
24
packages/vencord-types/globals.d.ts
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a modification for Discord's desktop app
|
||||||
|
* Copyright (c) 2022 Vendicated and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
export var VencordNative: typeof import("./VencordNative").default;
|
||||||
|
export var Vencord: typeof import("./Vencord");
|
||||||
|
}
|
||||||
|
|
||||||
|
export { };
|
5
packages/vencord-types/index.d.ts
vendored
Normal file
5
packages/vencord-types/index.d.ts
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/* eslint-disable */
|
||||||
|
|
||||||
|
/// <reference path="Vencord.d.ts" />
|
||||||
|
/// <reference path="globals.d.ts" />
|
||||||
|
/// <reference path="modules.d.ts" />
|
28
packages/vencord-types/package.json
Normal file
28
packages/vencord-types/package.json
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"name": "@vencord/types",
|
||||||
|
"private": false,
|
||||||
|
"version": "0.1.3",
|
||||||
|
"description": "",
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"prepublishOnly": "tsx ./prepare.ts",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "Vencord",
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/fs-extra": "^11.0.4",
|
||||||
|
"fs-extra": "^11.2.0",
|
||||||
|
"tsx": "^3.12.6"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@types/lodash": "^4.14.191",
|
||||||
|
"@types/node": "^18.11.18",
|
||||||
|
"@types/react": "^18.2.0",
|
||||||
|
"@types/react-dom": "^18.0.10",
|
||||||
|
"discord-types": "^1.3.26",
|
||||||
|
"standalone-electron-types": "^1.0.0",
|
||||||
|
"type-fest": "^3.5.3"
|
||||||
|
}
|
||||||
|
}
|
47
packages/vencord-types/prepare.ts
Normal file
47
packages/vencord-types/prepare.ts
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a modification for Discord's desktop app
|
||||||
|
* Copyright (c) 2023 Vendicated and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { cpSync, moveSync, readdirSync, rmSync } from "fs-extra";
|
||||||
|
import { join } from "path";
|
||||||
|
|
||||||
|
readdirSync(join(__dirname, "src"))
|
||||||
|
.forEach(child => moveSync(join(__dirname, "src", child), join(__dirname, child), { overwrite: true }));
|
||||||
|
|
||||||
|
const VencordSrc = join(__dirname, "..", "..", "src");
|
||||||
|
|
||||||
|
for (const file of ["preload.d.ts", "userplugins", "main", "debug", "src", "browser", "scripts"]) {
|
||||||
|
rmSync(join(__dirname, file), { recursive: true, force: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyDtsFiles(from: string, to: string) {
|
||||||
|
for (const file of readdirSync(from, { withFileTypes: true })) {
|
||||||
|
// bad
|
||||||
|
if (from === VencordSrc && file.name === "globals.d.ts") continue;
|
||||||
|
|
||||||
|
const fullFrom = join(from, file.name);
|
||||||
|
const fullTo = join(to, file.name);
|
||||||
|
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
copyDtsFiles(fullFrom, fullTo);
|
||||||
|
} else if (file.name.endsWith(".d.ts")) {
|
||||||
|
cpSync(fullFrom, fullTo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
copyDtsFiles(VencordSrc, __dirname);
|
1123
pnpm-lock.yaml
1123
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
2
pnpm-workspace.yaml
Normal file
2
pnpm-workspace.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
packages:
|
||||||
|
- packages/*
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * as Api from "./api";
|
export * as Api from "./api";
|
||||||
|
export * as Components from "./components";
|
||||||
export * as Plugins from "./plugins";
|
export * as Plugins from "./plugins";
|
||||||
export * as Util from "./utils";
|
export * as Util from "./utils";
|
||||||
export * as QuickCss from "./utils/quickCss";
|
export * as QuickCss from "./utils/quickCss";
|
||||||
|
|
|
@ -100,6 +100,7 @@ export async function showNotification(data: NotificationData) {
|
||||||
const n = new Notification(title, {
|
const n = new Notification(title, {
|
||||||
body,
|
body,
|
||||||
icon,
|
icon,
|
||||||
|
// @ts-expect-error ts is drunk
|
||||||
image
|
image
|
||||||
});
|
});
|
||||||
n.onclick = onClick;
|
n.onclick = onClick;
|
||||||
|
|
|
@ -16,10 +16,12 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import "./ExpandableHeader.css";
|
||||||
|
|
||||||
import { classNameFactory } from "@api/Styles";
|
import { classNameFactory } from "@api/Styles";
|
||||||
import { Text, Tooltip, useState } from "@webpack/common";
|
import { Text, Tooltip, useState } from "@webpack/common";
|
||||||
export const cl = classNameFactory("vc-expandableheader-");
|
|
||||||
import "./ExpandableHeader.css";
|
const cl = classNameFactory("vc-expandableheader-");
|
||||||
|
|
||||||
export interface ExpandableHeaderProps {
|
export interface ExpandableHeaderProps {
|
||||||
onMoreClick?: () => void;
|
onMoreClick?: () => void;
|
||||||
|
@ -31,7 +33,7 @@ export interface ExpandableHeaderProps {
|
||||||
buttons?: React.ReactNode[];
|
buttons?: React.ReactNode[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ExpandableHeader({ children, onMoreClick, buttons, moreTooltipText, defaultState = false, onDropDownClick, headerText }: ExpandableHeaderProps) {
|
export function ExpandableHeader({ children, onMoreClick, buttons, moreTooltipText, defaultState = false, onDropDownClick, headerText }: ExpandableHeaderProps) {
|
||||||
const [showContent, setShowContent] = useState(defaultState);
|
const [showContent, setShowContent] = useState(defaultState);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
18
src/components/index.ts
Normal file
18
src/components/index.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
export * from "./Badge";
|
||||||
|
export * from "./CheckedTextInput";
|
||||||
|
export * from "./CodeBlock";
|
||||||
|
export * from "./DonateButton";
|
||||||
|
export { default as ErrorBoundary } from "./ErrorBoundary";
|
||||||
|
export * from "./ErrorCard";
|
||||||
|
export * from "./ExpandableHeader";
|
||||||
|
export * from "./Flex";
|
||||||
|
export * from "./Heart";
|
||||||
|
export * from "./Icons";
|
||||||
|
export * from "./Link";
|
||||||
|
export * from "./Switch";
|
2
src/modules.d.ts
vendored
2
src/modules.d.ts
vendored
|
@ -20,7 +20,7 @@
|
||||||
/// <reference types="standalone-electron-types"/>
|
/// <reference types="standalone-electron-types"/>
|
||||||
|
|
||||||
declare module "~plugins" {
|
declare module "~plugins" {
|
||||||
const plugins: Record<string, import("@utils/types").Plugin>;
|
const plugins: Record<string, import("./utils/types").Plugin>;
|
||||||
export default plugins;
|
export default plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import { proxyLazy } from "@utils/lazy";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import { openModal } from "@utils/modal";
|
import { openModal } from "@utils/modal";
|
||||||
import { OAuth2AuthorizeModal, showToast, Toasts, UserStore, zustandCreate, zustandPersist } from "@webpack/common";
|
import { OAuth2AuthorizeModal, showToast, Toasts, UserStore, zustandCreate, zustandPersist } from "@webpack/common";
|
||||||
import type { StateStorage } from "zustand/middleware";
|
|
||||||
|
|
||||||
import { AUTHORIZE_URL, CLIENT_ID } from "../constants";
|
import { AUTHORIZE_URL, CLIENT_ID } from "../constants";
|
||||||
|
|
||||||
|
@ -23,7 +22,7 @@ interface AuthorizationState {
|
||||||
isAuthorized: () => boolean;
|
isAuthorized: () => boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const indexedDBStorage: StateStorage = {
|
const indexedDBStorage = {
|
||||||
async getItem(name: string): Promise<string | null> {
|
async getItem(name: string): Promise<string | null> {
|
||||||
return DataStore.get(name).then(v => v ?? null);
|
return DataStore.get(name).then(v => v ?? null);
|
||||||
},
|
},
|
||||||
|
@ -36,9 +35,9 @@ const indexedDBStorage: StateStorage = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Move switching accounts subscription inside the store?
|
// TODO: Move switching accounts subscription inside the store?
|
||||||
export const useAuthorizationStore = proxyLazy(() => zustandCreate<AuthorizationState>(
|
export const useAuthorizationStore = proxyLazy(() => zustandCreate(
|
||||||
zustandPersist(
|
zustandPersist(
|
||||||
(set, get) => ({
|
(set: any, get: any) => ({
|
||||||
token: null,
|
token: null,
|
||||||
tokens: {},
|
tokens: {},
|
||||||
init: () => { set({ token: get().tokens[UserStore.getCurrentUser().id] ?? null }); },
|
init: () => { set({ token: get().tokens[UserStore.getCurrentUser().id] ?? null }); },
|
||||||
|
@ -91,7 +90,7 @@ export const useAuthorizationStore = proxyLazy(() => zustandCreate<Authorization
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
isAuthorized: () => !!get().token,
|
isAuthorized: () => !!get().token,
|
||||||
}),
|
} as AuthorizationState),
|
||||||
{
|
{
|
||||||
name: "decor-auth",
|
name: "decor-auth",
|
||||||
getStorage: () => indexedDBStorage,
|
getStorage: () => indexedDBStorage,
|
||||||
|
|
|
@ -21,7 +21,7 @@ interface UserDecorationsState {
|
||||||
clear: () => void;
|
clear: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useCurrentUserDecorationsStore = proxyLazy(() => zustandCreate<UserDecorationsState>((set, get) => ({
|
export const useCurrentUserDecorationsStore = proxyLazy(() => zustandCreate((set: any, get: any) => ({
|
||||||
decorations: [],
|
decorations: [],
|
||||||
selectedDecoration: null,
|
selectedDecoration: null,
|
||||||
async fetch() {
|
async fetch() {
|
||||||
|
@ -53,4 +53,4 @@ export const useCurrentUserDecorationsStore = proxyLazy(() => zustandCreate<User
|
||||||
useUsersDecorationsStore.getState().set(UserStore.getCurrentUser().id, decoration ? decorationToAsset(decoration) : null);
|
useUsersDecorationsStore.getState().set(UserStore.getCurrentUser().id, decoration ? decorationToAsset(decoration) : null);
|
||||||
},
|
},
|
||||||
clear: () => set({ decorations: [], selectedDecoration: null })
|
clear: () => set({ decorations: [], selectedDecoration: null })
|
||||||
})));
|
} as UserDecorationsState)));
|
||||||
|
|
|
@ -30,7 +30,7 @@ interface UsersDecorationsState {
|
||||||
set: (userId: string, decoration: string | null) => void;
|
set: (userId: string, decoration: string | null) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useUsersDecorationsStore = proxyLazy(() => zustandCreate<UsersDecorationsState>((set, get) => ({
|
export const useUsersDecorationsStore = proxyLazy(() => zustandCreate((set: any, get: any) => ({
|
||||||
usersDecorations: new Map<string, UserDecorationData>(),
|
usersDecorations: new Map<string, UserDecorationData>(),
|
||||||
fetchQueue: new Set(),
|
fetchQueue: new Set(),
|
||||||
bulkFetch: debounce(async () => {
|
bulkFetch: debounce(async () => {
|
||||||
|
@ -40,7 +40,7 @@ export const useUsersDecorationsStore = proxyLazy(() => zustandCreate<UsersDecor
|
||||||
|
|
||||||
set({ fetchQueue: new Set() });
|
set({ fetchQueue: new Set() });
|
||||||
|
|
||||||
const fetchIds = Array.from(fetchQueue);
|
const fetchIds = [...fetchQueue];
|
||||||
const fetchedUsersDecorations = await getUsersDecorations(fetchIds);
|
const fetchedUsersDecorations = await getUsersDecorations(fetchIds);
|
||||||
|
|
||||||
const newUsersDecorations = new Map(usersDecorations);
|
const newUsersDecorations = new Map(usersDecorations);
|
||||||
|
@ -92,7 +92,7 @@ export const useUsersDecorationsStore = proxyLazy(() => zustandCreate<UsersDecor
|
||||||
newUsersDecorations.set(userId, { asset: decoration, fetchedAt: new Date() });
|
newUsersDecorations.set(userId, { asset: decoration, fetchedAt: new Date() });
|
||||||
set({ usersDecorations: newUsersDecorations });
|
set({ usersDecorations: newUsersDecorations });
|
||||||
}
|
}
|
||||||
})));
|
} as UsersDecorationsState)));
|
||||||
|
|
||||||
export function useUserDecorAvatarDecoration(user?: User): AvatarDecoration | null | undefined {
|
export function useUserDecorAvatarDecoration(user?: User): AvatarDecoration | null | undefined {
|
||||||
const [decorAvatarDecoration, setDecorAvatarDecoration] = useState<string | null>(user ? useUsersDecorationsStore.getState().getAsset(user.id) ?? null : null);
|
const [decorAvatarDecoration, setDecorAvatarDecoration] = useState<string | null>(user ? useUsersDecorationsStore.getState().getAsset(user.id) ?? null : null);
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { openChangeDecorationModal } from "../modals/ChangeDecorationModal";
|
||||||
|
|
||||||
const CustomizationSection = findComponentByCode(".customizationSectionBackground");
|
const CustomizationSection = findComponentByCode(".customizationSectionBackground");
|
||||||
|
|
||||||
interface DecorSectionProps {
|
export interface DecorSectionProps {
|
||||||
hideTitle?: boolean;
|
hideTitle?: boolean;
|
||||||
hideDivider?: boolean;
|
hideDivider?: boolean;
|
||||||
noMargin?: boolean;
|
noMargin?: boolean;
|
||||||
|
|
|
@ -114,6 +114,11 @@ const settings = definePluginSettings({
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
shareSong: {
|
||||||
|
description: "show link to song on last.fm",
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
hideWithSpotify: {
|
hideWithSpotify: {
|
||||||
description: "hide last.fm presence if spotify is running",
|
description: "hide last.fm presence if spotify is running",
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
|
@ -295,12 +300,7 @@ export default definePlugin({
|
||||||
large_text: trackData.album || undefined,
|
large_text: trackData.album || undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
const buttons: ActivityButton[] = [
|
const buttons: ActivityButton[] = [];
|
||||||
{
|
|
||||||
label: "View Song",
|
|
||||||
url: trackData.url,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
if (settings.store.shareUsername)
|
if (settings.store.shareUsername)
|
||||||
buttons.push({
|
buttons.push({
|
||||||
|
@ -308,6 +308,12 @@ export default definePlugin({
|
||||||
url: `https://www.last.fm/user/${settings.store.username}`,
|
url: `https://www.last.fm/user/${settings.store.username}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (settings.store.shareSong)
|
||||||
|
buttons.push({
|
||||||
|
label: "View Song",
|
||||||
|
url: trackData.url,
|
||||||
|
});
|
||||||
|
|
||||||
const statusName = (() => {
|
const statusName = (() => {
|
||||||
switch (settings.store.nameFormat) {
|
switch (settings.store.nameFormat) {
|
||||||
case NameFormat.ArtistFirst:
|
case NameFormat.ArtistFirst:
|
||||||
|
@ -333,7 +339,7 @@ export default definePlugin({
|
||||||
state: trackData.artist,
|
state: trackData.artist,
|
||||||
assets,
|
assets,
|
||||||
|
|
||||||
buttons: buttons.map(v => v.label),
|
buttons: buttons.length ? buttons.map(v => v.label) : undefined,
|
||||||
metadata: {
|
metadata: {
|
||||||
button_urls: buttons.map(v => v.url),
|
button_urls: buttons.map(v => v.url),
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import ExpandableHeader from "@components/ExpandableHeader";
|
import { ExpandableHeader } from "@components/ExpandableHeader";
|
||||||
import { proxyLazy } from "@utils/lazy";
|
import { proxyLazy } from "@utils/lazy";
|
||||||
import { classes } from "@utils/misc";
|
import { classes } from "@utils/misc";
|
||||||
import { findByProps } from "@webpack";
|
import { findByProps } from "@webpack";
|
||||||
|
|
|
@ -15,7 +15,7 @@ const DefaultEngines = {
|
||||||
DuckDuckGo: "https://duckduckgo.com/",
|
DuckDuckGo: "https://duckduckgo.com/",
|
||||||
Bing: "https://www.bing.com/search?q=",
|
Bing: "https://www.bing.com/search?q=",
|
||||||
Yahoo: "https://search.yahoo.com/search?p=",
|
Yahoo: "https://search.yahoo.com/search?p=",
|
||||||
Github: "https://github.com/search?q=",
|
GitHub: "https://github.com/search?q=",
|
||||||
Kagi: "https://kagi.com/search?q=",
|
Kagi: "https://kagi.com/search?q=",
|
||||||
Yandex: "https://yandex.com/search/?text=",
|
Yandex: "https://yandex.com/search/?text=",
|
||||||
AOL: "https://search.aol.com/aol/search?q=",
|
AOL: "https://search.aol.com/aol/search?q=",
|
||||||
|
|
|
@ -20,7 +20,7 @@ import "./style.css";
|
||||||
|
|
||||||
import { NavContextMenuPatchCallback } from "@api/ContextMenu";
|
import { NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import ExpandableHeader from "@components/ExpandableHeader";
|
import { ExpandableHeader } from "@components/ExpandableHeader";
|
||||||
import { OpenExternalIcon } from "@components/Icons";
|
import { OpenExternalIcon } from "@components/Icons";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
|
|
@ -23,9 +23,11 @@ export * from "./constants";
|
||||||
export * from "./discord";
|
export * from "./discord";
|
||||||
export * from "./guards";
|
export * from "./guards";
|
||||||
export * from "./lazy";
|
export * from "./lazy";
|
||||||
|
export * from "./lazyReact";
|
||||||
export * from "./localStorage";
|
export * from "./localStorage";
|
||||||
export * from "./Logger";
|
export * from "./Logger";
|
||||||
export * from "./margins";
|
export * from "./margins";
|
||||||
|
export * from "./mergeDefaults";
|
||||||
export * from "./misc";
|
export * from "./misc";
|
||||||
export * from "./modal";
|
export * from "./modal";
|
||||||
export * from "./onlyOnce";
|
export * from "./onlyOnce";
|
||||||
|
|
|
@ -244,7 +244,7 @@ export interface PluginSettingSliderDef {
|
||||||
stickToMarkers?: boolean;
|
stickToMarkers?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IPluginOptionComponentProps {
|
export interface IPluginOptionComponentProps {
|
||||||
/**
|
/**
|
||||||
* Run this when the value changes.
|
* Run this when the value changes.
|
||||||
*
|
*
|
||||||
|
|
|
@ -124,7 +124,8 @@ export const PermissionsBits = find<t.PermissionsBits>(m => typeof m.Permissions
|
||||||
export const zustandCreate = findByCode<typeof import("zustand").default>("will be removed in v4");
|
export const zustandCreate = findByCode<typeof import("zustand").default>("will be removed in v4");
|
||||||
|
|
||||||
const persistFilter = filters.byCode("[zustand persist middleware]");
|
const persistFilter = filters.byCode("[zustand persist middleware]");
|
||||||
export const zustandPersist = find<typeof import("zustand/middleware").persist>(m => m.persist && persistFilter(m.persist), m => m.persist);
|
export const zustandPersist = find(m => m.persist && persistFilter(m.persist), m => m.persist);
|
||||||
|
export const zustandCreate = findByCodeLazy("will be removed in v4");
|
||||||
|
|
||||||
export const MessageActions = findByProps("editMessage", "sendMessage");
|
export const MessageActions = findByProps("editMessage", "sendMessage");
|
||||||
export const UserProfileActions = findByProps("openUserProfileModal", "closeUserProfileModal");
|
export const UserProfileActions = findByProps("openUserProfileModal", "closeUserProfileModal");
|
||||||
|
|
|
@ -29,7 +29,15 @@
|
||||||
"@webpack/types": ["./webpack/common/types"],
|
"@webpack/types": ["./webpack/common/types"],
|
||||||
"@webpack/common": ["./webpack/common"],
|
"@webpack/common": ["./webpack/common"],
|
||||||
"@webpack": ["./webpack/webpack"]
|
"@webpack": ["./webpack/webpack"]
|
||||||
}
|
},
|
||||||
|
|
||||||
|
"plugins": [
|
||||||
|
// Transform paths in output .d.ts files (Include this line if you output declarations files)
|
||||||
|
{
|
||||||
|
"transform": "typescript-transform-paths",
|
||||||
|
"afterDeclarations": true
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"include": ["src/**/*", "browser/**/*", "scripts/**/*"]
|
"include": ["src/**/*", "browser/**/*", "scripts/**/*"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue