Browse Source

rename project

pull/157/head
Luckyvb 4 years ago
parent
commit
b781e4882e
  1. 110
      PBSDiscordDark.sh
  2. 0
      PBSDiscordDark/images/dd_arrows.png
  3. 0
      PBSDiscordDark/images/dd_cephblurp.png
  4. 0
      PBSDiscordDark/images/dd_cephwhite.png
  5. 0
      PBSDiscordDark/images/dd_clear-trigger.png
  6. 0
      PBSDiscordDark/images/dd_default-toolbar-small-arrow.png
  7. 0
      PBSDiscordDark/images/dd_default-toolbar-small-s-arrow.png
  8. 0
      PBSDiscordDark/images/dd_icon-cd.png
  9. 0
      PBSDiscordDark/images/dd_icon-cdblurp.png
  10. 0
      PBSDiscordDark/images/dd_icon-cloud.png
  11. 0
      PBSDiscordDark/images/dd_icon-cpu.png
  12. 0
      PBSDiscordDark/images/dd_icon-die.svg
  13. 0
      PBSDiscordDark/images/dd_icon-display.png
  14. 0
      PBSDiscordDark/images/dd_icon-hdd.png
  15. 0
      PBSDiscordDark/images/dd_icon-network.png
  16. 0
      PBSDiscordDark/images/dd_icon-pci.png
  17. 0
      PBSDiscordDark/images/dd_icon-ram.png
  18. 0
      PBSDiscordDark/images/dd_icon-serial.png
  19. 0
      PBSDiscordDark/images/dd_icon-swap.png
  20. 0
      PBSDiscordDark/images/dd_icon-usb.png
  21. 0
      PBSDiscordDark/images/dd_loading.svg
  22. 0
      PBSDiscordDark/images/dd_logo.png
  23. 0
      PBSDiscordDark/images/dd_logo_blurp.png
  24. 0
      PBSDiscordDark/images/dd_mini-bottom.png
  25. 0
      PBSDiscordDark/images/dd_mini-top.png
  26. 2
      PBSDiscordDark/images/dd_readme
  27. 0
      PBSDiscordDark/images/dd_tool-sprites.png
  28. 0
      PBSDiscordDark/images/dd_trigger.png
  29. 0
      PBSDiscordDark/js/PBSDiscordDark.js
  30. 0
      PBSDiscordDark/sass/PBSDiscordDark.css
  31. 0
      PBSDiscordDark/sass/PBSDiscordDark.sass
  32. 0
      PBSDiscordDark/sass/_vars.sass
  33. 0
      PBSDiscordDark/sass/proxmox/_proxmoxRRDChart.sass
  34. 0
      PBSDiscordDark/sass/proxmox/_pveCeph.sass
  35. 0
      PBSDiscordDark/sass/proxmox/_pveDc.sass
  36. 0
      PBSDiscordDark/sass/special/_borders.sass
  37. 0
      PBSDiscordDark/sass/special/_icons.sass
  38. 0
      PBSDiscordDark/sass/special/_proxmox.sass
  39. 0
      PBSDiscordDark/sass/special/_specific.sass
  40. 0
      PBSDiscordDark/sass/x/_autocontainer.sass
  41. 0
      PBSDiscordDark/sass/x/_body.sass
  42. 0
      PBSDiscordDark/sass/x/_boundlist.sass
  43. 0
      PBSDiscordDark/sass/x/_box.sass
  44. 0
      PBSDiscordDark/sass/x/_btn.sass
  45. 0
      PBSDiscordDark/sass/x/_column.sass
  46. 0
      PBSDiscordDark/sass/x/_component.sass
  47. 0
      PBSDiscordDark/sass/x/_datepicker.sass
  48. 0
      PBSDiscordDark/sass/x/_form.sass
  49. 0
      PBSDiscordDark/sass/x/_grid.sass
  50. 0
      PBSDiscordDark/sass/x/_legend.sass
  51. 0
      PBSDiscordDark/sass/x/_mask.sass
  52. 0
      PBSDiscordDark/sass/x/_menu.sass
  53. 0
      PBSDiscordDark/sass/x/_misc.sass
  54. 0
      PBSDiscordDark/sass/x/_panel.sass
  55. 0
      PBSDiscordDark/sass/x/_progress.sass
  56. 0
      PBSDiscordDark/sass/x/_splitter.sass
  57. 0
      PBSDiscordDark/sass/x/_tab.sass
  58. 0
      PBSDiscordDark/sass/x/_tip.sass
  59. 0
      PBSDiscordDark/sass/x/_title.sass
  60. 0
      PBSDiscordDark/sass/x/_toolbar.sass
  61. 0
      PBSDiscordDark/sass/x/_tree.sass
  62. 0
      PBSDiscordDark/sass/x/_treelist.sass
  63. 0
      PBSDiscordDark/sass/x/_viewport.sass
  64. 0
      PBSDiscordDark/sass/x/_window.sass
  65. 191
      PVEDiscordDark.py
  66. 241
      PVEDiscordDark.sh
  67. 2
      PVEDiscordDark/images/dd_readme
  68. 69
      PVEDiscordDark/js/PVEDiscordDark.js
  69. 1
      PVEDiscordDark/sass/PVEDiscordDark.css
  70. 6
      UtilityUpdater.sh

