mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-02-18 02:55:48 +00:00
Send appId with WikiTree requests
This commit is contained in:
parent
9f673a1472
commit
cbe0d0f393
14
package-lock.json
generated
14
package-lock.json
generated
@ -40,7 +40,7 @@
|
|||||||
"topola": "^3.6.1",
|
"topola": "^3.6.1",
|
||||||
"turbocommons-ts": "^3.8.0",
|
"turbocommons-ts": "^3.8.0",
|
||||||
"unified": "^10.1.0",
|
"unified": "^10.1.0",
|
||||||
"wikitree-js": "^0.1.0"
|
"wikitree-js": "^0.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/array.prototype.flatmap": "^1.2.2",
|
"@types/array.prototype.flatmap": "^1.2.2",
|
||||||
@ -25403,9 +25403,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/wikitree-js": {
|
"node_modules/wikitree-js": {
|
||||||
"version": "0.1.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/wikitree-js/-/wikitree-js-0.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/wikitree-js/-/wikitree-js-0.4.0.tgz",
|
||||||
"integrity": "sha512-ztMf+tAAO6/4GofAqhBYL3iMlMqYraI3/pYn8qWpaa2feLYJU5rjMJaIPACaJaBHjXOUTaOR0NSQ46drObjzhA==",
|
"integrity": "sha512-ZNlXbm9RiLQ0oZ7m4CotsYafeQ4YKJuRdxC/OcjjSvhVf16nAhocw5fTjhMBq9EKnXvK5+F7+k+nULdQFXDyIg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cross-fetch": "^3.1.5",
|
"cross-fetch": "^3.1.5",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
@ -46170,9 +46170,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"wikitree-js": {
|
"wikitree-js": {
|
||||||
"version": "0.1.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/wikitree-js/-/wikitree-js-0.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/wikitree-js/-/wikitree-js-0.4.0.tgz",
|
||||||
"integrity": "sha512-ztMf+tAAO6/4GofAqhBYL3iMlMqYraI3/pYn8qWpaa2feLYJU5rjMJaIPACaJaBHjXOUTaOR0NSQ46drObjzhA==",
|
"integrity": "sha512-ZNlXbm9RiLQ0oZ7m4CotsYafeQ4YKJuRdxC/OcjjSvhVf16nAhocw5fTjhMBq9EKnXvK5+F7+k+nULdQFXDyIg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"cross-fetch": "^3.1.5",
|
"cross-fetch": "^3.1.5",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
"topola": "^3.6.1",
|
"topola": "^3.6.1",
|
||||||
"turbocommons-ts": "^3.8.0",
|
"turbocommons-ts": "^3.8.0",
|
||||||
"unified": "^10.1.0",
|
"unified": "^10.1.0",
|
||||||
"wikitree-js": "^0.1.0"
|
"wikitree-js": "^0.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/array.prototype.flatmap": "^1.2.2",
|
"@types/array.prototype.flatmap": "^1.2.2",
|
||||||
|
|||||||
@ -23,6 +23,8 @@ import {
|
|||||||
Person,
|
Person,
|
||||||
} from 'wikitree-js';
|
} from 'wikitree-js';
|
||||||
|
|
||||||
|
const WIKITREE_APP_ID = 'topola-viewer';
|
||||||
|
|
||||||
/** Prefix for IDs of private individuals. */
|
/** Prefix for IDs of private individuals. */
|
||||||
export const PRIVATE_ID_PREFIX = '~Private';
|
export const PRIVATE_ID_PREFIX = '~Private';
|
||||||
|
|
||||||
@ -46,12 +48,15 @@ function setSessionStorageItem(key: string, value: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getApiOptions(handleCors: boolean) {
|
function getApiOptions(handleCors: boolean) {
|
||||||
return handleCors
|
return Object.assign(
|
||||||
? {
|
{appId: WIKITREE_APP_ID},
|
||||||
apiUrl:
|
handleCors
|
||||||
'https://topola-cors-server.up.railway.app/https://api.wikitree.com/api.php',
|
? {
|
||||||
}
|
apiUrl:
|
||||||
: {};
|
'https://topola-cors-server.up.railway.app/https://api.wikitree.com/api.php',
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -128,7 +133,7 @@ export async function loadWikiTree(
|
|||||||
const handleCors = window.location.hostname !== 'apps.wikitree.com';
|
const handleCors = window.location.hostname !== 'apps.wikitree.com';
|
||||||
|
|
||||||
if (!handleCors && !getLoggedInUserName() && authcode) {
|
if (!handleCors && !getLoggedInUserName() && authcode) {
|
||||||
const loginResult = await clientLogin(authcode);
|
const loginResult = await clientLogin(authcode, {appId: WIKITREE_APP_ID});
|
||||||
if (loginResult.result === 'Success') {
|
if (loginResult.result === 'Success') {
|
||||||
sessionStorage.clear();
|
sessionStorage.clear();
|
||||||
}
|
}
|
||||||
@ -826,4 +831,3 @@ export class WikiTreeDataSource implements DataSource<WikiTreeSourceSpec> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user