mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-07-25 21:21:54 +00:00
refactor: restrict WikiTree integration to the apps.wikitree.com domain and add helper utilities
This commit is contained in:
17
src/util/wikitree_util.ts
Normal file
17
src/util/wikitree_util.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Base URL for Topola Viewer hosted on apps.wikitree.com.
|
||||
* WikiTree API calls only work when the app is served from this domain.
|
||||
*/
|
||||
export const WIKITREE_TOPOLA_URL =
|
||||
'https://apps.wikitree.com/apps/wiech13/topola-viewer';
|
||||
|
||||
/**
|
||||
* Returns true if the app is currently hosted on the apps.wikitree.com domain.
|
||||
*
|
||||
* WikiTree's API requires being served from this domain due to authentication
|
||||
* and CORS restrictions. When not on this domain, WikiTree data loading does
|
||||
* not work.
|
||||
*/
|
||||
export function isOnWikitreeDomain(): boolean {
|
||||
return window.location.hostname === 'apps.wikitree.com';
|
||||
}
|
||||
Reference in New Issue
Block a user