This commit is contained in:
Thomas Criscione 2025-09-24 17:34:39 +02:00 committed by GitHub
commit 6301876f98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 3 deletions

View File

@ -13,16 +13,20 @@ userscript setup:
[nextcloud]
HOST=https://nextcloud.example.com
USER=username
;PASSWORD=lamepassword
PASSWORD=lamepassword
PASS=password_command
;PASS=pass bookmarks/user
;PASS=NONE
DESCRIPTION=None
;TAGS=just-one
TAGS=read-me-later,added-by-qutebrowser, Another-One
If settings aren't in the configuration file, the user will be prompted during
bookmark creation. If DESCRIPTION and TAGS are set to None, they will be left
blank. If the user does not want to be prompted for a password, it is recommended
blank. If the user does not want to use his password, it is recommended
to set up an 'app password'. See the following for instructions:
https://docs.nextcloud.com/server/latest/user_manual/en/session_management.html#managing-devices # noqa: E501
pass option has been added to avoid clear password in a conf file.
qutebrowser setup:
add bookmark via hints
@ -37,6 +41,8 @@ troubleshooting:
"""
import configparser
import subprocess
from json import dumps
from os import environ, path
from sys import argv, exit
@ -95,20 +101,28 @@ if path.isfile(config_file):
config = configparser.ConfigParser()
config.read(config_file)
settings = dict(config.items("nextcloud"))
if settings["pass"] != "":
passcommand= settings["pass"]
process = subprocess.run(passcommand.split(), capture_output=True, text=True)
output = process.stdout
password=output.partition('\n')[0]
settings["password"]=password
else:
settings = {}
settings_info = [
("host", "host information.", "required"),
("user", "username.", "required"),
("password", "password.", "required"),
("pass", "pass command.", "noinput"),
("description", "description or leave blank", "optional"),
("tags", "tags (comma separated) or leave blank", "optional"),
]
# check for settings that need user interaction and clear optional setting if need be
for setting in settings_info:
if setting[0] not in settings:
if setting[0] not in settings and setting[2] != "noinput":
userInput = get_text(setting[0], setting[1])
settings[setting[0]] = userInput
if setting[2] == "optional":