@geogirafe/lib-geoportal 1.3.0-dev.2922702126 → 1.3.0-dev.2925672052
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/share/tools/geogirafesharemanager.js +5 -2
- package/package.json +1 -1
- package/templates/public/about.json +1 -1
- package/tools/auth/abstractconnectmanager.js +6 -0
- package/tools/main.d.ts +1 -0
- package/tools/main.js +1 -0
- package/tools/share/iurlshortener.d.ts +1 -0
- package/tools/share/iurlshortener.js +2 -1
- package/tools/share/sharemanager.js +9 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SHORTLINK_PARAMETER } from '../../../tools/share/iurlshortener.js';
|
|
1
2
|
import { generateQrCode } from '../../../tools/utils/qrcode.js';
|
|
2
3
|
class GeoGirafeShareManager {
|
|
3
4
|
serviceUrl;
|
|
@@ -24,8 +25,10 @@ class GeoGirafeShareManager {
|
|
|
24
25
|
const response_data = (await response.json());
|
|
25
26
|
if (response_data) {
|
|
26
27
|
const baseUrl = forcedBaseUrl ?? this.urlManager.getBaseUrlPath();
|
|
27
|
-
const
|
|
28
|
-
const
|
|
28
|
+
const shortId = response_data.short_url.split('/').pop() ?? '';
|
|
29
|
+
const url = new URL(baseUrl);
|
|
30
|
+
url.searchParams.set(SHORTLINK_PARAMETER, shortId);
|
|
31
|
+
const shortUrl = url.toString();
|
|
29
32
|
const qrcode = await generateQrCode(shortUrl);
|
|
30
33
|
return {
|
|
31
34
|
success: true,
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.3.0-dev.
|
|
1
|
+
{"version":"1.3.0-dev.2925672052", "build":"2925672052", "date":"08/10/2026"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SHORTLINK_PARAMETER } from '../share/iurlshortener.js';
|
|
1
2
|
export default class AbstractConnectManager {
|
|
2
3
|
storagePath = 'oAuth';
|
|
3
4
|
context;
|
|
@@ -67,6 +68,11 @@ export default class AbstractConnectManager {
|
|
|
67
68
|
}
|
|
68
69
|
resetUrl() {
|
|
69
70
|
const url = new URL(this.context.urlManager.getBaseUrlPath());
|
|
71
|
+
// Keep the short link: the shared state is restored only after the login workflow
|
|
72
|
+
const shortId = this.context.urlManager.getParam(SHORTLINK_PARAMETER);
|
|
73
|
+
if (shortId) {
|
|
74
|
+
url.searchParams.set(SHORTLINK_PARAMETER, shortId);
|
|
75
|
+
}
|
|
70
76
|
url.hash = this.context.urlManager.getHash() ?? '';
|
|
71
77
|
this.context.urlManager.updateUrl(url);
|
|
72
78
|
}
|
package/tools/main.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export { default as SearchManager } from './search/searchmanager.js';
|
|
|
70
70
|
export { default as SelectionManager } from './selection/selectionmanager.js';
|
|
71
71
|
export type { default as ISessionManager } from './share/isessionmanager.js';
|
|
72
72
|
export type { UrlShortenerResponse, IUrlShortener } from './share/iurlshortener.js';
|
|
73
|
+
export { SHORTLINK_PARAMETER } from './share/iurlshortener.js';
|
|
73
74
|
export { default as ActiveBasemapsSerializer } from './share/serializers/activebasemapsserializer.js';
|
|
74
75
|
export { default as CustomLayersSerializer } from './share/serializers/customlayersserializer.js';
|
|
75
76
|
export { default as GlobeSerializer } from './share/serializers/globeserializer.js';
|
package/tools/main.js
CHANGED
|
@@ -54,6 +54,7 @@ export { default as GeoAdminChSearchClient } from './search/geoadminchsearchclie
|
|
|
54
54
|
export { default as GmfSearchClient } from './search/gmfsearchclient.js';
|
|
55
55
|
export { default as SearchManager } from './search/searchmanager.js';
|
|
56
56
|
export { default as SelectionManager } from './selection/selectionmanager.js';
|
|
57
|
+
export { SHORTLINK_PARAMETER } from './share/iurlshortener.js';
|
|
57
58
|
export { default as ActiveBasemapsSerializer } from './share/serializers/activebasemapsserializer.js';
|
|
58
59
|
export { default as CustomLayersSerializer } from './share/serializers/customlayersserializer.js';
|
|
59
60
|
export { default as GlobeSerializer } from './share/serializers/globeserializer.js';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
export const SHORTLINK_PARAMETER = 'gg';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
import GirafeSingleton from '../../base/GirafeSingleton.js';
|
|
3
|
+
import { SHORTLINK_PARAMETER } from './iurlshortener.js';
|
|
3
4
|
import GmfShareManager from '../../components/share/tools/gmfsharemanager.js';
|
|
4
5
|
import GeoGirafeShareManager from '../../components/share/tools/geogirafesharemanager.js';
|
|
5
6
|
class ShareManager extends GirafeSingleton {
|
|
@@ -32,6 +33,11 @@ class ShareManager extends GirafeSingleton {
|
|
|
32
33
|
if (this.context.sessionManager.hasState()) {
|
|
33
34
|
return null;
|
|
34
35
|
}
|
|
36
|
+
const shortId = this.context.urlManager.getParam(SHORTLINK_PARAMETER);
|
|
37
|
+
if (shortId) {
|
|
38
|
+
return `gg-${shortId}`;
|
|
39
|
+
}
|
|
40
|
+
// Legacy short links (#gg-xxx) and full states are stored in the hash
|
|
35
41
|
return this.context.urlManager.getHash();
|
|
36
42
|
}
|
|
37
43
|
async setStateFromUrl() {
|
|
@@ -47,6 +53,9 @@ class ShareManager extends GirafeSingleton {
|
|
|
47
53
|
}
|
|
48
54
|
stateRestored = this.context.stateSerializer.deserializeAndSetState(encodedState);
|
|
49
55
|
}
|
|
56
|
+
// Like the hash (replaced by the session hash), the short link is consumed once:
|
|
57
|
+
// on reload, the state is then restored from the session.
|
|
58
|
+
this.context.urlManager.removeParams(SHORTLINK_PARAMETER);
|
|
50
59
|
return stateRestored;
|
|
51
60
|
}
|
|
52
61
|
async getStateFromServer(geogirafeState) {
|