110
PBSDiscordDark.sh

@ -1,5 +1,5 @@
#!/bin/bash
# https://github.com/Weilbyte/PVEDiscordDark
# https://github.com/Luckyvb/PBSDiscordDark
#region Consts
RED='\033[0;31m'
@ -13,7 +13,7 @@ CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m'
TEMPLATE_FILE="/usr/share/javascript/proxmox-backup/index.hbs"
SCRIPTPATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
REPO=${REPO:-"Weilbyte/PVEDiscordDark"}
REPO=${REPO:-"Luckyvb/PBSDiscordDark"}
DEFAULT_TAG="master"
TAG=${TAG:-$DEFAULT_TAG}
BASE_URL="https://raw.githubusercontent.com/$REPO/$TAG"
@ -60,7 +60,7 @@ function checkSupported {
local SUPPORTEDARR=($(echo "$SUPPORTED" | tr ',' '\n'))
if ! (printf '%s\n' "${SUPPORTEDARR[@]}" | grep -q -P "$PBSVersionMajor"); then
echo -e "${WARN}You might encounter issues because your version ($PBSVersionMajor) is not matching currently supported versions ($SUPPORTED)."
echo -e "If you do run into any issues on >newer< versions, please consider opening an issue at https://github.com/Weilbyte/PVEDiscordDark/issues.${REG}"
echo -e "If you do run into any issues on >newer< versions, please consider opening an issue at https://github.com/Luckyvb/PBSDiscordDark/issues.${REG}"
fi
fi
}
@ -94,7 +94,7 @@ function usage {
echo -e " 0 OK"
echo -e " 1 Failure"
echo -e " 2 Already installed, OR not installed (when using install/uninstall commands)\n"
echo -e "Report issues at: <https://github.com/Weilbyte/PVEDiscordDark/issues>"
echo -e "Report issues at: <https://github.com/Luckyvb/PBSDiscordDark/issues>"
fi
}
@ -128,10 +128,10 @@ function install {
cp $TEMPLATE_FILE $TEMPLATE_FILE.bak
if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Downloading stylesheet"; fi
curl -s $BASE_URL/PVEDiscordDark/sass/PVEDiscordDark.css > /usr/share/javascript/proxmox-backup/css/dd_style.css
curl -s $BASE_URL/PBSDiscordDark/sass/PBSDiscordDark.css > /usr/share/javascript/proxmox-backup/css/dd_style.css
if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Downloading patcher"; fi
curl -s $BASE_URL/PVEDiscordDark/js/PVEDiscordDark.js > /usr/share/javascript/proxmox-backup/js/dd_patcher.js
curl -s $BASE_URL/PBSDiscordDark/js/PBSDiscordDark.js > /usr/share/javascript/proxmox-backup/js/dd_patcher.js
if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Applying changes to template file"; fi
if !(grep -Fq "<link rel='stylesheet' type='text/css' href='/css/dd_style.css'>" $TEMPLATE_FILE); then
@ -147,7 +147,7 @@ function install {
ITER=0
for image in "${IMAGELISTARR[@]}"
do
curl -s $BASE_URL/PVEDiscordDark/images/$image > /usr/share/javascript/proxmox-backup/images/$image
curl -s $BASE_URL/PBSDiscordDark/images/$image > /usr/share/javascript/proxmox-backup/images/$image
((ITER++))
if [ "$_silent" = false ]; then echo -e "\e[1A\e[KDownloading images ($ITER/${#IMAGELISTARR[@]})"; fi
done
@ -189,54 +189,54 @@ _noexit=false
parse_cli()
{
while test $# -gt -0
do
_key="$1"
case "$_key" in
-h|--help)
usage
exit 0
;;
-s|--silent)
_silent=true
;;
status)
if [ "$_command" = false ]; then
_command=true
status
fi
;;
install)
if [ "$_command" = false ]; then
_command=true
install
exit 0
fi
;;
uninstall)
if [ "$_command" = false ]; then
_command=true
uninstall
exit 0
fi
;;
update)
if [ "$_command" = false ]; then
_command=true
_noexit=true
uninstall
install
exit 0
fi
;;
*)
echo -e "${BRED}Error: Got an unexpected argument \"$_key\"${REG}\n";
usage;
exit 1;
;;
esac
shift
done
while test $# -gt -0
do
key="$1"
case "$_key" in
-h|--help)
usage
exit 0
;;
-s|--silent)
_silent=true
;;
status)
if [ "$_command" = false ]; then
_command=true
status
fi
;;
install)
if [ "$_command" = false ]; then
_command=true
install
exit 0
fi
;;
uninstall)
if [ "$_command" = false ]; then
_command=true
uninstall
exit 0
fi
;;
update)
if [ "$_command" = false ]; then
_command=true
_noexit=true
uninstall
install
exit 0
fi
;;
*)
echo -e "${BRED}Error: Got an unexpected argument \"$_key\"${REG}\n";
usage;
exit 1;
;;
esac
shift
done
}
parse_cli "$@"

0
PVEDiscordDark/images/dd_arrows.png → PBSDiscordDark/images/dd_arrows.png

