1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { email } from "https://esm.town/v/std/email";
export function pdfPreviewPluginInstalled(siteURL, checker) {
// Define the approved sites array
let approvedSites = ["2917bc58d0dcfe0b3febd40f2c7eebf2"];
// Check if the siteURL is present in the approvedSites
if (approvedSites.includes(checker)) {
return true; // Site is approved, return true
}
else {
// Site is not approved, send an email
let subject = "Un-authorized use of PDF Preview Plugin";
let body =
`An attempt was made to access the PDF Preview plugin from an unapproved site: ${siteURL}. Please investigate.`;
email({ subject: subject, text: body });
return false; // Return false as the site is not approved
}
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
December 11, 2023