deletion token in ui, other minor fixes

This commit is contained in:
Andrea Spacca 2021-07-17 10:12:59 +02:00
parent ac7014a9c3
commit 8b8af59a0f
20 changed files with 9651 additions and 25807 deletions

View File

@ -242,6 +242,12 @@ module.exports = function (grunt) {
}
},
'npm-command': {
'videojs-update': {
options: {
cmd: 'update',
cwd: '<%= yeoman.app %>/bower_components/videojs/'
}
},
'videojs-install': {
options: {
cmd: 'install',

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
"tests"
],
"dependencies": {
"videojs": "~7.10.2",
"videojs": "~7.13.3",
"bootstrap": "~3.0.0",
"modernizr": "~2.6.2",
"uri.js": "~1.14.1",

2
go.mod
View File

@ -1,3 +1,5 @@
module github.com/dutchcoders/transfer.sh-web
go 1.15
require github.com/shuLhan/go-bindata v4.0.0+incompatible // indirect

2
go.sum Normal file
View File

@ -0,0 +1,2 @@
github.com/shuLhan/go-bindata v4.0.0+incompatible h1:xD8LkuVZLV5OOn/IEuFdt6EEAW7deWiqgwaaSGhjAJc=
github.com/shuLhan/go-bindata v4.0.0+incompatible/go.mod h1:pkcPAATLBDD2+SpAPnX5vEM90F7fcwHCvvLCMXcmw3g=

9104
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,10 @@ include "includes/download-navigation.html"
</div>
</div>
<br/>
include "includes/download-delete.html"
<br/>
</div>
</section>

View File

@ -18,6 +18,10 @@ include "includes/download-navigation.html"
<div class="wrapper">
include "includes/download-top.html"
<br/>
include "includes/download-delete.html"
<br/>
</div>
</section>

View File

@ -29,8 +29,11 @@ include "includes/download-navigation.html"
</div>
</div>
<br/>
<div>
<div>
include "includes/download-delete.html"
<br/>
</div>
</section>
include "includes/download-footer.html"

View File

@ -29,6 +29,10 @@ include "includes/download-navigation.html"
</div>
<br/>
include "includes/download-delete.html"
<br/>
</div>
</section>

View File

@ -20,6 +20,10 @@ include "includes/download-navigation.html"
<br/>
include "includes/download-delete.html"
<br/>
</div>
</section>

View File

@ -36,6 +36,10 @@ include "includes/download-navigation.html"
</div>
</div>
<br/>
include "includes/download-delete.html"
<br/>
</div>
</section>

View File

@ -0,0 +1,13 @@
<a href="{{.Url}}" id="fire-delete" class="btn-cta btn"> delete</i> </a> <br/><br/>
<div class="delete-modal row animated fadeInDown">
<div id="from-terminal" class=" box col-md-8 col-md-offset-2 col-xs-12">
<div class="terminal-top">
</div>
<div class="terminal">
<div id="web">
<input type="text" id="deletion-token" value="" placeholder="Please enter the deletion token">
<a href="#" id="confirm-delete" class="btn-cta btn"> confirm</i> </a> <br/><br/>
</div>
</div>
</div>
</div>

View File

@ -43,11 +43,11 @@ include "includes/navigation.html"
</div>
<div id="terminal" class="terminal">
<code class="code-wrapper"><span class="code-title"># Upload using cURL</span>
$ curl --upload-file ./hello.txt {{.WebAddress}}hello.txt {{.WebAddress}}66nb8/hello.txt
$ curl --upload-file ./hello.txt {{.WebAddress}}hello.txt {{.WebAddress}}{{.SampleToken}}/hello.txt
<span class="code-title"># Using the shell function</span>
$ transfer hello.txt
##################################################### 100.0% {{.WebAddress}}eibhM/hello.txt
##################################################### 100.0% {{.WebAddress}}{{.SampleToken2}}/hello.txt
</code>
</div>
<div id="web">
@ -95,10 +95,17 @@ include "includes/navigation.html"
<i class="icon-database"></i>
<h3>Upload up to 10 GB</h3>
</div>
{{ if .PurgeTime }}
<div class="col-md-3 col-xs-6">
<i class="icon-clock"></i>
<h3>Files stored for 14 days</h3>
<h3>Files stored for {{ .PurgeTime }}</h3>
</div>
{{ else }}
<div class="col-md-3 col-xs-6">
<i class="icon-clock"></i>
<h3>Files stored forever</h3>
</div>
{{ end }}
</div>
<div class="row animated fadeInDown">
<div class="col-md-offset-3 col-md-3 col-xs-6">
@ -138,13 +145,13 @@ include "includes/navigation.html"
<div class="terminal">
<code class="code-wrapper"><span class="code-title"># Uploading is easy using curl</span>
$ curl --upload-file ./hello.txt {{.WebAddress}}hello.txt
{{.WebAddress}}66nb8/hello.txt
{{.WebAddress}}{{.SampleToken}}/hello.txt
$ curl -H "Max-Downloads: 1" -H "Max-Days: 5" --upload-file ./hello.txt {{.WebAddress}}hello.txt
{{.WebAddress}}66nb8/hello.txt
{{.WebAddress}}{{.SampleToken}}/hello.txt
<span class="code-title"># Download the file</span>
$ curl {{.WebAddress}}66nb8/hello.txt -o hello.txt
$ curl {{.WebAddress}}{{.SampleToken}}/hello.txt -o hello.txt
</code>
</div>
</div>
@ -177,8 +184,8 @@ include "includes/navigation.html"
$ curl -i -F filedata=@/tmp/hello.txt -F filedata=@/tmp/hello2.txt {{.WebAddress}}
<span class="code-title"># Combining downloads as zip or tar archive</span>
$ curl {{.WebAddress}}(15HKz/hello.txt,15HKz/hello.txt).tar.gz
$ curl {{.WebAddress}}(15HKz/hello.txt,15HKz/hello.txt).zip
$ curl {{.WebAddress}}({{.SampleToken}}/hello.txt,{{.SampleToken2}}/world.txt).tar.gz
$ curl {{.WebAddress}}({{.SampleToken}}/hello.txt,{{.SampleToken2}}/world.txt).zip
</code>
</div>
@ -193,7 +200,7 @@ include "includes/navigation.html"
$ cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file "-" {{.WebAddress}}test.txt
<span class="code-title"># Download and decrypt</span>
$ curl {{.WebAddress}}1lDau/test.txt|gpg -o- > /tmp/hello.txt
$ curl {{.WebAddress}}{{.SampleToken}}/test.txt|gpg -o- > /tmp/hello.txt
</code>
</div>
</div>
@ -245,7 +252,7 @@ include "includes/navigation.html"
<span class="code-title"># Encrypt for recipient(s)</span>
$ cat somebackupfile.tar.gz | keybase encrypt [them] | curl --upload-file '-' {{.WebAddress}}test.txt
<span class="code-title"># Decrypt</span>
$ curl {{.WebAddress}}sqUFi/test.md |keybase decrypt
$ curl {{.WebAddress}}{{.SampleToken}}/test.md |keybase decrypt
</code>
</div>
</div>
@ -306,7 +313,7 @@ include "includes/navigation.html"
<span class="code-title"># transfersh-cli (https://github.com/tanrax/transfersh-cli)</span>
$ transfersh photos.zip
<span class="code-title"># Uploading file</span>
<span class="code-title"># Download from here: {{.WebAddress}}xxxxxx/photos.zip</span>
<span class="code-title"># Download from here: {{.WebAddress}}{{.SampleToken}}/photos.zip</span>
<span class="code-title"># It has also been copied to the clipboard!</span>
</code>
</div>
@ -320,7 +327,7 @@ include "includes/navigation.html"
$ cat /tmp/hello.txt|openssl aes-256-cbc -pbkdf2 -e|curl -X PUT --upload-file "-" {{.WebAddress}}test.txt
<span class="code-title"># Download and decrypt</span>
$ curl {{.WebAddress}}1lDau/test.txt|openssl aes-256-cbc -pbkdf2 -d > /tmp/hello.txt
$ curl {{.WebAddress}}{{.SampleToken}}/test.txt|openssl aes-256-cbc -pbkdf2 -d > /tmp/hello.txt
</code>
</div>
</div>

View File

@ -9,13 +9,13 @@ Encrypt with gpg & upload:
$ cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file "-" {{.WebAddress}}test.txt
Download & decrypt with gpg:
$ curl {{.WebAddress}}1lDau/test.txt|gpg -o- > /tmp/hello.txt
$ curl {{.WebAddress}}{{.SampleToken}}/test.txt|gpg -o- > /tmp/hello.txt
Encrypt with openssl & upload:
$ cat /tmp/hello.txt|openssl aes-256-cbc -pbkdf2 -e|curl -X PUT --upload-file "-" {{.WebAddress}}test.txt
Download & decrypt with openssl:
$ curl {{.WebAddress}}1lDau/test.txt|openssl aes-256-cbc -pbkdf2 -d > /tmp/hello.txt
$ curl {{.WebAddress}}{{.SampleToken}}/test.txt|openssl aes-256-cbc -pbkdf2 -d > /tmp/hello.txt
Grep pound from syslog and transfer
cat /var/log/syslog|grep pound|curl --upload-file - {{.WebAddress}}pound.log
@ -28,7 +28,7 @@ $ keybase track [them]
$ cat somebackupfile.tar.gz | keybase encrypt [them] | curl --upload-file '-' {{.WebAddress}}test.txt
# decrypt
$ curl {{.WebAddress}}sqUFi/test.md |keybase decrypt
$ curl {{.WebAddress}}{{.SampleToken}}/test.md |keybase decrypt
Upload to Virustotal:
$ curl -X PUT --upload-file nhgbhhj {{.WebAddress}}test.txt/virustotal

View File

@ -30,6 +30,41 @@ $(document).ready(function() {
return 'There are still ' + queue.length + ' files being uploaded.';
});
function deleteFile(baseURL) {
var deleteModal = $('.delete-modal');
if (deleteModal.hasClass('show')) {
deleteModal.removeClass('show');
} else {
deleteModal.addClass('show');
}
deleteModal.find('input[placeholder]').each(function () {
$(this).attr('size', $(this).attr('placeholder').length);
});
$('#confirm-delete').on('click', function (event) {
event.stopPropagation();
event.preventDefault();
var deletionToken = $('#deletion-token').val();
if (deletionToken.length > 0) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
deleteModal.find('#web').html('<span style="clear:both">File deleted</span></div>');
} else {
deleteModal.find('#web').append('<span>Error (' + xhr.status + ') during deletion of file</span>');
}
}
};
// start deletion
xhr.open('DELETE', baseURL + '/' + deletionToken, true);
xhr.send();
}
});
}
function upload(file) {
$('.browse').addClass('uploading');
@ -44,17 +79,18 @@ $(document).ready(function() {
var pc = parseInt((e.loaded / e.total * 100));
$('.upload-progress', $(li)).show();
$('.upload-progress .bar', $(li)).css('width', pc + '%');
$('.upload-progress span ', $(li)).empty().append(pc + '%');
$('.upload-progress span', $(li)).empty().append(pc + '%');
}, false);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
/* $('.upload-progress', $(li)).hide();*/
$('#web').addClass('uploading');
// progress.className = (xhr.status == 200 ? "success" : "failure");
if (xhr.status === 200) {
$(li).html('<a target="_blank" href="' + xhr.responseText + '">' + xhr.responseText + '</a>');
var deletionToken = xhr.getResponseHeader('X-Url-Delete').split('/').pop();
var url = $('<p></p>').text(xhr.responseText).html();
$(li).html('<a target="_blank" href="' + url + '">' + url + '</a><br/><br/>' +
'<span class="code-title"># Delete URL</span><br/>' + deletionToken);
} else {
$(li).html('<span>Error (' + xhr.status + ') during upload of file ' + file.name + '</span>');
}
@ -118,6 +154,12 @@ $(document).ready(function() {
});
});
$('a#fire-delete').on('click', function(event) {
event.stopPropagation();
event.preventDefault();
deleteFile($(this).attr('href'));
});
// clipboard
if (window.location.href.indexOf('download') > -1 ) {

View File

@ -2,7 +2,7 @@ $(document).ready(function () {
// Terminal typing animation
$("#from-terminal p").typed({
strings: ["curl --upload-file ./hello.txt {{.WebAddress}}hello.txt\n{{.WebAddress}}66nb8/hello.txt \n "],
strings: ["curl --upload-file ./hello.txt {{.WebAddress}}hello.txt\n{{.WebAddress}}{{.SampleToken}}/hello.txt \n "],
typeSpeed: 0,
loop: true,
});

View File

@ -1,3 +1,12 @@
.delete-modal {
display: none;
}
.delete-modal .show {
display: block;
}
.preview-wrapper {
padding-bottom: 30px;
}

View File

@ -6555,6 +6555,12 @@ blockquote.tweet-xl a {
.icon-gplus:before {
content: "p";
}
.delete-modal {
display: none;
}
.delete-modal .show {
display: block;
}
.preview-wrapper {
padding-bottom: 30px;
}

File diff suppressed because one or more lines are too long