From e93b2f39d09201abf917d25548c0ec43ab357385 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Wed, 13 Feb 2019 19:58:42 +0800 Subject: [PATCH] Update index.py --- plugins/gogs/index.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/gogs/index.py b/plugins/gogs/index.py index 296f4c060..444b42b27 100755 --- a/plugins/gogs/index.py +++ b/plugins/gogs/index.py @@ -81,17 +81,19 @@ def status(): def contentReplace(content): - user = public.execShell( - "who | sed -n '2, 1p' |awk '{print $1}'")[0].strip() + user = 'root' + if public.isAppleSystem(): + user = public.execShell( + "who | sed -n '2, 1p' |awk '{print $1}'")[0].strip() + content = content.replace('{$HOME_DIR}', '/Users/' + user) + else: + content = content.replace('{$HOME_DIR}', '/root') + service_path = public.getServerDir() content = content.replace('{$ROOT_PATH}', public.getRootDir()) content = content.replace('{$SERVER_PATH}', service_path) content = content.replace('{$RUN_USER}', user) - if public.isAppleSystem(): - content = content.replace('{$HOME_DIR}', '/Users/' + user) - else: - content = content.replace('{$HOME_DIR}', '/root') return content