remove globalThis and added URL to global

This commit is contained in:
2026-03-07 01:29:07 -06:00
parent 1a6bd09b7b
commit a9406d4292
3 changed files with 31 additions and 18 deletions

View File

@@ -16,7 +16,7 @@
* - uuidv4: UUID generator
* - jwt: JSON Web Token library
* - xmlBuilder: XML document builder
* - globalThis['google_drive_settings']: Consolidated settings (from global/google_drive_settings.json)
* - google_drive_settings: Consolidated settings (from global/google_drive_settings.json)
* - serviceAccount: Service account credentials
* - scopes: OAuth2 scopes array
* - driveQuery: Drive API query filter
@@ -100,11 +100,11 @@ async function getAccessToken(jwtToken) {
async function initializeServiceAccount() {
try {
// Load settings from consolidated global object
const settings = globalThis["google_drive_settings"];
const settings = google_drive_settings;
if (!settings) {
throw new Error(
'Google Drive settings not found in globalThis["google_drive_settings"]. Ensure server.js loaded global/google_drive_settings.json',
'Google Drive settings not found in `google_drive_settings`. Ensure server.js loaded global/google_drive_settings.json',
);
}
@@ -641,7 +641,7 @@ function parseRoute(method, url) {
async function handleSitemapRequest(res, requestId) {
try {
// Get configuration from consolidated global settings
const settings = globalThis["google_drive_settings"] || {};
const settings = google_drive_settings || {};
const maxUrls = settings.sitemap?.maxUrls || 50000;
const query = settings.driveQuery || "trashed = false";

View File

@@ -15,6 +15,7 @@ const __dirname = dirname(__filename);
const globalVMContext = {
URLSearchParams,
URL,
console: logger,
crypto,
axios,