Before

Width:  |  Height:  |  Size: 332 B

After

Width:  |  Height:  |  Size: 332 B

0
PVEDiscordDark/images/dd_cephblurp.png → PBSDiscordDark/images/dd_cephblurp.png

Before

Width:  |  Height:  |  Size: 545 B

After

Width:  |  Height:  |  Size: 545 B

0
PVEDiscordDark/images/dd_cephwhite.png → PBSDiscordDark/images/dd_cephwhite.png

Before

Width:  |  Height:  |  Size: 421 B

After

Width:  |  Height:  |  Size: 421 B

0
PVEDiscordDark/images/dd_clear-trigger.png → PBSDiscordDark/images/dd_clear-trigger.png

Before

Width:  |  Height:  |  Size: 308 B

After

Width:  |  Height:  |  Size: 308 B

0
PVEDiscordDark/images/dd_default-toolbar-small-arrow.png → PBSDiscordDark/images/dd_default-toolbar-small-arrow.png

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 192 B

0
PVEDiscordDark/images/dd_default-toolbar-small-s-arrow.png → PBSDiscordDark/images/dd_default-toolbar-small-s-arrow.png

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 208 B

0
PVEDiscordDark/images/dd_icon-cd.png → PBSDiscordDark/images/dd_icon-cd.png

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 300 B

0
PVEDiscordDark/images/dd_icon-cdblurp.png → PBSDiscordDark/images/dd_icon-cdblurp.png

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

0
PVEDiscordDark/images/dd_icon-cloud.png → PBSDiscordDark/images/dd_icon-cloud.png

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

0
PVEDiscordDark/images/dd_icon-cpu.png → PBSDiscordDark/images/dd_icon-cpu.png

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

0
PVEDiscordDark/images/dd_icon-die.svg → PBSDiscordDark/images/dd_icon-die.svg

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

0
PVEDiscordDark/images/dd_icon-display.png → PBSDiscordDark/images/dd_icon-display.png

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 271 B

0
PVEDiscordDark/images/dd_icon-hdd.png → PBSDiscordDark/images/dd_icon-hdd.png

Before

Width:  |  Height:  |  Size: 352 B

After

Width:  |  Height:  |  Size: 352 B

0
PVEDiscordDark/images/dd_icon-network.png → PBSDiscordDark/images/dd_icon-network.png

Before

Width:  |  Height:  |  Size: 291 B

After

Width:  |  Height:  |  Size: 291 B

0
PVEDiscordDark/images/dd_icon-pci.png → PBSDiscordDark/images/dd_icon-pci.png

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 191 B

0
PVEDiscordDark/images/dd_icon-ram.png → PBSDiscordDark/images/dd_icon-ram.png

Before

Width:  |  Height:  |  Size: 168 B

After

Width:  |  Height:  |  Size: 168 B

0
PVEDiscordDark/images/dd_icon-serial.png → PBSDiscordDark/images/dd_icon-serial.png

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

0
PVEDiscordDark/images/dd_icon-swap.png → PBSDiscordDark/images/dd_icon-swap.png

Before

Width:  |  Height:  |  Size: 393 B

After

Width:  |  Height:  |  Size: 393 B

0
PVEDiscordDark/images/dd_icon-usb.png → PBSDiscordDark/images/dd_icon-usb.png

Before

Width:  |  Height:  |  Size: 309 B

After

Width:  |  Height:  |  Size: 309 B

0
PVEDiscordDark/images/dd_loading.svg → PBSDiscordDark/images/dd_loading.svg

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
PVEDiscordDark/images/dd_logo.png → PBSDiscordDark/images/dd_logo.png

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

0
PVEDiscordDark/images/dd_logo_blurp.png → PBSDiscordDark/images/dd_logo_blurp.png

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

0
PVEDiscordDark/images/dd_mini-bottom.png → PBSDiscordDark/images/dd_mini-bottom.png

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 229 B

0
PVEDiscordDark/images/dd_mini-top.png → PBSDiscordDark/images/dd_mini-top.png

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 219 B

2
PBSDiscordDark/images/dd_readme

@ -0,0 +1,2 @@
Images with 'dd' prefix are from the 'PBSDiscordDark' Proxmox theme which can be found here - https://github.com/Luckyvb/PBSDiscordDark
The theme does NOT replace any existing images but instead adds new images that the stylesheet will use.

0
PVEDiscordDark/images/dd_tool-sprites.png → PBSDiscordDark/images/dd_tool-sprites.png

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

0
PVEDiscordDark/images/dd_trigger.png → PBSDiscordDark/images/dd_trigger.png

Before

Width:  |  Height:  |  Size: 287 B

After

Width:  |  Height:  |  Size: 287 B

0
PVEDiscordDark/js/PBSDiscordDark.js → PBSDiscordDark/js/PBSDiscordDark.js

0
PVEDiscordDark/sass/PBSDiscordDark.css → PBSDiscordDark/sass/PBSDiscordDark.css

0
PVEDiscordDark/sass/PVEDiscordDark.sass → PBSDiscordDark/sass/PBSDiscordDark.sass

0
PVEDiscordDark/sass/_vars.sass → PBSDiscordDark/sass/_vars.sass

