Pr Stuff
Some checks failed
Release / Build Equicord (push) Has been cancelled
Sync to Codeberg / Sync Codeberg and Github (push) Has been cancelled
Test / Test (push) Has been cancelled

Co-Authored-By: sadan4 <117494111+sadan4@users.noreply.github.com>
This commit is contained in:
thororen1234 2025-03-05 23:01:08 -05:00
parent 8c2bfea5c0
commit 4f72832ba1
No known key found for this signature in database
7 changed files with 50 additions and 7 deletions

View file

@ -158,6 +158,30 @@ export interface Clipboard {
SUPPORTS_COPY: boolean;
}
export interface ApplicationAssets {
lastUpdated: number;
assets: Record<string, { id: string; name: string; type: number; } & Record<string, any>>;
}
export interface ApplicationAssetUtils {
fetchAssetIds(applicationId: string, e: string[]): Promise<string[]>;
/**
* mp === media proxy
*/
getAssetFromImageURL(type: "mp" | "youtube" | "spotify" | "twitch", url: string): string;
/**
* converts an asset string into an image url
* @param applicationId the application id if fetching an application asset
* @param asset asset id if fetching an application asset, otherwise something like what {@link getAssetFromImageURL} returns
* @param size if width and height are not needed, the largest is used. If omitted, no size is used
*/
getAssetImage(applicationId: string | undefined, assetId: string, size?: number | [width: number, height: number]): undefined | string;
/**
* @returns assets or undefined
*/
getAssets(applicationId: string): Promise<undefined | ApplicationAssets>;
}
export interface NavigationRouter {
back(): void;
forward(): void;

View file

@ -144,9 +144,12 @@ export const UploadHandler = {
promptToUpload: findByCodeLazy("#{intl::ATTACHMENT_TOO_MANY_ERROR_TITLE}") as (files: File[], channel: Channel, draftType: Number) => void
};
export const ApplicationAssetUtils = findByPropsLazy("fetchAssetIds", "getAssetImage") as {
fetchAssetIds: (applicationId: string, e: string[]) => Promise<string[]>;
};
export const ApplicationAssetUtils: t.ApplicationAssetUtils = mapMangledModuleLazy("getAssetImage: size must === [", {
fetchAssetIds: filters.byCode('.startsWith("http:")', ".dispatch({"),
getAssetFromImageURL: filters.byCode("].serialize(", ',":"'),
getAssetImage: filters.byCode("getAssetImage: size must === ["),
getAssets: filters.byCode(".assets")
});
export const Clipboard: t.Clipboard = mapMangledModuleLazy('queryCommandEnabled("copy")', {
copy: filters.byCode(".copy("),