Skip to content

Commit

Permalink
deploy: e587ea1
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowsink committed Jun 29, 2024
1 parent d6af149 commit 861919d
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 404.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ No Devtools Detection: https://yellowsink.github.io/shelter-plugins/no-devtools-
- Prevents the annoying "Wait" and "Hold Up" logs
- Prevents you from being logged out of your session if you reload with the devtools open,
or if you use a browser with vertical tabs, being logged out every single session!

usrbg: https://yellowsink.github.io/shelter-plugins/usrbg
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ No Devtools Detection: https://yellowsink.github.io/shelter-plugins/no-devtools-
- Prevents the annoying "Wait" and "Hold Up" logs
- Prevents you from being logged out of your session if you reload with the devtools open,
or if you use a browser with vertical tabs, being logged out every single session!

usrbg: https://yellowsink.github.io/shelter-plugins/usrbg
42 changes: 42 additions & 0 deletions usrbg/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
(() => {
// plugins/usrbg/index.tsx
var {
flux: {
subscribe
},
observeDom
} = shelter.plugin.scoped;
var {
getFiber,
reactFiberWalker
} = shelter.util;
var dbUrl = `https://cdn.jsdelivr.net/gh/Discord-Custom-Covers/usrbg@63fbbbe59880e284ff84d881c2f35413d5d5ae80/dist/usrbg.json`;
var db = fetch(dbUrl).then((r) => r.json()).then((raw) => {
const m = /* @__PURE__ */ new Map();
for (const o of raw)
m.set(o.uid, o.img);
return m;
});
["TRACK"].forEach((t) => subscribe(t, onDispatch));
function onDispatch(payload) {
if (payload.type === "TRACK" && payload.event !== "user_profile_action")
return;
const unobs = observeDom(`svg > foreignObject > [class*=banner]`, async (e) => {
unobs();
if (e.matches("[class*=bannerPremium]"))
return;
const user = reactFiberWalker(getFiber(e), "displayProfile", true)?.memoizedProps?.user;
if (!user)
return;
const usrbg = (await db).get(user?.id);
if (!usrbg)
return;
Object.assign(e.style, {
"background-repeat": "no-repeat",
"background-position": "center",
"background-size": "cover",
"background-image": `url(${usrbg})`
});
});
}
})();
1 change: 1 addition & 0 deletions usrbg/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"usrbg","author":"Yellowsink","description":"Loads usrbgs in an efficient and stable manner.","hash":"44455658f813b3198255758612baed6c"}

0 comments on commit 861919d

Please sign in to comment.