Misc Updates & Actions Updates

This commit is contained in:
thororen1234 2025-10-14 16:41:32 -04:00
parent f6a41217e2
commit 3ccead57fc
No known key found for this signature in database
15 changed files with 266 additions and 260 deletions

View file

@ -6,11 +6,12 @@ on:
env:
FORCE_COLOR: true
GITHUB_TOKEN: ${{ secrets.ETOKEN }}
GITHUB_TOKEN: ${{ github.token }}
REPO: Equicord/Equibored
USERNAME: GitHub-Actions
permissions: write-all
permissions:
contents: write
jobs:
Build:
@ -39,10 +40,10 @@ jobs:
- name: Generate plugin lists
run: |
pnpm generatePluginJson dist/plugins.json
pnpm generateEquicordPluginJson dist/equicordplugins.json
pnpm generateVencordPluginJson dist/vencordplugins.json
pnpm generateDevsList dist/devs.json
pnpm generatePluginJson dist/plugins.json
pnpm generateEquicordPluginJson dist/equicordplugins.json
pnpm generateVencordPluginJson dist/vencordplugins.json
pnpm generateDevsList dist/devs.json
- name: Collect files to be released
run: |

View file

@ -7,7 +7,8 @@ env:
FORCE_COLOR: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions: write-all
permissions:
contents: write
jobs:
Build:
@ -36,10 +37,10 @@ jobs:
- name: Generate plugin lists
run: |
pnpm generatePluginJson dist/plugins.json
pnpm generateEquicordPluginJson dist/equicordplugins.json
pnpm generateVencordPluginJson dist/vencordplugins.json
pnpm generateDevsList dist/devs.json
pnpm generatePluginJson dist/plugins.json
pnpm generateEquicordPluginJson dist/equicordplugins.json
pnpm generateVencordPluginJson dist/vencordplugins.json
pnpm generateDevsList dist/devs.json
- name: Collect files to be released
run: |

View file

@ -1,88 +1,89 @@
name: Release Browser Extension
on:
push:
branches:
- main
push:
branches:
- main
env:
FORCE_COLOR: true
permissions: write-all
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get package.json version
id: pkg
run: echo "version=v$(jq -r .version < package.json)" >> $GITHUB_OUTPUT
- name: Get package.json version
id: pkg
run: echo "version=v$(jq -r .version < package.json)" >> $GITHUB_OUTPUT
- name: Get latest Git tag
id: tag
run: |
latest_tag=$(git tag --list 'v*' --sort=-v:refname | head -n 1 || echo "v0.0.0")
echo "latest=$latest_tag" >> $GITHUB_OUTPUT
- name: Get latest Git tag
id: tag
run: |
latest_tag=$(git tag --list 'v*' --sort=-v:refname | head -n 1 || echo "v0.0.0")
echo "latest=$latest_tag" >> $GITHUB_OUTPUT
- name: Check if package.json version is newer
id: check
run: |
pkg="${{ steps.pkg.outputs.version }}"
latest="${{ steps.tag.outputs.latest }}"
- name: Check if package.json version is newer
id: check
run: |
pkg="${{ steps.pkg.outputs.version }}"
latest="${{ steps.tag.outputs.latest }}"
echo "Latest tag: $latest"
echo "Package version: $pkg"
echo "Latest tag: $latest"
echo "Package version: $pkg"
if [ "$pkg" != "$latest" ] && [ "$(sort -V <<<"$latest"$'\n'"$pkg" | tail -n1)" = "$pkg" ]; then
echo "release=true" >> $GITHUB_OUTPUT
else
echo "release=false" >> $GITHUB_OUTPUT
fi
if [ "$pkg" != "$latest" ] && [ "$(sort -V <<<"$latest"$'\n'"$pkg" | tail -n1)" = "$pkg" ]; then
echo "release=true" >> $GITHUB_OUTPUT
else
echo "release=false" >> $GITHUB_OUTPUT
fi
- name: Stop if not newer
if: steps.check.outputs.release == 'false'
run: |
echo "No new version to release (package.json ${{ steps.pkg.outputs.version }} <= latest tag ${{ steps.tag.outputs.latest }})"
exit 0
- name: Stop if not newer
if: steps.check.outputs.release == 'false'
run: |
echo "No new version to release (package.json ${{ steps.pkg.outputs.version }} <= latest tag ${{ steps.tag.outputs.latest }})"
exit 0
- name: Create Tag
if: steps.check.outputs.release == 'true'
uses: butlerlogic/action-autotag@1.1.2
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
tag_prefix: "v"
- name: Create Tag
if: steps.check.outputs.release == 'true'
uses: butlerlogic/action-autotag@1.1.2
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
tag_prefix: "v"
- name: Setup PNPM
if: steps.check.outputs.release == 'true'
uses: pnpm/action-setup@v3
- name: Setup PNPM
if: steps.check.outputs.release == 'true'
uses: pnpm/action-setup@v3
- name: Use Node.js 20
if: steps.check.outputs.release == 'true'
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Use Node.js 20
if: steps.check.outputs.release == 'true'
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
if: steps.check.outputs.release == 'true'
run: pnpm install --frozen-lockfile
- name: Install dependencies
if: steps.check.outputs.release == 'true'
run: pnpm install --frozen-lockfile
- name: Build web
if: steps.check.outputs.release == 'true'
run: pnpm buildWebStandalone
- name: Build web
if: steps.check.outputs.release == 'true'
run: pnpm buildWebStandalone
- name: Publish extension
if: steps.check.outputs.release == 'true'
run: |
cd dist/browser/chromium-unpacked
pnpx chrome-webstore-upload-cli@2.1.0 upload --auto-publish
env:
EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
- name: Publish extension
if: steps.check.outputs.release == 'true'
run: |
cd dist/browser/chromium-unpacked
pnpx chrome-webstore-upload-cli@2.1.0 upload --auto-publish
env:
EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}

