Skip to content
This repository was archived by the owner on Oct 9, 2024. It is now read-only.

Commit b498174

Browse files
committed
feat(composables): ✨ add usePluginRelease
1 parent 03b31c1 commit b498174

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

composables/usePluginRelease.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import {PluginMeta} from "~/stores/plugins";
2+
3+
export interface PluginRelease {
4+
schema_version: 5;
5+
id: string;
6+
latest_version: string;
7+
releases: ReleaseMetaGitHub[];
8+
release_meta: {
9+
[key: string]: PluginMeta;
10+
}
11+
}
12+
13+
export interface ReleaseMetaGitHub {
14+
url: string;
15+
name: string;
16+
tag_name: string;
17+
created_at: string;
18+
assets: ReleaseMetaGitHubAsset[];
19+
description: string;
20+
prerelease: boolean;
21+
parsed_version: string;
22+
}
23+
24+
export interface ReleaseMetaGitHubAsset {
25+
name: string;
26+
size: number;
27+
download_count: number;
28+
created_at: string;
29+
browser_download_url: string;
30+
}
31+
32+
export const usePluginRelease = async (id: string): Promise<{ release: PluginRelease }> => {
33+
const release: PluginRelease = await $fetch(`https://raw.githubusercontent.com/MCDReforged/PluginCatalogue/meta/${id}/release.json`);
34+
return {release};
35+
};

0 commit comments

Comments
 (0)