mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2026-04-05 17:33:49 +00:00
replace javascript operators ?? and ?. to support older browsers (see #79)
This commit is contained in:
@@ -390,7 +390,7 @@ class Peer {
|
||||
}
|
||||
|
||||
_onFilesHeader(header) {
|
||||
if (this._requestAccepted?.header.length) {
|
||||
if (this._requestAccepted && this._requestAccepted.header.length) {
|
||||
this._lastProgress = 0;
|
||||
this._digester = new FileDigester({size: header.size, name: header.name, mime: header.mime},
|
||||
this._requestAccepted.totalSize,
|
||||
|
||||
@@ -107,8 +107,15 @@ class PeersUI {
|
||||
_getSavedDisplayName() {
|
||||
return new Promise((resolve) => {
|
||||
PersistentStorage.get('editedDisplayName')
|
||||
.then(displayName => resolve(displayName ?? ""))
|
||||
.catch(_ => resolve(localStorage.getItem('editedDisplayName') ?? ""))
|
||||
.then(displayName => {
|
||||
if (!displayName) displayName = "";
|
||||
resolve(displayName);
|
||||
})
|
||||
.catch(_ => {
|
||||
let displayName = localStorage.getItem('editedDisplayName');
|
||||
if (!displayName) displayName = "";
|
||||
resolve(displayName);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@@ -825,7 +832,7 @@ class ReceiveRequestDialog extends ReceiveDialog {
|
||||
const connectionHash = $(peerId).ui._connectionHash;
|
||||
this._parseFileData(displayName, connectionHash, request.header, request.imagesOnly, request.totalSize);
|
||||
|
||||
if (request.thumbnailDataUrl?.substring(0, 22) === "data:image/jpeg;base64") {
|
||||
if (request.thumbnailDataUrl && request.thumbnailDataUrl.substring(0, 22) === "data:image/jpeg;base64") {
|
||||
let element = document.createElement('img');
|
||||
element.src = request.thumbnailDataUrl;
|
||||
this.$previewBox.appendChild(element)
|
||||
|
||||
@@ -401,7 +401,7 @@ class Peer {
|
||||
}
|
||||
|
||||
_onFilesHeader(header) {
|
||||
if (this._requestAccepted?.header.length) {
|
||||
if (this._requestAccepted && this._requestAccepted.header.length) {
|
||||
this._lastProgress = 0;
|
||||
this._digester = new FileDigester({size: header.size, name: header.name, mime: header.mime},
|
||||
this._requestAccepted.totalSize,
|
||||
|
||||
@@ -107,8 +107,15 @@ class PeersUI {
|
||||
_getSavedDisplayName() {
|
||||
return new Promise((resolve) => {
|
||||
PersistentStorage.get('editedDisplayName')
|
||||
.then(displayName => resolve(displayName ?? ""))
|
||||
.catch(_ => resolve(localStorage.getItem('editedDisplayName') ?? ""))
|
||||
.then(displayName => {
|
||||
if (!displayName) displayName = "";
|
||||
resolve(displayName);
|
||||
})
|
||||
.catch(_ => {
|
||||
let displayName = localStorage.getItem('editedDisplayName');
|
||||
if (!displayName) displayName = "";
|
||||
resolve(displayName);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@@ -826,7 +833,7 @@ class ReceiveRequestDialog extends ReceiveDialog {
|
||||
const connectionHash = $(peerId).ui._connectionHash;
|
||||
this._parseFileData(displayName, connectionHash, request.header, request.imagesOnly, request.totalSize);
|
||||
|
||||
if (request.thumbnailDataUrl?.substring(0, 22) === "data:image/jpeg;base64") {
|
||||
if (request.thumbnailDataUrl && request.thumbnailDataUrl.substring(0, 22) === "data:image/jpeg;base64") {
|
||||
let element = document.createElement('img');
|
||||
element.src = request.thumbnailDataUrl;
|
||||
this.$previewBox.appendChild(element)
|
||||
|
||||
Reference in New Issue
Block a user