add rclone
This commit is contained in:
parent
80e5f59cf7
commit
27e0e0256f
|
@ -163,6 +163,9 @@ dotfiles: # {{{
|
|||
dst: ~/.config
|
||||
actions:
|
||||
- vdirsyncer
|
||||
rclone:
|
||||
src: rclone.conf
|
||||
dst: ~/.config/rclone/rclone.conf
|
||||
mutt:
|
||||
src: neomutt/
|
||||
dst: ~/.config/neomutt/
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
[{{@@ mail.strip("mail.").split(".")[0] @@}}]
|
||||
type = webdav
|
||||
vendor = nextcloud
|
||||
user = {{@@ username @@}}
|
||||
pass = {{@@ rclone_obscure(mail) @@}}
|
||||
url = https://cloud.{{@@ mail @@}}/remote.php/webdav/
|
19
funcs.py
19
funcs.py
|
@ -1,4 +1,6 @@
|
|||
import os
|
||||
from subprocess import check_output
|
||||
import re
|
||||
|
||||
|
||||
def parent_dir(path):
|
||||
|
@ -31,3 +33,20 @@ def hex2rgb(e):
|
|||
b = e[4:6]
|
||||
|
||||
return ", ".join([h2r(i) for i in (r, g, b)])
|
||||
|
||||
|
||||
def rclone_obscure(pass_name):
|
||||
try:
|
||||
fPath = os.path.expanduser("~/.config/rclone/rclone.conf")
|
||||
t = open(fPath, 'r').read()
|
||||
|
||||
PASSWORD_PATTERN = r'^pass *= *(.*)$'
|
||||
password = re.search(PASSWORD_PATTERN, t, re.M).group(1)
|
||||
return password
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def sh(*args):
|
||||
return check_output(args).decode().strip()
|
||||
|
||||
return sh("rclone", "obscure", sh("_get-pass", pass_name))
|
||||
|
|
Loading…
Reference in New Issue