mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
Remove image copy to clipboard
This commit is contained in:
parent
2aeaa0c482
commit
7bf0ba4ddd
@ -37,7 +37,8 @@ const app = new Vue({
|
|||||||
isUploading: false,
|
isUploading: false,
|
||||||
currentPaste: {
|
currentPaste: {
|
||||||
ownerKey: '',
|
ownerKey: '',
|
||||||
id: ''
|
id: '',
|
||||||
|
type: '',
|
||||||
},
|
},
|
||||||
newPaste: {
|
newPaste: {
|
||||||
expiration: '1_day',
|
expiration: '1_day',
|
||||||
@ -48,11 +49,7 @@ const app = new Vue({
|
|||||||
and add a class to the html tag with the result */
|
and add a class to the html tag with the result */
|
||||||
support: {
|
support: {
|
||||||
|
|
||||||
clipboard: (function () {
|
clipboard: !!(isSecureContext && navigator.clipboard && navigator.clipboard.writeText),
|
||||||
var val = !!(navigator.clipboard);
|
|
||||||
document.querySelector('html').classList.add((val ? '' : 'no-') + 'clipboard');
|
|
||||||
return val;
|
|
||||||
})(),
|
|
||||||
|
|
||||||
localStorage: (function () {
|
localStorage: (function () {
|
||||||
var val = !!(localStorage);
|
var val = !!(localStorage);
|
||||||
@ -157,23 +154,7 @@ const app = new Vue({
|
|||||||
copyToClipboard: () => {
|
copyToClipboard: () => {
|
||||||
|
|
||||||
var pasteContent = zerobin.getPasteContent();
|
var pasteContent = zerobin.getPasteContent();
|
||||||
let promise;
|
let promise = navigator.clipboard.writeText(pasteContent);
|
||||||
|
|
||||||
if (pasteContent.indexOf("data:image") === 0) {
|
|
||||||
|
|
||||||
promise = fetch(pasteContent).then((res) => {
|
|
||||||
return res.blob().then(blob => {
|
|
||||||
return navigator.clipboard.write([
|
|
||||||
new ClipboardItem({
|
|
||||||
[blob.type]: blob
|
|
||||||
})
|
|
||||||
])
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
} else {
|
|
||||||
promise = navigator.clipboard.writeText(pasteContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
promise.then(function () {
|
promise.then(function () {
|
||||||
zerobin.message('info', 'The paste is now in your clipboard', '', true);
|
zerobin.message('info', 'The paste is now in your clipboard', '', true);
|
||||||
@ -764,6 +745,7 @@ if (content && key) {
|
|||||||
if (content.indexOf('data:image') == 0) {
|
if (content.indexOf('data:image') == 0) {
|
||||||
// Display Image
|
// Display Image
|
||||||
|
|
||||||
|
app.currentPaste.type = "image";
|
||||||
let pasteContent = document.querySelector('#paste-content');
|
let pasteContent = document.querySelector('#paste-content');
|
||||||
pasteContent.style.display = "none";
|
pasteContent.style.display = "none";
|
||||||
|
|
||||||
@ -781,6 +763,8 @@ if (content && key) {
|
|||||||
url: content
|
url: content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
app.currentPaste.type = "text"
|
||||||
}
|
}
|
||||||
bar.set('Code coloration...', '95%');
|
bar.set('Code coloration...', '95%');
|
||||||
|
|
||||||
@ -820,9 +804,9 @@ if (content && key) {
|
|||||||
|
|
||||||
} /* End of "DECRYPTION" */
|
} /* End of "DECRYPTION" */
|
||||||
|
|
||||||
/* Display bottom paste option buttons when needed */
|
|
||||||
|
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
|
|
||||||
|
/* Display bottom paste option buttons when needed */
|
||||||
["keyup", "change"].forEach((event) => {
|
["keyup", "change"].forEach((event) => {
|
||||||
let content = document.getElementById("content");
|
let content = document.getElementById("content");
|
||||||
content.addEventListener(event, () => {
|
content.addEventListener(event, () => {
|
||||||
|
@ -91,7 +91,6 @@
|
|||||||
%else:
|
%else:
|
||||||
<script src="/static/js/lzw.js"></script>
|
<script src="/static/js/lzw.js"></script>
|
||||||
<script src="/static/js/prettify.min.js"></script>
|
<script src="/static/js/prettify.min.js"></script>
|
||||||
<script src="/static/js/ZeroClipboard.js"></script>
|
|
||||||
%end
|
%end
|
||||||
|
|
||||||
<p id="alert-template" class="alert-primary">
|
<p id="alert-template" class="alert-primary">
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
This is not proven, though! :-)
|
This is not proven, though! :-)
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<tr>What if the server changes the JavaScript code? And what happens in the case of a <a href="https://en.wikipedia.org/wiki/Man-in-the-middle_attack">MITM attack</a>?</tr>
|
<tr>What if the server changes the JavaScript code? And what happens in the case of a <a
|
||||||
|
href="https://en.wikipedia.org/wiki/Man-in-the-middle_attack">MITM attack</a>?</tr>
|
||||||
<td>
|
<td>
|
||||||
<p>Read above.</p>
|
<p>Read above.</p>
|
||||||
<p>0bin is not built, and does not aim, to protect user data - but rather the host.
|
<p>0bin is not built, and does not aim, to protect user data - but rather the host.
|
||||||
@ -46,23 +47,28 @@
|
|||||||
installed 0bin in the first place, as 0bin is here to protect them.</p>
|
installed 0bin in the first place, as 0bin is here to protect them.</p>
|
||||||
<p><strong>However, if you want to ensure your data is not read in anyway, you should
|
<p><strong>However, if you want to ensure your data is not read in anyway, you should
|
||||||
not use 0bin</strong>. Use <a href="http://www.cypherpunks.ca/otr/">OTR</a> for chatting,
|
not use 0bin</strong>. Use <a href="http://www.cypherpunks.ca/otr/">OTR</a> for chatting,
|
||||||
<a href="https://gnupg.org/">GnuPG</a> for encrypted & verified data sharing, with <a href="https://www.enigmail.net/">EnigMail</a>
|
<a href="https://gnupg.org/">GnuPG</a> for encrypted & verified data sharing, with <a
|
||||||
|
href="https://www.enigmail.net/">EnigMail</a>
|
||||||
for emails.</p>
|
for emails.</p>
|
||||||
<p>It would be unlikely for those softwares to fail you. Errors will nearly always come from your side - you ought to have a perfect <a href="https://en.wikipedia.org/wiki/Operations_security">operations security</a>
|
<p>It would be unlikely for those softwares to fail you. Errors will nearly always come from your side - you
|
||||||
|
ought to have a perfect <a href="https://en.wikipedia.org/wiki/Operations_security">operations security</a>
|
||||||
if you do not want your data to be leaked. Remember to use your common sense.</p>
|
if you do not want your data to be leaked. Remember to use your common sense.</p>
|
||||||
</td>
|
</td>
|
||||||
<tr>How did the idea of 0bin emerge?</tr>
|
<tr>How did the idea of 0bin emerge?</tr>
|
||||||
<td>
|
<td>
|
||||||
<p>0bin is based on <a href="http://sebsauvage.net/wiki/doku.php?id=php:zerobin">sebsauvage's work</a>.
|
<p>0bin is based on <a href="http://sebsauvage.net/wiki/doku.php?id=php:zerobin">sebsauvage's work</a>.
|
||||||
The project sprang as a reaction to <a href="https://www.zdnet.com/blog/security/pastebin-to-hunt-for-hacker-pastes-anonymous-cries-censorship/11336">the implementation of a moderation system on Pastebin</a>,
|
The project sprang as a reaction to <a
|
||||||
|
href="https://www.zdnet.com/blog/security/pastebin-to-hunt-for-hacker-pastes-anonymous-cries-censorship/11336">the
|
||||||
|
implementation of a moderation system on Pastebin</a>,
|
||||||
due to the significant amount of illegal content pasted on it, or that it linked to.</p>
|
due to the significant amount of illegal content pasted on it, or that it linked to.</p>
|
||||||
</td>
|
</td>
|
||||||
<tr>How can I get 0bin?</tr>
|
<tr>How can I get 0bin?</tr>
|
||||||
<td>
|
<td>
|
||||||
<p>0bin is an open-source project, and the code is hosted on <a href="https://github.com/sametmax/0bin">GitHub</a>.
|
<p>0bin is an open-source project, and the code is hosted on <a
|
||||||
|
href="https://github.com/sametmax/0bin">GitHub</a>.
|
||||||
You can either download a tarball or clone the repository.</p>
|
You can either download a tarball or clone the repository.</p>
|
||||||
</td>
|
</td>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -19,14 +19,16 @@
|
|||||||
%end
|
%end
|
||||||
%end
|
%end
|
||||||
|
|
||||||
|
<h1>{% currentPaste.type %}</h1>
|
||||||
|
|
||||||
<div class="well paste-form">
|
<div class="well paste-form">
|
||||||
<form action="/" method="get" accept-charset="utf-8">
|
<form action="/" method="get" accept-charset="utf-8">
|
||||||
|
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
|
|
||||||
<div class="btn-group" role="group">
|
<div class="btn-group" role="group">
|
||||||
<button v-if="support.clipboard" @click.prevent="copyToClipboard()" type="button" id="clip-button"
|
<button v-if="support.clipboard && currentPaste.type === 'text'" @click.prevent="copyToClipboard()"
|
||||||
class="btn btn-secondary">Copy To Clipboard</button>
|
type="button" id="clip-button" class="btn btn-secondary">Copy to clipboard</button>
|
||||||
<button type="button" id="email-link" class="btn btn-secondary" @click="handleSendByEmail($event)">Email
|
<button type="button" id="email-link" class="btn btn-secondary" @click="handleSendByEmail($event)">Email
|
||||||
this</button>
|
this</button>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user