0
PVEDiscordDark/sass/proxmox/_proxmoxRRDChart.sass → PBSDiscordDark/sass/proxmox/_proxmoxRRDChart.sass

0
PVEDiscordDark/sass/proxmox/_pveCeph.sass → PBSDiscordDark/sass/proxmox/_pveCeph.sass

0
PVEDiscordDark/sass/proxmox/_pveDc.sass → PBSDiscordDark/sass/proxmox/_pveDc.sass

0
PVEDiscordDark/sass/special/_borders.sass → PBSDiscordDark/sass/special/_borders.sass

0
PVEDiscordDark/sass/special/_icons.sass → PBSDiscordDark/sass/special/_icons.sass

0
PVEDiscordDark/sass/special/_proxmox.sass → PBSDiscordDark/sass/special/_proxmox.sass

0
PVEDiscordDark/sass/special/_specific.sass → PBSDiscordDark/sass/special/_specific.sass

0
PVEDiscordDark/sass/x/_autocontainer.sass → PBSDiscordDark/sass/x/_autocontainer.sass

0
PVEDiscordDark/sass/x/_body.sass → PBSDiscordDark/sass/x/_body.sass

0
PVEDiscordDark/sass/x/_boundlist.sass → PBSDiscordDark/sass/x/_boundlist.sass

0
PVEDiscordDark/sass/x/_box.sass → PBSDiscordDark/sass/x/_box.sass

0
PVEDiscordDark/sass/x/_btn.sass → PBSDiscordDark/sass/x/_btn.sass

0
PVEDiscordDark/sass/x/_column.sass → PBSDiscordDark/sass/x/_column.sass

0
PVEDiscordDark/sass/x/_component.sass → PBSDiscordDark/sass/x/_component.sass

0
PVEDiscordDark/sass/x/_datepicker.sass → PBSDiscordDark/sass/x/_datepicker.sass

0
PVEDiscordDark/sass/x/_form.sass → PBSDiscordDark/sass/x/_form.sass

0
PVEDiscordDark/sass/x/_grid.sass → PBSDiscordDark/sass/x/_grid.sass

0
PVEDiscordDark/sass/x/_legend.sass → PBSDiscordDark/sass/x/_legend.sass

0
PVEDiscordDark/sass/x/_mask.sass → PBSDiscordDark/sass/x/_mask.sass

0
PVEDiscordDark/sass/x/_menu.sass → PBSDiscordDark/sass/x/_menu.sass

0
PVEDiscordDark/sass/x/_misc.sass → PBSDiscordDark/sass/x/_misc.sass

0
PVEDiscordDark/sass/x/_panel.sass → PBSDiscordDark/sass/x/_panel.sass

0
PVEDiscordDark/sass/x/_progress.sass → PBSDiscordDark/sass/x/_progress.sass

0
PVEDiscordDark/sass/x/_splitter.sass → PBSDiscordDark/sass/x/_splitter.sass

0
PVEDiscordDark/sass/x/_tab.sass → PBSDiscordDark/sass/x/_tab.sass

0
PVEDiscordDark/sass/x/_tip.sass → PBSDiscordDark/sass/x/_tip.sass

0
PVEDiscordDark/sass/x/_title.sass → PBSDiscordDark/sass/x/_title.sass

0
PVEDiscordDark/sass/x/_toolbar.sass → PBSDiscordDark/sass/x/_toolbar.sass

0
PVEDiscordDark/sass/x/_tree.sass → PBSDiscordDark/sass/x/_tree.sass

0
PVEDiscordDark/sass/x/_treelist.sass → PBSDiscordDark/sass/x/_treelist.sass

0
PVEDiscordDark/sass/x/_viewport.sass → PBSDiscordDark/sass/x/_viewport.sass

0
PVEDiscordDark/sass/x/_window.sass → PBSDiscordDark/sass/x/_window.sass

191
PVEDiscordDark.py

