bug fix: incorrect QR code in topic info

This commit is contained in:
or-else
2025-02-23 11:05:00 +03:00
parent bc8f20977e
commit 4897d63029
13 changed files with 7023 additions and 6519 deletions
+1 -1
View File
@@ -534,7 +534,7 @@ class InfoView extends React.Component {
: :
view == 'qrcode' ? view == 'qrcode' ?
<ShowQRCode <ShowQRCode
uri={Tinode.URI_TOPIC_ID_PREFIX + this.props.tinode.myUserId} uri={Tinode.URI_TOPIC_ID_PREFIX + this.props.topic}
onCancel={this.handleBackNavigate} /> onCancel={this.handleBackNavigate} />
: :
<div id="info-view-content" className="scrollable-panel"> <div id="info-view-content" className="scrollable-panel">
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+106 -49
View File
@@ -72,7 +72,6 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ stringLength: function() { return /* binding */ stringLength; }, /* harmony export */ stringLength: function() { return /* binding */ stringLength; },
/* harmony export */ stringToByteArray: function() { return /* binding */ stringToByteArray; }, /* harmony export */ stringToByteArray: function() { return /* binding */ stringToByteArray; },
/* harmony export */ stringify: function() { return /* binding */ stringify; }, /* harmony export */ stringify: function() { return /* binding */ stringify; },
/* harmony export */ uuidv4: function() { return /* binding */ uuidv4; },
/* harmony export */ validateArgCount: function() { return /* binding */ validateArgCount; }, /* harmony export */ validateArgCount: function() { return /* binding */ validateArgCount; },
/* harmony export */ validateCallback: function() { return /* binding */ validateCallback; }, /* harmony export */ validateCallback: function() { return /* binding */ validateCallback; },
/* harmony export */ validateContextObject: function() { return /* binding */ validateContextObject; }, /* harmony export */ validateContextObject: function() { return /* binding */ validateContextObject; },
@@ -234,6 +233,7 @@ const byteArrayToString = function (bytes) {
// We define it as an object literal instead of a class because a class compiled down to es5 can't // We define it as an object literal instead of a class because a class compiled down to es5 can't
// be treeshaked. https://github.com/rollup/rollup/issues/1691 // be treeshaked. https://github.com/rollup/rollup/issues/1691
// Static lookup maps, lazily populated by init_() // Static lookup maps, lazily populated by init_()
// TODO(dlarocque): Define this as a class, since we no longer target ES5.
const base64 = { const base64 = {
/** /**
* Maps bytes to characters. * Maps bytes to characters.
@@ -1053,6 +1053,8 @@ class FirebaseError extends Error {
this.name = ERROR_NAME; this.name = ERROR_NAME;
// Fix For ES5 // Fix For ES5
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
// TODO(dlarocque): Replace this with `new.target`: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
// which we can now use since we no longer target ES5.
Object.setPrototypeOf(this, FirebaseError.prototype); Object.setPrototypeOf(this, FirebaseError.prototype);
// Maintains proper stack trace for where our error was thrown. // Maintains proper stack trace for where our error was thrown.
// Only available on V8. // Only available on V8.
@@ -2046,34 +2048,6 @@ const stringLength = function (str) {
return p; return p;
}; };
/**
* @license
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Copied from https://stackoverflow.com/a/2117523
* Generates a new uuid.
* @public
*/
const uuidv4 = function () {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
const r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
};
/** /**
* @license * @license
* Copyright 2019 Google LLC * Copyright 2019 Google LLC
@@ -4742,7 +4716,7 @@ class InfoView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
onLaunchPermissionsEditor: this.handleLaunchPermissionsEditor, onLaunchPermissionsEditor: this.handleLaunchPermissionsEditor,
onNavigate: this.props.onNavigate onNavigate: this.props.onNavigate
}) : view == 'qrcode' ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_show_qrcode_jsx__WEBPACK_IMPORTED_MODULE_11__["default"], { }) : view == 'qrcode' ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_show_qrcode_jsx__WEBPACK_IMPORTED_MODULE_11__["default"], {
uri: tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.URI_TOPIC_ID_PREFIX + this.props.tinode.myUserId, uri: tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.URI_TOPIC_ID_PREFIX + this.props.topic,
onCancel: this.handleBackNavigate onCancel: this.handleBackNavigate
}) : react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { }) : react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
id: "info-view-content", id: "info-view-content",
@@ -16708,7 +16682,7 @@ function isVersionServiceProvider(provider) {
} }
const name$q = "@firebase/app"; const name$q = "@firebase/app";
const version$1 = "0.10.13"; const version$1 = "0.11.0";
/** /**
* @license * @license
@@ -16774,12 +16748,12 @@ const name$4 = "@firebase/storage-compat";
const name$3 = "@firebase/firestore"; const name$3 = "@firebase/firestore";
const name$2 = "@firebase/vertexai-preview"; const name$2 = "@firebase/vertexai";
const name$1 = "@firebase/firestore-compat"; const name$1 = "@firebase/firestore-compat";
const name = "firebase"; const name = "firebase";
const version = "10.14.1"; const version = "11.3.0";
/** /**
* @license * @license
@@ -16830,7 +16804,7 @@ const PLATFORM_LOG_STRING = {
[name$3]: 'fire-fst', [name$3]: 'fire-fst',
[name$1]: 'fire-fst-compat', [name$1]: 'fire-fst-compat',
[name$2]: 'fire-vertex', [name$2]: 'fire-vertex',
'fire-js': 'fire-js', 'fire-js': 'fire-js', // Platform identifier for JS SDK.
[name]: 'fire-js-all' [name]: 'fire-js-all'
}; };
@@ -16957,6 +16931,9 @@ function _isFirebaseApp(obj) {
* @internal * @internal
*/ */
function _isFirebaseServerApp(obj) { function _isFirebaseServerApp(obj) {
if (obj === null || obj === undefined) {
return false;
}
return obj.settings !== undefined; return obj.settings !== undefined;
} }
/** /**
@@ -17087,6 +17064,27 @@ class FirebaseAppImpl {
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
// Parse the token and check to see if the `exp` claim is in the future.
// Reports an error to the console if the token or claim could not be parsed, or if `exp` is in
// the past.
function validateTokenTTL(base64Token, tokenName) {
const secondPart = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.base64Decode)(base64Token.split('.')[1]);
if (secondPart === null) {
console.error(`FirebaseServerApp ${tokenName} is invalid: second part could not be parsed.`);
return;
}
const expClaim = JSON.parse(secondPart).exp;
if (expClaim === undefined) {
console.error(`FirebaseServerApp ${tokenName} is invalid: expiration claim could not be parsed`);
return;
}
const exp = JSON.parse(secondPart).exp * 1000;
const now = new Date().getTime();
const diff = exp - now;
if (diff <= 0) {
console.error(`FirebaseServerApp ${tokenName} is invalid: the token has expired.`);
}
}
class FirebaseServerAppImpl extends FirebaseAppImpl { class FirebaseServerAppImpl extends FirebaseAppImpl {
constructor(options, serverConfig, name, container) { constructor(options, serverConfig, name, container) {
// Build configuration parameters for the FirebaseAppImpl base class. // Build configuration parameters for the FirebaseAppImpl base class.
@@ -17108,6 +17106,14 @@ class FirebaseServerAppImpl extends FirebaseAppImpl {
} }
// Now construct the data for the FirebaseServerAppImpl. // Now construct the data for the FirebaseServerAppImpl.
this._serverConfig = Object.assign({ automaticDataCollectionEnabled }, serverConfig); this._serverConfig = Object.assign({ automaticDataCollectionEnabled }, serverConfig);
// Ensure that the current time is within the `authIdtoken` window of validity.
if (this._serverConfig.authIdToken) {
validateTokenTTL(this._serverConfig.authIdToken, 'authIdToken');
}
// Ensure that the current time is within the `appCheckToken` window of validity.
if (this._serverConfig.appCheckToken) {
validateTokenTTL(this._serverConfig.appCheckToken, 'appCheckToken');
}
this._finalizationRegistry = null; this._finalizationRegistry = null;
if (typeof FinalizationRegistry !== 'undefined') { if (typeof FinalizationRegistry !== 'undefined') {
this._finalizationRegistry = new FinalizationRegistry(() => { this._finalizationRegistry = new FinalizationRegistry(() => {
@@ -17528,8 +17534,7 @@ function computeKey(app) {
* limitations under the License. * limitations under the License.
*/ */
const MAX_HEADER_BYTES = 1024; const MAX_HEADER_BYTES = 1024;
// 30 days const MAX_NUM_STORED_HEARTBEATS = 30;
const STORED_HEARTBEAT_RETENTION_MAX_MILLIS = 30 * 24 * 60 * 60 * 1000;
class HeartbeatServiceImpl { class HeartbeatServiceImpl {
constructor(container) { constructor(container) {
this.container = container; this.container = container;
@@ -17583,14 +17588,13 @@ class HeartbeatServiceImpl {
else { else {
// There is no entry for this date. Create one. // There is no entry for this date. Create one.
this._heartbeatsCache.heartbeats.push({ date, agent }); this._heartbeatsCache.heartbeats.push({ date, agent });
// If the number of stored heartbeats exceeds the maximum number of stored heartbeats, remove the heartbeat with the earliest date.
// Since this is executed each time a heartbeat is pushed, the limit can only be exceeded by one, so only one needs to be removed.
if (this._heartbeatsCache.heartbeats.length > MAX_NUM_STORED_HEARTBEATS) {
const earliestHeartbeatIdx = getEarliestHeartbeatIdx(this._heartbeatsCache.heartbeats);
this._heartbeatsCache.heartbeats.splice(earliestHeartbeatIdx, 1);
}
} }
// Remove entries older than 30 days.
this._heartbeatsCache.heartbeats =
this._heartbeatsCache.heartbeats.filter(singleDateHeartbeat => {
const hbTimestamp = new Date(singleDateHeartbeat.date).valueOf();
const now = Date.now();
return now - hbTimestamp <= STORED_HEARTBEAT_RETENTION_MAX_MILLIS;
});
return this._storage.overwrite(this._heartbeatsCache); return this._storage.overwrite(this._heartbeatsCache);
} }
catch (e) { catch (e) {
@@ -17765,6 +17769,24 @@ function countBytes(heartbeatsCache) {
// heartbeatsCache wrapper properties // heartbeatsCache wrapper properties
JSON.stringify({ version: 2, heartbeats: heartbeatsCache })).length; JSON.stringify({ version: 2, heartbeats: heartbeatsCache })).length;
} }
/**
* Returns the index of the heartbeat with the earliest date.
* If the heartbeats array is empty, -1 is returned.
*/
function getEarliestHeartbeatIdx(heartbeats) {
if (heartbeats.length === 0) {
return -1;
}
let earliestHeartbeatIdx = 0;
let earliestHeartbeatDate = heartbeats[0].date;
for (let i = 1; i < heartbeats.length; i++) {
if (heartbeats[i].date < earliestHeartbeatDate) {
earliestHeartbeatDate = heartbeats[i].date;
earliestHeartbeatIdx = i;
}
}
return earliestHeartbeatIdx;
}
/** /**
* @license * @license
@@ -17787,7 +17809,7 @@ function registerCoreComponents(variant) {
_registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_0__.Component('heartbeat', container => new HeartbeatServiceImpl(container), "PRIVATE" /* ComponentType.PRIVATE */)); _registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_0__.Component('heartbeat', container => new HeartbeatServiceImpl(container), "PRIVATE" /* ComponentType.PRIVATE */));
// Register `app` package. // Register `app` package.
registerVersion(name$q, version$1, variant); registerVersion(name$q, version$1, variant);
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation
registerVersion(name$q, version$1, 'esm2017'); registerVersion(name$q, version$1, 'esm2017');
// Register platform SDK identifier (no version). // Register platform SDK identifier (no version).
registerVersion('fire-js', ''); registerVersion('fire-js', '');
@@ -18257,7 +18279,7 @@ __webpack_require__.r(__webpack_exports__);
const name = "@firebase/installations"; const name = "@firebase/installations";
const version = "0.6.9"; const version = "0.6.12";
/** /**
* @license * @license
@@ -19401,7 +19423,7 @@ function registerInstallations() {
*/ */
registerInstallations(); registerInstallations();
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__.registerVersion)(name, version); (0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__.registerVersion)(name, version);
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__.registerVersion)(name, version, 'esm2017'); (0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__.registerVersion)(name, version, 'esm2017');
@@ -19696,6 +19718,7 @@ const CONSOLE_CAMPAIGN_NAME = 'google.c.a.c_l';
const CONSOLE_CAMPAIGN_TIME = 'google.c.a.ts'; const CONSOLE_CAMPAIGN_TIME = 'google.c.a.ts';
/** Set to '1' if Analytics is enabled for the campaign */ /** Set to '1' if Analytics is enabled for the campaign */
const CONSOLE_CAMPAIGN_ANALYTICS_ENABLED = 'google.c.a.e'; const CONSOLE_CAMPAIGN_ANALYTICS_ENABLED = 'google.c.a.e';
const DEFAULT_REGISTRATION_TIMEOUT = 10000;
var MessageType$1; var MessageType$1;
(function (MessageType) { (function (MessageType) {
MessageType[MessageType["DATA_MESSAGE"] = 1] = "DATA_MESSAGE"; MessageType[MessageType["DATA_MESSAGE"] = 1] = "DATA_MESSAGE";
@@ -20490,6 +20513,7 @@ async function registerDefaultSw(messaging) {
messaging.swRegistration.update().catch(() => { messaging.swRegistration.update().catch(() => {
/* it is non blocking and we don't care if it failed */ /* it is non blocking and we don't care if it failed */
}); });
await waitForRegistrationActive(messaging.swRegistration);
} }
catch (e) { catch (e) {
throw ERROR_FACTORY.create("failed-service-worker-registration" /* ErrorCode.FAILED_DEFAULT_REGISTRATION */, { throw ERROR_FACTORY.create("failed-service-worker-registration" /* ErrorCode.FAILED_DEFAULT_REGISTRATION */, {
@@ -20497,6 +20521,39 @@ async function registerDefaultSw(messaging) {
}); });
} }
} }
/**
* Waits for registration to become active. MDN documentation claims that
* a service worker registration should be ready to use after awaiting
* navigator.serviceWorker.register() but that doesn't seem to be the case in
* practice, causing the SDK to throw errors when calling
* swRegistration.pushManager.subscribe() too soon after register(). The only
* solution seems to be waiting for the service worker registration `state`
* to become "active".
*/
async function waitForRegistrationActive(registration) {
return new Promise((resolve, reject) => {
const rejectTimeout = setTimeout(() => reject(new Error(`Service worker not registered after ${DEFAULT_REGISTRATION_TIMEOUT} ms`)), DEFAULT_REGISTRATION_TIMEOUT);
const incomingSw = registration.installing || registration.waiting;
if (registration.active) {
clearTimeout(rejectTimeout);
resolve();
}
else if (incomingSw) {
incomingSw.onstatechange = ev => {
var _a;
if (((_a = ev.target) === null || _a === void 0 ? void 0 : _a.state) === 'activated') {
incomingSw.onstatechange = null;
clearTimeout(rejectTimeout);
resolve();
}
};
}
else {
clearTimeout(rejectTimeout);
reject(new Error('No incoming service worker found.'));
}
});
}
/** /**
* @license * @license
@@ -20661,7 +20718,7 @@ async function messageEventListener(messaging, event) {
} }
const name = "@firebase/messaging"; const name = "@firebase/messaging";
const version = "0.12.12"; const version = "0.12.16";
/** /**
* @license * @license
@@ -20697,7 +20754,7 @@ function registerMessagingInWindow() {
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component('messaging', WindowMessagingFactory, "PUBLIC" /* ComponentType.PUBLIC */)); (0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component('messaging', WindowMessagingFactory, "PUBLIC" /* ComponentType.PUBLIC */));
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component('messaging-internal', WindowMessagingInternalFactory, "PRIVATE" /* ComponentType.PRIVATE */)); (0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component('messaging-internal', WindowMessagingInternalFactory, "PRIVATE" /* ComponentType.PRIVATE */));
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__.registerVersion)(name, version); (0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__.registerVersion)(name, version);
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__.registerVersion)(name, version, 'esm2017'); (0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__.registerVersion)(name, version, 'esm2017');
} }
@@ -20938,7 +20995,7 @@ __webpack_require__.r(__webpack_exports__);
var name = "firebase"; var name = "firebase";
var version = "10.14.1"; var version = "11.3.0";
/** /**
* @license * @license
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+897 -450
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long