This commit is contained in:
thororen 2024-04-27 10:54:30 -04:00
parent 86d6fc60ab
commit 8268f70518

View file

@ -25,13 +25,12 @@ import definePlugin, { OptionType } from "@utils/types";
import style from "./index.css?managed";
const API_URL = "https://usrbg.is-hardly.online/users";
const cachebust = Date.now();
interface UsrbgApiReturn {
endpoint: string;
bucket: string;
prefix: string;
users: string[];
users: { [id: string]: string; };
}
const settings = definePluginSettings({
@ -122,7 +121,7 @@ export default definePlugin({
userHasBackground(userId: string) {
if (this.data === null) return false;
return this.data.users.includes(userId);
return this.data.users[userId] !== undefined;
},
getImageUrl(userId: string): string | null {
@ -130,8 +129,13 @@ export default definePlugin({
return null;
}
const etag = this.data.users[userId];
if (etag === undefined) {
return null;
}
const { endpoint, bucket, prefix } = this.data;
return `${endpoint}/${bucket}/${prefix}${userId}?${cachebust}`;
return `${endpoint}/${bucket}/${prefix}${userId}?${etag}`;
},
async start() {