mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-26 17:56:16 -04:00
Merge branch 'master' into translate
This commit is contained in:
commit
a03482bc7f
15 changed files with 135 additions and 77 deletions
Binary file not shown.
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 12 KiB |
|
@ -139,7 +139,7 @@
|
|||
<div class="edit-btn btn btn-small btn-rounded btn-dark text-white" data-i18n-key="header.edit-share-mode" data-i18n-attrs="text" hidden></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="websocket-fallback" hidden>
|
||||
<div id="websocket-fallback" class="text-center" hidden>
|
||||
<span data-i18n-key="footer.traffic" data-i18n-attrs="text"></span>
|
||||
<span data-i18n-key="footer.routed" data-i18n-attrs="text"></span>
|
||||
<span data-i18n-key="footer.webrtc" data-i18n-attrs="text"></span>
|
||||
|
@ -582,7 +582,7 @@
|
|||
</svg>
|
||||
<div class="title-wrapper" dir="ltr">
|
||||
<h1>PairDrop</h1>
|
||||
<div class="font-subheading">v1.10.1</div>
|
||||
<div class="font-subheading">v1.10.5</div>
|
||||
</div>
|
||||
<div class="font-subheading" data-i18n-key="about.claim" data-i18n-attrs="text"></div>
|
||||
<div class="row">
|
||||
|
|
|
@ -1978,12 +1978,15 @@ class ReceiveTextDialog extends Dialog {
|
|||
this._receiveTextQueue = [];
|
||||
}
|
||||
|
||||
selectionEmpty() {
|
||||
return !window.getSelection().toString()
|
||||
}
|
||||
|
||||
async _onKeyDown(e) {
|
||||
if (!this.isShown()) return
|
||||
|
||||
if (e.code === "KeyC" && (e.ctrlKey || e.metaKey)) {
|
||||
if (e.code === "KeyC" && (e.ctrlKey || e.metaKey) && this.selectionEmpty()) {
|
||||
await this._onCopy()
|
||||
this.hide();
|
||||
}
|
||||
else if (e.code === "Escape") {
|
||||
this.hide();
|
||||
|
@ -2014,10 +2017,25 @@ class ReceiveTextDialog extends Dialog {
|
|||
|
||||
// Beautify text if text is short
|
||||
if (text.length < 2000) {
|
||||
// replace urls with actual links
|
||||
this.$text.innerHTML = this.$text.innerHTML.replace(/((https?:\/\/|www)[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\-._~:\/?#\[\]@!$&'()*+,;=]+)/g, url => {
|
||||
return `<a href="${url}" target="_blank">${url}</a>`;
|
||||
});
|
||||
// replace URLs with actual links
|
||||
this.$text.innerHTML = this.$text.innerHTML
|
||||
.replace(/(^|<br>|\s|")((https?:\/\/|www.)(([a-z]|[A-Z]|[0-9]|[\-_~:\/?#\[\]@!$&'()*+,;=%]){2,}\.)(([a-z]|[A-Z]|[0-9]|[\-_~:\/?#\[\]@!$&'()*+,;=%.]){2,}))/g,
|
||||
(match, whitespace, url) => {
|
||||
let link = url;
|
||||
|
||||
// prefix www.example.com with http protocol to prevent it from being a relative link
|
||||
if (link.startsWith('www')) {
|
||||
link = "http://" + link
|
||||
}
|
||||
|
||||
// Check if link is valid
|
||||
if (isUrlValid(link)) {
|
||||
return `${whitespace}<a href="${link}" target="_blank">${url}</a>`;
|
||||
}
|
||||
else {
|
||||
return match;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this._evaluateOverflowing(this.$text);
|
||||
|
@ -2049,7 +2067,10 @@ class ReceiveTextDialog extends Dialog {
|
|||
|
||||
hide() {
|
||||
super.hide();
|
||||
setTimeout(() => this._dequeueRequests(), 500);
|
||||
setTimeout(() => {
|
||||
this._dequeueRequests();
|
||||
this.$text.innerHTML = "";
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -583,4 +583,14 @@ async function decodeBase64Text(base64) {
|
|||
if (!base64) throw new Error('Base64 is empty');
|
||||
|
||||
return decodeURIComponent(escape(window.atob(base64)))
|
||||
}
|
||||
|
||||
function isUrlValid(url) {
|
||||
try {
|
||||
let urlObj = new URL(url);
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
const cacheVersion = 'v1.10.1';
|
||||
const cacheVersion = 'v1.10.5';
|
||||
const cacheTitle = `pairdrop-cache-${cacheVersion}`;
|
||||
const forceFetch = false; // FOR DEVELOPMENT: Set to true to always update assets instead of using cached versions
|
||||
const relativePathsToCache = [
|
||||
|
@ -193,7 +193,7 @@ const evaluateRequestData = function (request) {
|
|||
|
||||
const objectStoreRequest = objectStore.add(fileObjects[i]);
|
||||
objectStoreRequest.onsuccess = _ => {
|
||||
if (i === fileObjects.length - 1) resolve(pairDropUrl + '?share-target=files');
|
||||
if (i === fileObjects.length - 1) resolve(pairDropUrl + '?share_target=files');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ const evaluateRequestData = function (request) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
let urlArgument = '?share-target=text';
|
||||
let urlArgument = '?share_target=text';
|
||||
|
||||
if (title) urlArgument += `&title=${title}`;
|
||||
if (text) urlArgument += `&text=${text}`;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
max-height: 350px;
|
||||
word-break: break-word;
|
||||
word-wrap: anywhere;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.textarea:before {
|
||||
|
@ -335,6 +336,7 @@ x-dialog x-paper {
|
|||
display: flex;
|
||||
margin: auto;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
max-width: 450px;
|
||||
z-index: 3;
|
||||
border-radius: 30px;
|
||||
|
@ -382,10 +384,6 @@ x-dialog:not([show]) x-paper {
|
|||
transform: scale(0.1);
|
||||
}
|
||||
|
||||
x-dialog a {
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
/* Pair Devices Dialog & Public Room Dialog */
|
||||
|
||||
.input-key-container {
|
||||
|
@ -784,7 +782,7 @@ x-dialog x-paper {
|
|||
background-color: var(--bg-color-secondary) !important;
|
||||
}
|
||||
|
||||
.textarea * {
|
||||
.textarea *:not(a) {
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
color: unset !important;
|
||||
|
@ -797,6 +795,10 @@ x-dialog x-paper {
|
|||
font-weight: unset !important;
|
||||
}
|
||||
|
||||
x-dialog a {
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
/* Image/Video/Audio Preview */
|
||||
.file-preview {
|
||||
margin-bottom: 15px;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue