Fix nextcloud upload urls

This commit is contained in:
Lukas 2021-05-23 01:14:11 +02:00
parent 96b2bb7ae1
commit 1c78b0b374
2 changed files with 11 additions and 12 deletions

View File

@ -1,8 +1,8 @@
# Grail
Version: 0.6.0
Date: 22.05.2021
Version: 0.6.1
Date: 23.05.2021
## Description:
Instant Upload Screenshot-Tool based on the idea of Gyazoo.
@ -11,4 +11,4 @@ Date: 22.05.2021
->Currently Windows only!
## Precompiled:
[Download](https://git.lukasmahler.de/attachments/3d2f8e4e-b83e-46ee-8c87-936b62ee3a4e "0.6.0")
[Download](https://git.lukasmahler.de/attachments/607f8474-4c42-4c89-a245-3cbd4b66be58 "0.6.1")

View File

@ -1,7 +1,7 @@
__author__ = "Lukas Mahler"
__copyright__ = "Copyright 2018-2021"
__version__ = "0.6.0"
__date__ = "22.05.2021"
__version__ = "0.6.1"
__date__ = "23.05.2021"
__email__ = "lm@ankerlab.de"
__status__ = "Development"
@ -51,7 +51,7 @@ class Fillscreen(QtWidgets.QWidget, Ui_View):
###############################################################################################
###############################################################################################
# Bastelstüble wegen Transparentem Window welches aber den Input auf unterliegendes blockieren soll
# Monkeycode for trying to block input for content under the transparent window.
# self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True)
# self.setBackgroundRole(QtGui.QPalette.Base)
@ -166,7 +166,6 @@ def read_ini(rootdir):
"USR = ; YOUR NEXTCLOUD USER, THIS CAN BE BLANK TO GET ASKED INTERACTIVELY\n"
"PASS = ; YOUR NEXTCLOUD USERS PW, THIS CAN BE BLANK TO GET ASKED INTERACTIVELY\n"
"PTH = ; THE NEXTCLOUD FOLDER PATH WHERE TO PUT THE SCREENSHOT\n"
"WHERE = ; THIS SHOULD BE THE FULL ONLINE URL\n"
"\n"
"# IF MODE IS LOCAL YOU MAY CHANGE THE SETTINGS BELOW\n"
"[LOCAL]\n"
@ -202,15 +201,12 @@ def read_ini(rootdir):
usr = config.get(mode, 'USR')
passw = config.get(mode, 'PASS')
pth = config.get(mode, 'PTH')
where = config.get(mode, 'WHERE')
myini.update(
MODE = mode,
URL = url,
TIMEOUT = timeout,
USR = usr,
PASS = passw,
PTH = pth,
WHERE = sslurl(where, ssl)
)
elif mode == "LOCAL":
where = config.get('LOCAL', 'WHERE')
@ -361,11 +357,9 @@ def upload_to_url_nextcloud(tempsave):
# NEXTCLOUD INFO
url = settings['URL']
timeout = settings['TIMEOUT']
usr = settings['USR']
passw = settings['PASS']
pth = settings['PTH'] + os.path.basename(tempsave)
where = settings['WHERE'] + os.path.basename(tempsave)
# Test Connection first or go into fallback
r = head(url)
@ -392,8 +386,13 @@ def upload_to_url_nextcloud(tempsave):
save_to_local(tempsave, fallback=1)
return
# Had to monkeypatch the pyocclient libary here to stop AttributeErrors on 'share_file_with_link' calls
# (https://github.com/owncloud/pyocclient/issues/263)
print("Starting to Upload...")
nxt.put_file(pth, tempsave)
link_info = nxt.share_file_with_link(pth)
where = link_info.get_link()
print("Screen was Uploaded: URL: " + where)
open_url(where)