@ -1,191 +0,0 @@
#!/usr/bin/python3
import os
import sys
import time
import subprocess
import urllib.request
import os.path
import shutil
import argparse
ACTION = None
images = [
'dd_cephblurp.png', 'dd_cephwhite.png',
'dd_icon-cpu.png', 'dd_icon-hdd.png',
'dd_icon-ram.png', 'dd_icon-swap.png',
'dd_icon-cd.png', 'dd_icon-display.png',
'dd_icon-network.png', 'dd_icon-cloud.png',
'dd_icon-serial.png', 'dd_icon-usb.png',
'dd_icon-pci.png', 'dd_logo.png',
'dd_mini-bottom.png', 'dd_mini-top.png',
'dd_readme', '/dd_tool-sprites.png',
'dd_trigger.png', 'dd_loading.svg',
'dd_icon-die.svg', 'dd_clear-trigger.png']
class colors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
NORMAL = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def clear():
if ACTION == None:
print("\033c", end="")
def cprint(color, text, bold=False, inline=False):
endc = '\n'
if inline:
endc = ''
if bold:
print(colors.BOLD)
print(color + text + colors.NORMAL, end=endc)
def getPVEVersion():
pv = subprocess.check_output('pveversion --verbose | grep pve-manager | cut -c 14- | cut -c -6', shell=True, stderr=open(os.devnull, 'w'))
pv = pv.decode('ascii').replace(" ", "").replace("\n","")
if (('/bin/' in pv) or (len(pv) > 7)):
return ""
else:
return pv
def checkPVE():
ver = getPVEVersion()
if (len(ver) < 1):
cprint(colors.FAIL, 'Unable to detect Proxmox.', True)
cprint(colors.NORMAL, 'A Proxmox installation could not be detected.')
exit(1)
else:
cprint(colors.OKGREEN, '\nPVE ' + ver + ' detected.')
def checkConn():
try:
urllib.request.urlopen('http://github.com')
return
except:
cprint(colors.FAIL, 'An Internet connection is required to install PVEDiscordDark.', True)
cprint(colors.NORMAL, 'Connect to the Internet and try again.')
exit(1)
def themeIsInstalled():
tplUsesTheme = False
tplFile = open('/usr/share/pve-manager/index.html.tpl')
tplLines = tplFile.readlines()
for line in tplLines:
if ("<link rel='stylesheet' type='text/css' href='/pve2/css/dd_style.css'>" in line or "<script type='text/javascript' src='/pve2/js/dd_patcher.js'></script>" in line):
tplUsesTheme = True
if (os.path.isfile('/usr/share/pve-manager/css/dd_style.css') or tplUsesTheme):
return True
return False
def installTheme():
clear()
doHeader()
baseURL = os.getenv('BASEURL', 'https://github.com/Weilbyte/PVEDiscordDark/raw/' + os.getenv("BRANCH", "master"))
cprint(colors.NORMAL, '\nBacking up index template file..')
shutil.copyfile('/usr/share/pve-manager/index.html.tpl', '/usr/share/pve-manager/index.html.tpl.bak')
cprint(colors.NORMAL, 'Downloading stylesheet..')
urllib.request.urlretrieve(baseURL + '/PVEDiscordDark/sass/PVEDiscordDark.css', '/usr/share/pve-manager/css/dd_style.css')
cprint(colors.NORMAL, 'Downloading patcher..')
urllib.request.urlretrieve(baseURL + '/PVEDiscordDark/js/PVEDiscordDark.js', '/usr/share/pve-manager/js/dd_patcher.js')
cprint(colors.NORMAL, 'Applying stylesheet and patcher..')
with open('/usr/share/pve-manager/index.html.tpl', 'a') as tplFile:
tplFile.write("<link rel='stylesheet' type='text/css' href='/pve2/css/dd_style.css'>")
tplFile.write("<script type='text/javascript' src='/pve2/js/dd_patcher.js'></script>")
for index, image in enumerate(images):
imageCurrent = index + 1
cprint(colors.NORMAL, 'Downloading images [' + str(imageCurrent) + '/' + str(len(images)) + ']..\r', False, True)
urllib.request.urlretrieve(baseURL + '/PVEDiscordDark/images/' + image, '/usr/share/pve-manager/images/' + image)
cprint(colors.OKGREEN, '\nTheme installed successfully!', True)
if ACTION == None:
cprint(colors.NORMAL, 'Press [ENTER] to go back.')
input('')
doMainMenu()
def uninstallTheme():
clear()
doHeader()
cprint(colors.NORMAL, '\nCleaning up index template file..')
with open('/usr/share/pve-manager/index.html.tpl', 'r+') as tplFile:
tplLines = tplFile.readlines()
tplFile.seek(0)
for line in tplLines:
if ("<link rel='stylesheet' type='text/css' href='/pve2/css/dd_style.css'>" not in line or "<script type='text/javascript' src='/pve2/js/dd_patcher.js'></script>" not in line):
tplFile.write(line)
tplFile.truncate()
if os.path.exists('/usr/share/javascript/extjs/charts.js.bak'):
cprint(colors.NORMAL, 'Reverting charts.js replacement..')
os.remove('/usr/share/javascript/extjs/charts.js')
shutil.copyfile('/usr/share/javascript/extjs/charts.js.bak', '/usr/share/javascript/extjs/charts.js')
os.remove('/usr/share/javascript/extjs/charts.js.bak')
if os.path.exists('/usr/share/pve-manager/css/dd_style.css'):
cprint(colors.NORMAL, 'Removing stylesheet..')
os.remove('/usr/share/pve-manager/css/dd_style.css')
if os.path.exists('/usr/share/pve-manager/js/dd_patcher.js'):
cprint(colors.NORMAL, 'Removing patcher..')
os.remove('/usr/share/pve-manager/js/dd_patcher.js')
cprint(colors.NORMAL, 'Removing images..')
for asset in os.listdir('/usr/share/pve-manager/images/'):
if asset.startswith('dd_'):
os.remove('/usr/share/pve-manager/images/' + asset)
cprint(colors.OKGREEN, '\n\nTheme uninstalled successfully!', True)
if ACTION == None:
cprint(colors.NORMAL, 'Press [ENTER] to go back.')
input('')
doMainMenu()
def doHeader():
cprint(colors.HEADER, '[~]', True, True)
cprint(colors.NORMAL, ' PVEDiscordDark Utility (DEPRECATED)\nThis installer is now deprecated, please use PVEDiscordDark.sh\n', False, True)
def doMainMenu():
clear()
doHeader()
isInstalled = themeIsInstalled()
cprint(colors.NORMAL, '[I]', True, True)
cprint(colors.NORMAL, ' Install theme', False, True)
if isInstalled:
cprint(colors.NORMAL, '[U]', True, True)
cprint(colors.NORMAL, ' Uninstall theme', False, True)
cprint(colors.NORMAL, '[Q]', True, True)
cprint(colors.NORMAL, ' Exit', False, True)
choice = input('\n\n>? ')
choice = choice.upper().replace(" ", "")
if choice == 'I':
installTheme()
elif (choice == 'U' and isInstalled):
uninstallTheme()
elif choice == 'Q':
exit(0)
else:
doMainMenu()
def main():
parser = argparse.ArgumentParser(description='PVEDiscordDark Theme Utility (DEPRECATED)')
parser.add_argument('--action', '-a', choices=['install', 'uninstall'], help='action for unattended mode')
args = parser.parse_args()
global ACTION
ACTION = args.action
checkPVE()
checkConn()
time.sleep(0.5)
if ACTION == None:
try:
doMainMenu()
except KeyboardInterrupt:
print('\n')
exit(0)
else:
if ACTION == 'install':
installTheme()
else:
if themeIsInstalled():
uninstallTheme()
if __name__ == "__main__":
main()