View file

@ -9,8 +9,6 @@ on:
- main
- dev
permissions: write-all
jobs:
Test:
name: Test

View file

@ -31,7 +31,7 @@ export const HiddenServersStore = proxyLazyWebpack(() => {
this._hiddenGuilds.clear();
}
private save() {
public save() {
DataStore.set(DB_KEY, this._hiddenGuilds);
}

View file

@ -6,6 +6,7 @@
import { makeDummyUser } from "@components/settings/tabs/plugins/PluginModal";
import { Channel, Message } from "@vencord/discord-types";
import { proxyLazyWebpack } from "@webpack";
import { ChannelStore, lodash, Toasts, UserStore } from "@webpack/common";
import { Discord, HolyNotes } from "./types";
@ -13,197 +14,201 @@ import { deleteCacheFromDataStore, DeleteEntireStore, saveCacheToDataStore } fro
export const noteHandlerCache = new Map();
export default new (class NoteHandler {
private _formatNote(channel: Channel, message: Message): HolyNotes.Note {
return {
id: message.id,
channel_id: message.channel_id,
guild_id: channel.guild_id,
content: message.content,
author: {
id: message.author.id,
avatar: message.author.avatar,
discriminator: message.author.discriminator,
username: message.author.username,
},
flags: message.flags,
// Moment has a toString() function, this doesn't convert to '[object Object]'.
export const noteHandler = proxyLazyWebpack(() => {
class NoteHandler {
public _formatNote(channel: Channel, message: Message): HolyNotes.Note {
return {
id: message.id,
channel_id: message.channel_id,
guild_id: channel.guild_id,
content: message.content,
author: {
id: message.author.id,
avatar: message.author.avatar,
discriminator: message.author.discriminator,
username: message.author.username,
},
flags: message.flags,
// Moment has a toString() function, this doesn't convert to '[object Object]'.
timestamp: message.timestamp.toString(),
attachments: message.attachments as Discord.Attachment[],
embeds: message.embeds,
reactions: message.reactions as Discord.Reaction[],
stickerItems: message.stickerItems,
};
}
public getNotes(notebook?: string): Record<string, HolyNotes.Note> {
return noteHandlerCache.get(notebook);
}
public getAllNotes(): HolyNotes.Note[] {
const data = noteHandlerCache.entries();
const notes = {};
for (const [key, value] of data) {
notes[key] = value;
timestamp: message.timestamp.toString(),
attachments: message.attachments as Discord.Attachment[],
embeds: message.embeds,
reactions: message.reactions as Discord.Reaction[],
stickerItems: message.stickerItems,
};
}
return notes as HolyNotes.Note[];
}
public addNote = async (message: Message, notebook: string) => {
const notes = this.getNotes(notebook);
const channel = ChannelStore.getChannel(message.channel_id);
const newNotes = Object.assign({ [message.id]: this._formatNote(channel, message) }, notes);
noteHandlerCache.set(notebook, newNotes);
saveCacheToDataStore(notebook, newNotes as unknown as HolyNotes.Note[]);
Toasts.show({
id: Toasts.genId(),
message: `Successfully added note to ${notebook}.`,
type: Toasts.Type.SUCCESS,
});
};
public deleteNote = async (noteId: string, notebook: string) => {
const notes = this.getNotes(notebook);
noteHandlerCache.set(notebook, lodash.omit(notes, noteId));
saveCacheToDataStore(notebook, lodash.omit(notes, noteId) as unknown as HolyNotes.Note[]);
Toasts.show({
id: Toasts.genId(),
message: `Successfully deleted note from ${notebook}.`,
type: Toasts.Type.SUCCESS,
});
};
public moveNote = async (note: HolyNotes.Note, from: string, to: string) => {
const origNotebook = this.getNotes(from);
const newNoteBook = lodash.cloneDeep(this.getNotes(to));
newNoteBook[note.id] = note;
noteHandlerCache.set(from, lodash.omit(origNotebook, note.id));
noteHandlerCache.set(to, newNoteBook);
saveCacheToDataStore(from, lodash.omit(origNotebook, note.id) as unknown as HolyNotes.Note[]);
saveCacheToDataStore(to, newNoteBook as unknown as HolyNotes.Note[]);
Toasts.show({
id: Toasts.genId(),
message: `Successfully moved note from ${from} to ${to}.`,
type: Toasts.Type.SUCCESS,
});
};
public getNotes(notebook?: string): Record<string, HolyNotes.Note> {
return noteHandlerCache.get(notebook);
}
public newNoteBook = async (notebookName: string, silent?: Boolean) => {
let notebookExists = false;
for (const key of noteHandlerCache.keys()) {
if (key === notebookName) {
notebookExists = true;
break;
public getAllNotes(): HolyNotes.Note[] {
const data = noteHandlerCache.entries();
const notes = {};
for (const [key, value] of data) {
notes[key] = value;
}
return notes as HolyNotes.Note[];
}
if (notebookExists) {
public addNote = async (message: Message, notebook: string) => {
const notes = this.getNotes(notebook);
const channel = ChannelStore.getChannel(message.channel_id);
const newNotes = Object.assign({ [message.id]: this._formatNote(channel, message) }, notes);
noteHandlerCache.set(notebook, newNotes);
saveCacheToDataStore(notebook, newNotes as unknown as HolyNotes.Note[]);
Toasts.show({
id: Toasts.genId(),
message: `Notebook ${notebookName} already exists.`,
type: Toasts.Type.FAILURE,
message: `Successfully added note to ${notebook}.`,
type: Toasts.Type.SUCCESS,
});
return;
}
};
noteHandlerCache.set(notebookName, {});
saveCacheToDataStore(notebookName, {} as HolyNotes.Note[]);
public deleteNote = async (noteId: string, notebook: string) => {
const notes = this.getNotes(notebook);
if (!silent) return Toasts.show({
id: Toasts.genId(),
message: `Successfully created ${notebookName}.`,
type: Toasts.Type.SUCCESS,
});
};
noteHandlerCache.set(notebook, lodash.omit(notes, noteId));
saveCacheToDataStore(notebook, lodash.omit(notes, noteId) as unknown as HolyNotes.Note[]);
public deleteNotebook = async (notebookName: string) => {
noteHandlerCache.delete(notebookName);
deleteCacheFromDataStore(notebookName);
Toasts.show({
id: Toasts.genId(),
message: `Successfully deleted note from ${notebook}.`,
type: Toasts.Type.SUCCESS,
});
};
Toasts.show({
id: Toasts.genId(),
message: `Successfully deleted ${notebookName}.`,
type: Toasts.Type.SUCCESS,
});
};
public moveNote = async (note: HolyNotes.Note, from: string, to: string) => {
const origNotebook = this.getNotes(from);
const newNoteBook = lodash.cloneDeep(this.getNotes(to));
public refreshAvatars = async () => {
const notebooks = this.getAllNotes();
newNoteBook[note.id] = note;
for (const notebook in notebooks)
for (const noteId in notebooks[notebook]) {
const note = notebooks[notebook][noteId];
const user = UserStore.getUser(note.author.id) ?? makeDummyUser(note.author);
noteHandlerCache.set(from, lodash.omit(origNotebook, note.id));
noteHandlerCache.set(to, newNoteBook);
Object.assign(notebooks[notebook][noteId].author, {
avatar: user.avatar,
discriminator: user.discriminator,
username: user.username,
saveCacheToDataStore(from, lodash.omit(origNotebook, note.id) as unknown as HolyNotes.Note[]);
saveCacheToDataStore(to, newNoteBook as unknown as HolyNotes.Note[]);
Toasts.show({
id: Toasts.genId(),
message: `Successfully moved note from ${from} to ${to}.`,
type: Toasts.Type.SUCCESS,
});
};
public newNoteBook = async (notebookName: string, silent?: Boolean) => {
let notebookExists = false;
for (const key of noteHandlerCache.keys()) {
if (key === notebookName) {
notebookExists = true;
break;
}
}
if (notebookExists) {
Toasts.show({
id: Toasts.genId(),
message: `Notebook ${notebookName} already exists.`,
type: Toasts.Type.FAILURE,
});
return;
}
noteHandlerCache.set(notebookName, {});
saveCacheToDataStore(notebookName, {} as HolyNotes.Note[]);
if (!silent) return Toasts.show({
id: Toasts.genId(),
message: `Successfully created ${notebookName}.`,
type: Toasts.Type.SUCCESS,
});
};
public deleteNotebook = async (notebookName: string) => {
noteHandlerCache.delete(notebookName);
deleteCacheFromDataStore(notebookName);
Toasts.show({
id: Toasts.genId(),
message: `Successfully deleted ${notebookName}.`,
type: Toasts.Type.SUCCESS,
});
};
public refreshAvatars = async () => {
const notebooks = this.getAllNotes();
for (const notebook in notebooks)
for (const noteId in notebooks[notebook]) {
const note = notebooks[notebook][noteId];
const user = UserStore.getUser(note.author.id) ?? makeDummyUser(note.author);
Object.assign(notebooks[notebook][noteId].author, {
avatar: user.avatar,
discriminator: user.discriminator,
username: user.username,
});
}
for (const notebook in notebooks) {
noteHandlerCache.set(notebook, notebooks[notebook]);
saveCacheToDataStore(notebook, notebooks[notebook] as unknown as HolyNotes.Note[]);
}
Toasts.show({
id: Toasts.genId(),
message: "Successfully refreshed avatars.",
type: Toasts.Type.SUCCESS,
});
};
public deleteEverything = async () => {
noteHandlerCache.clear();
await DeleteEntireStore();
Toasts.show({
id: Toasts.genId(),
message: "Successfully deleted all notes.",
type: Toasts.Type.SUCCESS,
});
};
public exportNotes = async () => {
return this.getAllNotes();
};
public importNotes = async (notes: HolyNotes.Note[]) => {
try {
var parseNotes = JSON.parse(notes as unknown as string);
} catch (e) {
console.log(e);
return Toasts.show({
id: Toasts.genId(),
message: "Invalid JSON.",
type: Toasts.Type.FAILURE,
});
}
for (const notebook in notebooks) {
noteHandlerCache.set(notebook, notebooks[notebook]);
saveCacheToDataStore(notebook, notebooks[notebook] as unknown as HolyNotes.Note[]);
}
for (const notebook in parseNotes) {
noteHandlerCache.set(notebook, parseNotes[notebook]);
saveCacheToDataStore(notebook, parseNotes[notebook] as unknown as HolyNotes.Note[]);
}
Toasts.show({
id: Toasts.genId(),
message: "Successfully refreshed avatars.",
type: Toasts.Type.SUCCESS,
});
};
public deleteEverything = async () => {
noteHandlerCache.clear();
await DeleteEntireStore();
Toasts.show({
id: Toasts.genId(),
message: "Successfully deleted all notes.",
type: Toasts.Type.SUCCESS,
});
};
public exportNotes = async () => {
return this.getAllNotes();
};
public importNotes = async (notes: HolyNotes.Note[]) => {
try {
var parseNotes = JSON.parse(notes as unknown as string);
} catch (e) {
console.log(e);
return Toasts.show({
Toasts.show({
id: Toasts.genId(),
message: "Invalid JSON.",
type: Toasts.Type.FAILURE,
message: "Successfully imported notes.",
type: Toasts.Type.SUCCESS,
});
}
for (const notebook in parseNotes) {
noteHandlerCache.set(notebook, parseNotes[notebook]);
saveCacheToDataStore(notebook, parseNotes[notebook] as unknown as HolyNotes.Note[]);
}
};
}
Toasts.show({
id: Toasts.genId(),
message: "Successfully imported notes.",
type: Toasts.Type.SUCCESS,
});
};
return new NoteHandler();
});

View file

@ -10,7 +10,7 @@ import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, M
import { findByProps } from "@webpack";
import { Button } from "@webpack/common";
import noteHandler from "../../NoteHandler";
import { noteHandler } from "../../NoteHandler";
import { downloadNotes, uploadNotes } from "../../utils";
export default ({ onClose, ...modalProps }: ModalProps & { onClose: () => void; }) => {

View file

@ -11,7 +11,7 @@ import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, M
import { findByProps } from "@webpack";
import { ContextMenuApi, Flex, FluxDispatcher, Menu, React, TextInput } from "@webpack/common";
import noteHandler from "../../NoteHandler";
import { noteHandler } from "../../NoteHandler";
import { HolyNotes } from "../../types";
import HelpIcon from "../icons/HelpIcon";
import Errors from "./Error";

View file

@ -8,7 +8,7 @@ import { HeadingSecondary } from "@components/Heading";
import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize } from "@utils/modal";
import { Button, React, TextInput } from "@webpack/common";
import noteHandler from "../../NoteHandler";
import { noteHandler } from "../../NoteHandler";
export default (props: ModalProps & { onClose: () => void; }) => {
const [notebookName, setNotebookName] = React.useState("");

View file

@ -9,7 +9,7 @@ import { HeadingSecondary } from "@components/Heading";
import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize } from "@utils/modal";
import { Button, React } from "@webpack/common";
import noteHandler from "../../NoteHandler";
import { noteHandler } from "../../NoteHandler";
import Error from "./Error";
import { RenderMessage } from "./RenderMessage";

View file

@ -12,7 +12,7 @@ import { ModalProps } from "@utils/modal";
import { findByCodeLazy, findByProps, findComponentByCodeLazy } from "@webpack";
import { ContextMenuApi, FluxDispatcher, Menu, NavigationRouter, React } from "@webpack/common";
import noteHandler from "../../NoteHandler";
import { noteHandler } from "../../NoteHandler";
import { HolyNotes } from "../../types";
export const RenderMessage = ({

View file

@ -32,7 +32,7 @@ import { ChannelStore, Menu } from "@webpack/common";
import { Popover as NoteButtonPopover, Popover } from "./components/icons/NoteButton";
import { NoteModal } from "./components/modals/Notebook";
import noteHandler, { noteHandlerCache } from "./NoteHandler";
import { noteHandler, noteHandlerCache } from "./NoteHandler";
import { DataStoreToCache, HolyNoteStore } from "./utils";
export const MessageType = findByCodeLazy("isEdited(){");

View file

@ -8,7 +8,7 @@ import { createStore } from "@api/DataStore";
import { DataStore } from "@api/index";
import { Toasts } from "@webpack/common";
import noteHandler, { noteHandlerCache } from "./NoteHandler";
import { noteHandler, noteHandlerCache } from "./NoteHandler";
import { HolyNotes } from "./types";
export const HolyNoteStore = createStore("HolyNoteData", "HolyNoteStore");

View file

@ -149,7 +149,7 @@ export const TidalStore = proxyLazyWebpack(() => {
public repeat: Repeat = 0;
public shuffle = false;
public volume = 100;
private playerElement: HTMLElement | null = null;
public playerElement: HTMLElement | null = null;
public socket = new TidalSocket((message: Message) => {
if (message.type === "update" && message.all && message.fields) {
const apiData = message.fields;

View file

@ -110,7 +110,7 @@ type Message = PlayerInfo | VideoChanged | PlayerStateChanged | PositionChanged
type PlayerState = Partial<Omit<PlayerInfo, "type">>;
class YoutubemusicSocket {
class YoutubeMusicSocket {
public onChange: (e: PlayerState) => void;
private ready = false;
private connecting = false;
@ -185,7 +185,7 @@ export const YoutubeMusicStore = proxyLazyWebpack(() => {
class YoutubeMusicStore extends Store {
public mPosition = 0;
private start = 0;
public start = 0;
public song: Song | null = null;
public isPlaying = false;
@ -196,7 +196,7 @@ export const YoutubeMusicStore = proxyLazyWebpack(() => {
public isSettingPosition = false;
public socket = new YoutubemusicSocket((message: PlayerState) => {
public socket = new YoutubeMusicSocket((message: PlayerState) => {
if (message.song) {
store.song = message.song;
store.isPlaying = !(message.song?.isPaused ?? false);
@ -280,7 +280,7 @@ export const YoutubeMusicStore = proxyLazyWebpack(() => {
this.req("post", "/api/v1/toggle-mute");
}
private req(method: "post" | "get" | "put", route: string, data: any = {}) {
public req(method: "post" | "get" | "put", route: string, data: any = {}) {
const apiServerUrl = Settings.plugins.MusicControls.YoutubeMusicApiUrl;
if (apiServerUrl === "") return;
const url = apiServerUrl + route;