a bit of cleanup, better naming of the app cache
This commit is contained in:
+4
-9
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "tinode-webapp",
|
||||
"description": "Tinode messenger for the web",
|
||||
"version": "0.17.0",
|
||||
"version": "0.17.1-alpha1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tinode/example-react-js.git"
|
||||
@@ -18,12 +18,6 @@
|
||||
},
|
||||
"browserslist": "> 0.5%, not IE 11",
|
||||
"files": [
|
||||
"src/index.js",
|
||||
"src/config.js",
|
||||
"src/views/*.jsx",
|
||||
"src/widgets/*.jsx",
|
||||
"src/lib/*.js",
|
||||
"src/i18n/*.json",
|
||||
"umd/index.prod.js",
|
||||
"umd/index.prod.js.map",
|
||||
"umd/index.dev.js",
|
||||
@@ -40,7 +34,8 @@
|
||||
"index.html",
|
||||
"manifest.json",
|
||||
"service-worker.js",
|
||||
"firebase-init.js"
|
||||
"firebase-init.js",
|
||||
"version.js"
|
||||
],
|
||||
"keywords": [
|
||||
"chat",
|
||||
@@ -72,7 +67,7 @@
|
||||
"react": "^17.0.1",
|
||||
"react-dom": "^17.0.1",
|
||||
"react-intl": "^5.12.5",
|
||||
"tinode-sdk": "^0.17.0"
|
||||
"tinode-sdk": "^0.17.1-alpha1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.13.8",
|
||||
|
||||
+16
-11
@@ -1,13 +1,18 @@
|
||||
var fs = require('fs');
|
||||
var version = require('../package.json').version;
|
||||
const fs = require('fs');
|
||||
const version = require('../package.json').version;
|
||||
|
||||
fs.writeFile('./src/version.js',
|
||||
'// This is a generated file. Don\'t edit.\n\n'+
|
||||
'export const PACKAGE_VERSION = "'+version+'";\n',
|
||||
{ flag: 'w' },
|
||||
function(err) {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
function writeVersion(fileName, useExport) {
|
||||
fs.writeFile(fileName,
|
||||
'// This is a generated file. Don\'t edit.\n\n'+
|
||||
`${useExport ? 'export ' : ''}const PACKAGE_VERSION = "${version}";\n`,
|
||||
{ flag: 'w' },
|
||||
(err) => {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
writeVersion('./src/version.js', true);
|
||||
writeVersion('./version.js', false);
|
||||
|
||||
+4
-4
@@ -2,6 +2,7 @@
|
||||
importScripts('https://cdn.jsdelivr.net/npm/firebase@8.2.9/firebase-app.js');
|
||||
importScripts('https://cdn.jsdelivr.net/npm/firebase@8.2.9/firebase-messaging.js');
|
||||
importScripts('firebase-init.js');
|
||||
importScripts('version.js');
|
||||
|
||||
// Channel to notify the webapp.
|
||||
const webAppChannel = new BroadcastChannel('tinode-sw');
|
||||
@@ -132,18 +133,17 @@ self.addEventListener('fetch', event => {
|
||||
return response;
|
||||
}
|
||||
if (event.request.url && (event.request.url.startsWith('http://') || event.request.url.startsWith('https://'))) {
|
||||
const cache = await caches.open(self.version);
|
||||
const cache = await caches.open(PACKAGE_VERSION);
|
||||
await cache.put(event.request, response.clone());
|
||||
}
|
||||
return response;
|
||||
})());
|
||||
});
|
||||
|
||||
// This code get the human language & app version from the webapp.
|
||||
// Locale is used for localization of strings, version for naming the cache.
|
||||
// This code get the human language from the webapp.
|
||||
// Locale is used for localization of strings.
|
||||
self.addEventListener('message', event => {
|
||||
const data = JSON.parse(event.data);
|
||||
self.locale = data.locale || '';
|
||||
self.baseLocale = self.locale.toLowerCase().split(/[-_]/)[0];
|
||||
self.version = data.version || 'default';
|
||||
});
|
||||
|
||||
+11
-10
@@ -1,7 +1,7 @@
|
||||
import { PACKAGE_VERSION } from './version.js';
|
||||
|
||||
// Name of this application, used in the User-Agent.
|
||||
export const APP_NAME = 'TinodeWeb/' + (PACKAGE_VERSION || '0.16');
|
||||
export const APP_NAME = 'TinodeWeb/' + (PACKAGE_VERSION || '0.17');
|
||||
|
||||
// API key. Use https://github.com/tinode/chat/tree/master/keygen to generate your own
|
||||
export const API_KEY = 'AQEAAAABAAD_rAp4DJh05a1HAwFT3A6K';
|
||||
@@ -22,11 +22,11 @@ export const RECEIVED_DELAY = 500;
|
||||
// Delay before sending a read notification, milliseconds.
|
||||
export const READ_DELAY = 1000;
|
||||
|
||||
// The shortest allowed tag length. Matches the value on the server.
|
||||
// The default shortest allowed tag length. Matches the value on the server.
|
||||
export const MIN_TAG_LENGTH = 2;
|
||||
// The greatest allowed tag length. Matches the value on the server.
|
||||
// The default greatest allowed tag length. Matches the value on the server.
|
||||
export const MAX_TAG_LENGTH = 96;
|
||||
// The maximum number of tags allowed. Matches the value on the server.
|
||||
// The default maximum number of tags allowed. Matches the value on the server.
|
||||
export const MAX_TAG_COUNT = 16;
|
||||
|
||||
// Access mode for P2P subscriptions initiated by the current user.
|
||||
@@ -56,17 +56,18 @@ export const BROKEN_IMAGE_SIZE = 32;
|
||||
export const MESSAGES_PAGE = 24;
|
||||
|
||||
// Default maximum in-band (included directly into the message) attachment size which fits into
|
||||
// a message of 256K in size. The actual binary size of the attachment should be smaller due to
|
||||
// base64 encoding expansion and some overhead, for instance 1024 bytes.
|
||||
// a message of 256K in size. Used when the server-provided value is unavailable. The actual
|
||||
// binary size of the attachment should be smaller due to base64 encoding expansion and some overhead,
|
||||
// for instance 1024 bytes.
|
||||
// Increase this limit to a greater value in production, if desired. Also increase
|
||||
// max_message_size in the server config.
|
||||
export const MAX_INBAND_ATTACHMENT_SIZE = 262144;
|
||||
|
||||
// Absolute maximum attachment size to be used with the server = 8MB. Increase to
|
||||
// something like 100MB in production.
|
||||
// Default absolute maximum attachment size to be used with the server = 8MB.
|
||||
// Used when the server-provided value is unavailable. Increase to something like 100MB in production.
|
||||
export const MAX_EXTERN_ATTACHMENT_SIZE = 1 << 23;
|
||||
|
||||
// Maximum allowed linear dimension of an inline image in pixels. Larer images will be shrunk
|
||||
// Maximum allowed linear dimension (pixels) of an image sent inline. Larger images will be shrunk
|
||||
// to make the larger dimension fit under this size. You may want to adjust it to 1600 or
|
||||
// 2400 for production.
|
||||
export const MAX_IMAGE_DIM = 1024;
|
||||
@@ -85,7 +86,7 @@ export const MAX_TITLE_LENGTH = 60;
|
||||
export const MESSAGE_PREVIEW_LENGTH = 80;
|
||||
|
||||
// Link for "Contact Us".
|
||||
export const LINK_CONTACT_US = 'email:info@tinode.co';
|
||||
export const LINK_CONTACT_US = 'email:support@tinode.co';
|
||||
|
||||
// Link to Privacy Policy.
|
||||
export const LINK_PRIVACY_POLICY = 'https://tinode.co/privacy.html';
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
// This is a generated file. Don't edit.
|
||||
|
||||
export const PACKAGE_VERSION = "0.17.0";
|
||||
export const PACKAGE_VERSION = "0.17.1-alpha1";
|
||||
|
||||
@@ -36,16 +36,15 @@ export default class SettingsView extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
const names = {def: "default", ws: "websocket", lp: "long polling"};
|
||||
var transportOptions = [];
|
||||
var instance = this;
|
||||
['def', 'ws', 'lp'].map(function(item) {
|
||||
var id = 'transport-' + item;
|
||||
var name = names[item];
|
||||
const transportOptions = [];
|
||||
['def', 'ws', 'lp'].map((item) => {
|
||||
const id = 'transport-' + item;
|
||||
const name = names[item];
|
||||
transportOptions.push(
|
||||
<li key={item}>
|
||||
<input type="radio" id={id} name="transport-select" value={item}
|
||||
checked={instance.state.transport === item}
|
||||
onChange={instance.handleTransportSelected} />
|
||||
checked={this.state.transport === item}
|
||||
onChange={this.handleTransportSelected} />
|
||||
<label htmlFor={id}>{name}</label>
|
||||
</li>
|
||||
);
|
||||
|
||||
@@ -324,8 +324,8 @@ class TinodeWeb extends React.Component {
|
||||
this.checkForAppUpdate(reg);
|
||||
this.fbPush.useServiceWorker(reg);
|
||||
reg.active.postMessage(JSON.stringify({locale: locale, version: PACKAGE_VERSION}));
|
||||
// Google could not be bothered to mention that
|
||||
// onTokenRefresh is never called.
|
||||
|
||||
// Google could not be bothered to mention that onTokenRefresh is never called.
|
||||
this.fbPush.onTokenRefresh(() => {
|
||||
this.requestPushToken();
|
||||
});
|
||||
|
||||
@@ -157,6 +157,10 @@ function draftyFormatter(style, data, values, key) {
|
||||
el = React.Fragment;
|
||||
break;
|
||||
case 'EX':
|
||||
if (data && data.mime == 'application/json') {
|
||||
// Ignore JSON attachments: they are form response payloads.
|
||||
return null;
|
||||
}
|
||||
el = React.Fragment;
|
||||
values = [<i key="ex" className="material-icons">attachment</i>, formatMessage(messages.drafty_attachment)];
|
||||
break;
|
||||
|
||||
+13
-10
@@ -43,7 +43,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./version.js */ "./src/version.js");
|
||||
|
||||
const APP_NAME = 'TinodeWeb/' + (_version_js__WEBPACK_IMPORTED_MODULE_0__.PACKAGE_VERSION || '0.16');
|
||||
const APP_NAME = 'TinodeWeb/' + (_version_js__WEBPACK_IMPORTED_MODULE_0__.PACKAGE_VERSION || '0.17');
|
||||
const API_KEY = 'AQEAAAABAAD_rAp4DJh05a1HAwFT3A6K';
|
||||
const KNOWN_HOSTS = {
|
||||
hosted: 'web.tinode.co',
|
||||
@@ -73,7 +73,7 @@ const IMAGE_PREVIEW_DIM = 64;
|
||||
const MAX_ONLINE_IN_TOPIC = 4;
|
||||
const MAX_TITLE_LENGTH = 60;
|
||||
const MESSAGE_PREVIEW_LENGTH = 80;
|
||||
const LINK_CONTACT_US = 'email:info@tinode.co';
|
||||
const LINK_CONTACT_US = 'email:support@tinode.co';
|
||||
const LINK_PRIVACY_POLICY = 'https://tinode.co/privacy.html';
|
||||
const LINK_TERMS_OF_SERVICE = 'https://tinode.co/terms.html';
|
||||
|
||||
@@ -702,7 +702,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "PACKAGE_VERSION": function() { return /* binding */ PACKAGE_VERSION; }
|
||||
/* harmony export */ });
|
||||
const PACKAGE_VERSION = "0.17.0";
|
||||
const PACKAGE_VERSION = "0.17.1-alpha1";
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -4396,11 +4396,10 @@ class SettingsView extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCom
|
||||
ws: "websocket",
|
||||
lp: "long polling"
|
||||
};
|
||||
var transportOptions = [];
|
||||
var instance = this;
|
||||
['def', 'ws', 'lp'].map(function (item) {
|
||||
var id = 'transport-' + item;
|
||||
var name = names[item];
|
||||
const transportOptions = [];
|
||||
['def', 'ws', 'lp'].map(item => {
|
||||
const id = 'transport-' + item;
|
||||
const name = names[item];
|
||||
transportOptions.push(react__WEBPACK_IMPORTED_MODULE_0___default().createElement("li", {
|
||||
key: item
|
||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
|
||||
@@ -4408,8 +4407,8 @@ class SettingsView extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCom
|
||||
id: id,
|
||||
name: "transport-select",
|
||||
value: item,
|
||||
checked: instance.state.transport === item,
|
||||
onChange: instance.handleTransportSelected
|
||||
checked: this.state.transport === item,
|
||||
onChange: this.handleTransportSelected
|
||||
}), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", {
|
||||
htmlFor: id
|
||||
}, name)));
|
||||
@@ -7938,6 +7937,10 @@ function draftyFormatter(style, data, values, key) {
|
||||
break;
|
||||
|
||||
case 'EX':
|
||||
if (data && data.mime == 'application/json') {
|
||||
return null;
|
||||
}
|
||||
|
||||
el = (react__WEBPACK_IMPORTED_MODULE_0___default().Fragment);
|
||||
values = [react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", {
|
||||
key: "ex",
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+363
-360
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user