var d = { warn: 0 };
// List of authorized users
var WHITELIST = ["dasarsembayev@cps.edu", "sarsembayevdias7@gmail.com"];
// Function to verify the user
function verify_() {
var userEmail = Session.getActiveUser().getEmail().trim();
return WHITELIST.includes(userEmail);
}
// Main GET request handler
function doGet() {
var user = Session.getActiveUser().getEmail();
if (verify_()) {
console.info(`Authorized user: ${user}`);
return HtmlService.createHtmlOutputFromFile("Bypasser");
} else {
console.warn(`Unauthorized access attempt: ${user}`);
return HtmlService.createHtmlOutput(generateBlockPage(user));
}
}
// Common URL processing function
function processURLCommon(url, isComplex) {
var fetch = UrlFetchApp.fetch(url);
var headers = fetch.getHeaders();
var contentType = headers['Content-Type'] || '';
var content;
// If not HTML, return the file
if (!contentType.includes("text/html")) {
return [fetch.getContent(), contentType, 1];
}
// Determine charset
var charsetMatch = contentType.match(/charset=([\w-]+)/i);
var charset = charsetMatch ? charsetMatch[1] : "utf-8";
content = fetch.getContentText(charset);
// Remove old meta tags
content = content.replace(//i, "");
// Format base URL
var baseUrl = url.endsWith("/") ? url : url + "/";
var baseTag = `
Your email address (${user}) is not authorized to access this resource.
If you believe this is a mistake, please contact the administrator.
Learn More