Standardize JWT authentication and finalize Activity Log V3 migration
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// console.log(`ae_root +layout.ts: start`);
|
||||
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { lookup_site_domain_v3 } from '$lib/ae_core/ae_core__site';
|
||||
import { lookup_site_domain } from '$lib/ae_core/ae_core__site';
|
||||
import type { key_val } from '$lib/stores/ae_stores';
|
||||
|
||||
import {
|
||||
@@ -31,8 +31,8 @@ const ae_api_init: key_val = {
|
||||
ver: '2024-08-11_11',
|
||||
base_url: api_base_url,
|
||||
base_url_bak: api_base_url_bak,
|
||||
api_secret_key: api_secret_key,
|
||||
api_secret_key_bak: api_secret_key,
|
||||
api_secret_key: api_secret_key,
|
||||
api_secret_key_bak: api_secret_key,
|
||||
api_crud_super_key: api_crud_super_key,
|
||||
headers: {},
|
||||
account_id: ae_account_id
|
||||
@@ -83,7 +83,7 @@ export async function load({ fetch, params, parent, route, url }) {
|
||||
ae_loc: {},
|
||||
ae_api: ae_api_init,
|
||||
ae_ds: {},
|
||||
ae_hub: {},
|
||||
ae_hub: {},
|
||||
ae_m_sponsorships: {},
|
||||
ae_m_events: {},
|
||||
ae_m_events_speakers: {},
|
||||
@@ -102,11 +102,11 @@ export async function load({ fetch, params, parent, route, url }) {
|
||||
};
|
||||
|
||||
const fqdn = url.host;
|
||||
|
||||
const result = await lookup_site_domain_v3({
|
||||
|
||||
const result = await lookup_site_domain({
|
||||
api_cfg: ae_api_init,
|
||||
fqdn,
|
||||
view: 'base',
|
||||
view: 'base',
|
||||
log_lvl
|
||||
}).catch((err) => {
|
||||
console.log('Site lookup failed in root layout.', err);
|
||||
@@ -128,11 +128,13 @@ export async function load({ fetch, params, parent, route, url }) {
|
||||
|
||||
ae_api_init['account_id'] = json_data.account_id_random;
|
||||
ae_api_init['headers']['x-account-id'] = json_data.account_id_random;
|
||||
ae_api_init['headers']['x-no-account-id'] = null;
|
||||
// ae_api_init['headers']['x-no-account-id'] = null;
|
||||
|
||||
ae_api_headers['x-account-id'] = ae_account_id;
|
||||
|
||||
ae_loc_init['account_id'] = json_data.account_id_random;
|
||||
ae_loc_init['account_code'] = json_data.account_code;
|
||||
ae_loc_init['account_name'] = json_data.account_name;
|
||||
ae_loc_init['account_code'] = json_data.account_code;
|
||||
ae_loc_init['account_name'] = json_data.account_name;
|
||||
|
||||
ae_loc_init['site_id'] = json_data.site_id_random;
|
||||
ae_loc_init['site_domain_id'] = json_data.site_domain_id_random;
|
||||
@@ -142,17 +144,17 @@ export async function load({ fetch, params, parent, route, url }) {
|
||||
ae_loc_init['site_google_tracking_id'] = json_data.google_tracking_id;
|
||||
ae_loc_init['site_access_code_kv'] = json_data.access_code_kv_json;
|
||||
ae_loc_init['site_cfg_json'] = json_data.cfg_json;
|
||||
ae_loc_init['site_access_key'] = json_data.access_key;
|
||||
ae_loc_init['site_domain_access_key'] = json_data.site_domain_access_key;
|
||||
ae_loc_init['site_access_key'] = json_data.access_key;
|
||||
ae_loc_init['site_domain_access_key'] = json_data.site_domain_access_key;
|
||||
|
||||
ae_loc_init['base_url'] = url.origin;
|
||||
ae_loc_init['hostname'] = url.hostname;
|
||||
|
||||
if (!ae_loc_init['site_access_key'] && !ae_loc_init['site_domain_access_key']) {
|
||||
ae_loc_init['key_checked'] = true;
|
||||
ae_loc_init['allow_access'] = true;
|
||||
ae_loc_init['key_checked'] = true;
|
||||
ae_loc_init['allow_access'] = true;
|
||||
} else {
|
||||
const access_key = url.searchParams.get('key');
|
||||
const access_key = url.searchParams.get('key');
|
||||
|
||||
if (access_key) {
|
||||
if (log_lvl) {
|
||||
|
||||
Reference in New Issue
Block a user