Skip to content

Commit

Permalink
fix: skip asset generation on http assets
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Nov 22, 2024
1 parent 520b6eb commit 5bec603
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/shelteRPC/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,20 @@ export const generateAssetId = async (appId: string, asset: string) => {
return assetId
}

const isProbablyUrl = (str: string) => str.startsWith('http://') || str.startsWith('https://')

async function handleMessage(e: MessageEvent<string>) {
const data = JSON.parse(e.data)
const assets = data.activity?.assets

if (data.cmd) return handleCmd(data)

if (assets?.large_image)
if (assets?.large_image && !isProbablyUrl(assets.large_image))
assets.large_image = await generateAssetId(
data.activity.application_id,
assets.large_image
)
if (assets?.small_image)
if (assets?.small_image && !isProbablyUrl(assets.small_image))
assets.small_image = await generateAssetId(
data.activity.application_id,
assets.small_image
Expand Down

0 comments on commit 5bec603

Please sign in to comment.