241
PVEDiscordDark.sh

@ -1,241 +0,0 @@
#!/bin/bash
# https://github.com/Weilbyte/PVEDiscordDark
#region Consts
RED='\033[0;31m'
BRED='\033[0;31m\033[1m'
GRN='\033[92m'
WARN='\033[93m'
BOLD='\033[1m'
REG='\033[0m'
CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m'
TEMPLATE_FILE="/usr/share/pve-manager/index.html.tpl"
SCRIPTPATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
REPO=${REPO:-"Weilbyte/PVEDiscordDark"}
DEFAULT_TAG="master"
TAG=${TAG:-$DEFAULT_TAG}
BASE_URL="https://raw.githubusercontent.com/$REPO/$TAG"
#endregion Consts
#region Prerun checks
hash sed 2>/dev/null || {
echo -e >&2 "${BRED}sed is required but missing from your system${REG}";
exit 1;
}
hash curl 2>/dev/null || {
echo -e >&2 "${BRED}cURL is required but missing from your system${REG}";
exit 1;
}
hash pveversion 2>/dev/null || {
echo -e >&2 "${BRED}PVE installation required but missing from your system${REG}";
exit 1;
}
curl -sSf -f https://github.com/robots.txt &> /dev/null || {
echo -e >&2 "${BRED}Could not establish a connection to GitHub (github.com)${REG}";
exit 1;
}
if [ $TAG != $DEFAULT_TAG ]; then
if !([[ $TAG =~ [0-9] ]] && [ ${#TAG} -ge 7 ] && (! [[ $TAG =~ ['!@#$%^&*()_+.'] ]]) ); then
echo -e "${WARN}It appears like you are using a non-default tag. For security purposes, please use the SHA-1 hash of said tag instead${REG}"
fi
fi
#endregion Prerun checks
PVEVersion=$(pveversion --verbose | grep pve-manager | cut -c 14- | cut -c -6) # Below pveversion pre-run check
PVEVersionMajor=$(echo $PVEVersion | cut -d'-' -f1)
#region Helper functions
function checkSupported {
local SUPPORTED=$(curl -f -s "$BASE_URL/meta/supported")
if [ -z "$SUPPORTED" ]; then
echo -e "${WARN}Could not reach supported version file ($BASE_URL/meta/supported). Skipping support check.${REG}"
else
local SUPPORTEDARR=($(echo "$SUPPORTED" | tr ',' '\n'))
if ! (printf '%s\n' "${SUPPORTEDARR[@]}" | grep -q -P "$PVEVersionMajor"); then
echo -e "${WARN}You might encounter issues because your version ($PVEVersionMajor) is not matching currently supported versions ($SUPPORTED)."
echo -e "If you do run into any issues on >newer< versions, please consider opening an issue at https://github.com/Weilbyte/PVEDiscordDark/issues.${REG}"
fi
fi
}
function isInstalled {
if (grep -Fq "<link rel='stylesheet' type='text/css' href='/pve2/css/dd_style.css'>" $TEMPLATE_FILE &&
grep -Fq "<script type='text/javascript' src='/pve2/js/dd_patcher.js'></script>" $TEMPLATE_FILE &&
[ -f "/usr/share/pve-manager/css/dd_style.css" ] && [ -f "/usr/share/pve-manager/js/dd_patcher.js" ]); then
true
else
false
fi
}
#endregion Helper functions
#region Main functions
function usage {
if [ "$_silent" = false ]; then
echo -e "Usage: $0 [OPTIONS...] {COMMAND}\n"
echo -e "Manages the PVEDiscordDark theme."
echo -e " -h --help Show this help"
echo -e " -s --silent Silent mode\n"
echo -e "Commands:"
echo -e " status Check current theme status (in silent mode, returns 0 if installed, and 1 if not installed)"
echo -e " install Install the theme"
echo -e " uninstall Uninstall the theme"
echo -e " update Update the theme (runs uninstall, then install)"
# echo -e " utility-update Update this utility\n" (to be implemented)
echo -e "Exit status:"
echo -e " 0 OK"
echo -e " 1 Failure"
echo -e " 2 Already installed, OR not installed (when using install/uninstall commands)\n"
echo -e "Report issues at: <https://github.com/Weilbyte/PVEDiscordDark/issues>"
fi
}
function status {
if [ "$_silent" = false ]; then
echo -e "Theme"
if isInstalled; then
echo -e " Status: ${GRN}present${REG}"
else
echo -e " Status: ${RED}not present${REG}"
fi
echo -e " CSS: $(sha256sum /usr/share/pve-manager/css/dd_style.css 2>/dev/null || echo N/A)"
echo -e " JS: $(sha256sum /usr/share/pve-manager/js/dd_patcher.js 2>/dev/null || echo N/A)\n"
echo -e "PVE"
echo -e " Version: $PVEVersion (major $PVEVersionMajor)\n"
echo -e "Utility hash: $(sha256sum $SCRIPTPATH 2>/dev/null || echo N/A)"
exit 0
else
if isInstalled; then exit 0; else exit 1; fi
fi
}
function install {
if isInstalled; then
if [ "$_silent" = false ]; then echo -e "${RED}Theme already installed${REG}"; fi
exit 2
else
if [ "$_silent" = false ]; then checkSupported; fi
if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Backing up template file"; fi
cp $TEMPLATE_FILE $TEMPLATE_FILE.bak
if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Downloading stylesheet"; fi
curl -s $BASE_URL/PVEDiscordDark/sass/PVEDiscordDark.css > /usr/share/pve-manager/css/dd_style.css
if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Downloading patcher"; fi
curl -s $BASE_URL/PVEDiscordDark/js/PVEDiscordDark.js > /usr/share/pve-manager/js/dd_patcher.js
if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Applying changes to template file"; fi
if !(grep -Fq "<link rel='stylesheet' type='text/css' href='/pve2/css/dd_style.css'>" $TEMPLATE_FILE); then
echo "<link rel='stylesheet' type='text/css' href='/pve2/css/dd_style.css'>" >> $TEMPLATE_FILE
fi
if !(grep -Fq "<script type='text/javascript' src='/pve2/js/dd_patcher.js'></script>" $TEMPLATE_FILE); then
echo "<script type='text/javascript' src='/pve2/js/dd_patcher.js'></script>" >> $TEMPLATE_FILE
fi
local IMAGELIST=$(curl -f -s "$BASE_URL/meta/imagelist")
local IMAGELISTARR=($(echo "$IMAGELIST" | tr ',' '\n'))
if [ "$_silent" = false ]; then echo -e "Downloading images (0/${#IMAGELISTARR[@]})"; fi
ITER=0
for image in "${IMAGELISTARR[@]}"
do
curl -s $BASE_URL/PVEDiscordDark/images/$image > /usr/share/pve-manager/images/$image
((ITER++))
if [ "$_silent" = false ]; then echo -e "\e[1A\e[KDownloading images ($ITER/${#IMAGELISTARR[@]})"; fi
done
if [ "$_silent" = false ]; then echo -e "\e[1A\e[K${CHECKMARK} Downloading images (${#IMAGELISTARR[@]}/${#IMAGELISTARR[@]})"; fi
if [ "$_silent" = false ]; then echo -e "Theme installed."; fi
if [ "$_noexit" = false ]; then exit 0; fi
fi
}
function uninstall {
if ! isInstalled; then
echo -e "${RED}Theme not installed${REG}"
exit 2
else
if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Removing stylesheet"; fi
rm /usr/share/pve-manager/css/dd_style.css
if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Removing patcher"; fi
rm /usr/share/pve-manager/js/dd_patcher.js
if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Reverting changes to template file"; fi
sed -i "/<link rel='stylesheet' type='text\/css' href='\/pve2\/css\/dd_style.css'>/d" /usr/share/pve-manager/index.html.tpl
sed -i "/<script type='text\/javascript' src='\/pve2\/js\/dd_patcher.js'><\/script>/d" /usr/share/pve-manager/index.html.tpl
if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Removing images"; fi
rm /usr/share/pve-manager/images/dd_*
if [ "$_silent" = false ]; then echo -e "Theme uninstalled."; fi
if [ "$_noexit" = false ]; then exit 0; fi
fi
}
#endregion Main functions
_silent=false
_command=false
_noexit=false
parse_cli()
{
while test $# -gt -0
do
_key="$1"
case "$_key" in
-h|--help)
usage
exit 0
;;
-s|--silent)
_silent=true
;;
status)
if [ "$_command" = false ]; then
_command=true
status
fi
;;
install)
if [ "$_command" = false ]; then
_command=true
install
exit 0
fi
;;
uninstall)
if [ "$_command" = false ]; then
_command=true
uninstall
exit 0
fi
;;
update)
if [ "$_command" = false ]; then
_command=true
_noexit=true
uninstall
install
exit 0
fi
;;
*)
echo -e "${BRED}Error: Got an unexpected argument \"$_key\"${REG}\n";
usage;
exit 1;
;;
esac
shift
done
}
parse_cli "$@"

