This commit is contained in:
parent
b480f165ea
commit
c867c57a26
2 changed files with 5 additions and 16 deletions
|
@ -171,10 +171,7 @@ function buildActivityHTML(activity) {
|
||||||
? `<div class="activity-buttons">
|
? `<div class="activity-buttons">
|
||||||
${activity.buttons
|
${activity.buttons
|
||||||
.map((button, index) => {
|
.map((button, index) => {
|
||||||
const label =
|
const label = typeof button === "string" ? button : button.label;
|
||||||
typeof button === "string"
|
|
||||||
? button
|
|
||||||
: button.label;
|
|
||||||
let url = null;
|
let url = null;
|
||||||
if (typeof button === "object" && button.url) {
|
if (typeof button === "object" && button.url) {
|
||||||
url = button.url;
|
url = button.url;
|
||||||
|
@ -321,9 +318,7 @@ async function populateReadme(data) {
|
||||||
if (readmeSection && data.kv?.readme) {
|
if (readmeSection && data.kv?.readme) {
|
||||||
const url = data.kv.readme;
|
const url = data.kv.readme;
|
||||||
try {
|
try {
|
||||||
const res = await fetch(
|
const res = await fetch(`/api/readme?url=${encodeURIComponent(url)}`);
|
||||||
`/api/readme?url=${encodeURIComponent(url)}`,
|
|
||||||
);
|
|
||||||
if (!res.ok) throw new Error("Failed to fetch readme");
|
if (!res.ok) throw new Error("Failed to fetch readme");
|
||||||
|
|
||||||
const text = await res.text();
|
const text = await res.text();
|
||||||
|
@ -343,9 +338,7 @@ async function updatePresence(data) {
|
||||||
const cssLink = data.kv?.css;
|
const cssLink = data.kv?.css;
|
||||||
if (cssLink) {
|
if (cssLink) {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(
|
const res = await fetch(`/api/css?url=${encodeURIComponent(cssLink)}`);
|
||||||
`/api/css?url=${encodeURIComponent(cssLink)}`,
|
|
||||||
);
|
|
||||||
if (!res.ok) throw new Error("Failed to fetch CSS");
|
if (!res.ok) throw new Error("Failed to fetch CSS");
|
||||||
|
|
||||||
const cssText = await res.text();
|
const cssText = await res.text();
|
||||||
|
|
|
@ -49,10 +49,7 @@ async function fetchAndCacheReadme(url: string): Promise<string | null> {
|
||||||
if (!res.ok) return null;
|
if (!res.ok) return null;
|
||||||
|
|
||||||
if (res.headers.has("content-length")) {
|
if (res.headers.has("content-length")) {
|
||||||
const size = Number.parseInt(
|
const size = Number.parseInt(res.headers.get("content-length") || "0", 10);
|
||||||
res.headers.get("content-length") || "0",
|
|
||||||
10,
|
|
||||||
);
|
|
||||||
if (size > 1024 * 100) return null;
|
if (size > 1024 * 100) return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,8 +104,7 @@ async function handler(request: ExtendedRequest): Promise<Response> {
|
||||||
return new Response(safe, {
|
return new Response(safe, {
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "text/html; charset=utf-8",
|
"Content-Type": "text/html; charset=utf-8",
|
||||||
"Cache-Control":
|
"Cache-Control": "no-store, no-cache, must-revalidate, proxy-revalidate",
|
||||||
"no-store, no-cache, must-revalidate, proxy-revalidate",
|
|
||||||
Pragma: "no-cache",
|
Pragma: "no-cache",
|
||||||
Expires: "0",
|
Expires: "0",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue