General code clean up. Removing old stuff.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
/** @type {import('./$types').LayoutLoad} */
|
||||
// console.log(`ae_root +layout.ts: start`);
|
||||
|
||||
import { error } from '@sveltejs/kit';
|
||||
// import { error } from '@sveltejs/kit';
|
||||
import { lookup_site_domain_v3 } from '$lib/ae_core/ae_core__site';
|
||||
import type { key_val } from '$lib/stores/ae_stores';
|
||||
import type { ae_SiteDomain } from '$lib/types/ae_types';
|
||||
// import type { ae_SiteDomain } from '$lib/types/ae_types';
|
||||
|
||||
export const ssr = false;
|
||||
export const prerender = false;
|
||||
@@ -17,8 +17,8 @@ import {
|
||||
PUBLIC_AE_API_PATH,
|
||||
PUBLIC_AE_API_SECRET_KEY,
|
||||
PUBLIC_AE_API_CRUD_SUPER_KEY,
|
||||
PUBLIC_AE_NO_ACCOUNT_ID,
|
||||
PUBLIC_AE_NO_ACCOUNT_ID_TOKEN
|
||||
// PUBLIC_AE_NO_ACCOUNT_ID,
|
||||
// PUBLIC_AE_NO_ACCOUNT_ID_TOKEN
|
||||
} from '$env/static/public';
|
||||
|
||||
const api_base_url = `${PUBLIC_AE_API_PROTOCOL}://${PUBLIC_AE_API_SERVER}:${PUBLIC_AE_API_PORT}${PUBLIC_AE_API_PATH}`;
|
||||
@@ -28,8 +28,8 @@ const api_secret_key = PUBLIC_AE_API_SECRET_KEY;
|
||||
const api_crud_super_key = PUBLIC_AE_API_CRUD_SUPER_KEY;
|
||||
|
||||
const ae_account_id: null | string = null;
|
||||
const ae_no_account_id = PUBLIC_AE_NO_ACCOUNT_ID;
|
||||
const ae_no_account_id_token = PUBLIC_AE_NO_ACCOUNT_ID_TOKEN;
|
||||
// const ae_no_account_id = PUBLIC_AE_NO_ACCOUNT_ID;
|
||||
// const ae_no_account_id_token = PUBLIC_AE_NO_ACCOUNT_ID_TOKEN;
|
||||
|
||||
const ae_api_init: key_val = {
|
||||
ver: '2024-08-11_11',
|
||||
@@ -56,10 +56,10 @@ export async function load({ fetch, params, parent, route, url }) {
|
||||
let account_id: any;
|
||||
|
||||
const ae_acct: key_val = {
|
||||
api: {
|
||||
api: {
|
||||
...ae_api_init,
|
||||
headers: { ...ae_api_headers } // Local clone
|
||||
},
|
||||
},
|
||||
ds: {},
|
||||
loc: {
|
||||
account_id: '',
|
||||
@@ -156,7 +156,7 @@ export async function load({ fetch, params, parent, route, url }) {
|
||||
site_id: native_device_config.site_id || native_device_config.site_id_random,
|
||||
site_domain_id: native_device_config.site_domain_id || native_device_config.site_domain_id_random,
|
||||
};
|
||||
|
||||
|
||||
// Inject native device metadata into the location state with SAFE MERGE
|
||||
if (native_device_config.native_device) {
|
||||
const incoming_dev = native_device_config.native_device;
|
||||
@@ -165,7 +165,7 @@ export async function load({ fetch, params, parent, route, url }) {
|
||||
if (incoming_dev.event_device_id_random) incoming_dev.event_device_id = incoming_dev.event_device_id_random;
|
||||
if (incoming_dev.event_id_random) incoming_dev.event_id = incoming_dev.event_id_random;
|
||||
if (incoming_dev.id_random) incoming_dev.id = incoming_dev.id_random;
|
||||
|
||||
|
||||
// 1. Recover existing user overrides from localStorage
|
||||
let existing_dev = {};
|
||||
try {
|
||||
@@ -205,13 +205,13 @@ export async function load({ fetch, params, parent, route, url }) {
|
||||
if (!result) {
|
||||
try {
|
||||
if (log_lvl) console.log(`ROOT LOAD: No cache. Starting site lookup V3 for ${fqdn}...`);
|
||||
|
||||
|
||||
// Use dedicated Agent Key for Bootstrap and include the unauthenticated bypass header ONLY for this request
|
||||
const bootstrap_api_cfg = {
|
||||
const bootstrap_api_cfg = {
|
||||
...ae_api_init,
|
||||
api_secret_key: 'IDF68Em5X4HTZlswRNgepQ',
|
||||
headers: {
|
||||
...ae_api_init.headers,
|
||||
headers: {
|
||||
...ae_api_init.headers,
|
||||
'x-aether-api-key': 'IDF68Em5X4HTZlswRNgepQ',
|
||||
'x-no-account-id': 'bypass' // Force explicit bypass for bootstrap
|
||||
}
|
||||
@@ -259,7 +259,7 @@ export async function load({ fetch, params, parent, route, url }) {
|
||||
|
||||
const json_data = result;
|
||||
// ... rest of the mapping logic ...
|
||||
account_id = json_data.account_id || json_data.account_id_random || 'ghost';
|
||||
account_id = json_data.account_id || 'ghost';
|
||||
data_struct.account_id = account_id;
|
||||
ae_acct.account_id = account_id;
|
||||
|
||||
@@ -274,8 +274,8 @@ export async function load({ fetch, params, parent, route, url }) {
|
||||
ae_loc_init['account_code'] = json_data.account_code || 'ghost';
|
||||
ae_loc_init['account_name'] = json_data.account_name || 'Ghost Account';
|
||||
|
||||
ae_loc_init['site_id'] = json_data.site_id || json_data.site_id_random || 'ghost';
|
||||
ae_loc_init['site_domain_id'] = json_data.site_domain_id || json_data.site_domain_id_random || 'ghost';
|
||||
ae_loc_init['site_id'] = json_data.site_id || 'ghost';
|
||||
ae_loc_init['site_domain_id'] = json_data.site_domain_id || json_data.site_domain_id || 'ghost';
|
||||
ae_loc_init['site_enable'] = json_data.enable || '1';
|
||||
ae_loc_init['site_header_image_path'] = json_data.header_image_path || '';
|
||||
ae_loc_init['site_style_href'] = json_data.style_href || '';
|
||||
|
||||
Reference in New Issue
Block a user