Skip to content
This repository was archived by the owner on Jan 1, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,16 @@ async function handleRequest(request) {
.pop()
.toLowerCase()

const referer = request.headers.get("Referer")
let hotLink = false

// If the hostnames don't match, it's a hotlink
if (new URL(referer).hostname !== new URL(request.url).hostname) {
hotLink = true
}

// Render file directly if url params 'raw' are given
if (rawFile || !(fileExt in extensions)) {
if (rawFile || hotLink || !(fileExt in extensions)) {
return await handleFile(request, pathname, data['@microsoft.graph.downloadUrl'], {
proxied,
fileSize: data.size
Expand Down