mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +00:00
Updated dashboard
* Added "ShareX user profile" menu item to administration sidebar. This do the same thing as the ShareX icon in the homepage, which is to download a ShareX config. * Updated version string in _globals.njk. A few of the previous commits also modified some JS files, but I forgot to update the version string back then.
This commit is contained in:
parent
2bfe24758c
commit
8e74c7f5bd
@ -110,6 +110,8 @@ page.prepareDashboard = function () {
|
||||
logoutBtn.innerHTML = 'Logout ( ' + page.username + ' )'
|
||||
|
||||
page.getAlbumsSidebar()
|
||||
|
||||
page.prepareShareX()
|
||||
}
|
||||
|
||||
page.logout = function () {
|
||||
@ -1395,6 +1397,30 @@ page.setActiveMenu = function (activeItem) {
|
||||
activeItem.classList.add('is-active')
|
||||
}
|
||||
|
||||
page.prepareShareX = function () {
|
||||
if (page.token) {
|
||||
// TODO: "location.origin" is unsuitable if the safe is hosted in a subdir (e.i. http://example.com/safe)
|
||||
var sharexElement = document.getElementById('ShareX')
|
||||
var sharexFile =
|
||||
'{\r\n' +
|
||||
' "Name": "' + location.hostname + '",\r\n' +
|
||||
' "DestinationType": "ImageUploader, FileUploader",\r\n' +
|
||||
' "RequestType": "POST",\r\n' +
|
||||
' "RequestURL": "' + location.origin + '/api/upload",\r\n' +
|
||||
' "FileFormName": "files[]",\r\n' +
|
||||
' "Headers": {\r\n' +
|
||||
' "token": "' + page.token + '"\r\n' +
|
||||
' },\r\n' +
|
||||
' "ResponseType": "Text",\r\n' +
|
||||
' "URL": "$json:files[0].url$",\r\n' +
|
||||
' "ThumbnailURL": "$json:files[0].url$"\r\n' +
|
||||
'}'
|
||||
var sharexBlob = new Blob([sharexFile], { type: 'application/octet-binary' })
|
||||
sharexElement.setAttribute('href', URL.createObjectURL(sharexBlob))
|
||||
sharexElement.setAttribute('download', location.hostname + '.sxcu')
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
// Add 'no-touch' class to non-touch devices
|
||||
if (!('ontouchstart' in document.documentElement)) {
|
||||
|
@ -393,6 +393,7 @@ page.updateTemplate = function (file, response) {
|
||||
|
||||
page.prepareShareX = function () {
|
||||
if (page.token) {
|
||||
// TODO: "location.origin" is unsuitable if the safe is hosted in a subdir (e.i. http://example.com/safe)
|
||||
var sharexElement = document.getElementById('ShareX')
|
||||
var sharexFile =
|
||||
'{\r\n' +
|
||||
|
@ -15,7 +15,7 @@
|
||||
v2: Images and config files (manifest.json, browserconfig.xml, etc).
|
||||
v3: CSS and JS files (libs such as bulma, lazyload, etc).
|
||||
#}
|
||||
{% set v1 = "IooRwmMNti" %}
|
||||
{% set v1 = "SLAsa9Rk5w" %}
|
||||
{% set v2 = "Ii3JYKIhb0" %}
|
||||
{% set v3 = "HrvcYD3KTh" %}
|
||||
|
||||
|
@ -70,6 +70,9 @@
|
||||
</ul>
|
||||
<p class="menu-label">Administration</p>
|
||||
<ul class="menu-list">
|
||||
<li>
|
||||
<a id="ShareX">ShareX user profile</a>
|
||||
</li>
|
||||
<li>
|
||||
<a id="itemFileLength">File name length</a>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user