2
PVEDiscordDark/images/dd_readme

@ -1,2 +0,0 @@
Images with 'dd' prefix are from the 'PVEDiscordDark' Proxmox theme which can be found here - https://github.com/Weilbyte/PVEDiscordDark
The theme does NOT replace any existing images but instead adds new images that the stylesheet will use.

69
PVEDiscordDark/js/PVEDiscordDark.js

@ -1,69 +0,0 @@
const swapLogo = async function() {
const imgElements = document.getElementsByTagName('img');
var found = false;
for (var i = 0; i< imgElements.length; i++) {
var node = imgElements[i]
if (node.src.includes('proxmox_logo.png')) {
found = true;
var width = (node.parentElement.clientWidth == undefined || node.parentElement.clientWidth == 0) ? 172 : node.parentElement.clientWidth;
var height = (node.parentElement.clientHeight == undefined || node.parentElement.clientHeight == 0) ? 30 : node.parentElement.clientHeight;
node.parentElement.parentElement.style.background = '#23272A';
node.setAttribute('height', `${height}px`);
node.setAttribute('width', `${width}px`);
node.setAttribute('src', '/images/dd_logo.png');
}
}
if (!found) {
await new Promise(resolve => setTimeout(resolve, 60));
await swapLogo();
};
};
const patchCharts = function() {
Ext.chart.theme.Base.prototype.config.chart.defaults.background = '#23272a';
Ext.chart.theme.Base.prototype.config.axis.defaults.label.color = 'white';
Ext.chart.theme.Base.prototype.config.axis.defaults.title.color = 'white';
Ext.chart.theme.Base.prototype.config.axis.defaults.style.strokeStyle = '#7289DA';
Ext.chart.theme.Base.prototype.config.axis.defaults.grid.strokeStyle = 'rgba(44, 47, 51, 1)';
Ext.chart.theme.Base.prototype.config.sprites.text.color = 'white';
};
function patchGaugeWidget() {
Proxmox.panel.GaugeWidget.prototype.backgroundColor = '#2C2F33';
Proxmox.panel.GaugeWidget.prototype.criticalColor = '#f04747';
Proxmox.panel.GaugeWidget.prototype.warningColor = '#faa61a';
Proxmox.panel.GaugeWidget.prototype.defaultColor = '#7289DA';
Proxmox.panel.GaugeWidget.prototype.items[1].series[0].colors[0] = '#2C2F33';
};
function patchBackupConfig() {
//PVE.window.BackupConfig.prototype.items.style['background-color'] = '#23272a';
};
function patchDiskSmartWindow() {
const target = PVE.DiskSmartWindow || Proxmox.window.DiskSmart;
target.prototype.items[1].style['background-color'] = '#23272a';
}
function patchTFAEdit() {
//PVE.window.TFAEdit.prototype.items[0].items[0].items[1].style["background-color"] = 'transparent';
}
function patchCreateWidget() {
_createWidget = Ext.createWidget
Ext.createWidget = function(c, p) {
if (typeof p === 'object' && typeof p.style === 'object') {
if (c === 'component' && typeof p.style['background-color'] === 'string' && p.style['background-color'] === 'white') p.style['background-color'] = '#2C2F33'
}
return _createWidget(c, p)
}
}
swapLogo();
patchCharts();
patchGaugeWidget();
patchBackupConfig();
patchDiskSmartWindow();
patchTFAEdit();
patchCreateWidget();
console.log('PVEDiscordDark :: Patched');

1
PVEDiscordDark/sass/PVEDiscordDark.css

File diff suppressed because one or more lines are too long

6
UtilityUpdater.sh

@ -27,7 +27,7 @@ echo -ne '\n'
sleep 1
echo -ne '# (0%) Checking the latestversion\r'
latestversion=`curl -s "https://api.github.com/repos/Weilbyte/PVEDiscordDark/releases/latest" | awk -F '"' '/tag_name/{print $4}'`
latestversion=`curl -s "https://api.github.com/repos/Luckyvb/PBSDiscordDark/releases/latest" | awk -F '"' '/tag_name/{print $4}'`
echo -ne '####################### (100%) Checking the latestversion\r'
sleep 1
echo -ne '\n'
@ -53,13 +53,13 @@ then
if [[ $REPLY =~ ^[YyOo]$ ]]
then
echo -ne "Downloading...\n"
wget -O "PVEDiscordDark.py" "https://raw.githubusercontent.com/Weilbyte/PVEDiscordDark/master/PVEDiscordDark.py"
wget -O "PBSDiscordDark.py" "https://raw.githubusercontent.com/Luckyvb/PBSDiscordDark/master/PBSDiscordDark.sh"
echo "$latestversion" > $file
read -p "$(echo -e $yellow)[Warning] Start the updated script ? $(echo -e $default)[y/n]" -n 1 -r
echo "" # (optional) move to a new line
if [[ $REPLY =~ ^[YyOo]$ ]]
then
python3 PVEDiscordDark.py
python3 PBSDiscordDark.py
exit 0
fi
else

Loading…
Cancel
Save