├── LICENSE
├── PBSDiscordDark.sh
├── PBSDiscordDark
├── images
│ ├── dd_arrows.png
│ ├── dd_cephblurp.png
│ ├── dd_cephwhite.png
│ ├── dd_clear-trigger.png
│ ├── dd_default-toolbar-small-arrow.png
│ ├── dd_default-toolbar-small-s-arrow.png
│ ├── dd_icon-cd.png
│ ├── dd_icon-cdblurp.png
│ ├── dd_icon-cloud.png
│ ├── dd_icon-cpu.png
│ ├── dd_icon-die.svg
│ ├── dd_icon-display.png
│ ├── dd_icon-hdd.png
│ ├── dd_icon-network.png
│ ├── dd_icon-pci.png
│ ├── dd_icon-ram.png
│ ├── dd_icon-serial.png
│ ├── dd_icon-swap.png
│ ├── dd_icon-usb.png
│ ├── dd_loading.svg
│ ├── dd_logo-128.png
│ ├── dd_logo.png
│ ├── dd_logo_blurp.png
│ ├── dd_mini-bottom.png
│ ├── dd_mini-top.png
│ ├── dd_readme
│ ├── dd_tool-sprites.png
│ └── dd_trigger.png
├── js
│ └── PBSDiscordDark.js
└── sass
│ ├── PBSDiscordDark.css
│ ├── PBSDiscordDark.sass
│ ├── _vars.sass
│ ├── proxmox
│ ├── _proxmoxRRDChart.sass
│ ├── _pveCeph.sass
│ └── _pveDc.sass
│ ├── special
│ ├── _borders.sass
│ ├── _icons.sass
│ ├── _proxmox.sass
│ └── _specific.sass
│ └── x
│ ├── _autocontainer.sass
│ ├── _body.sass
│ ├── _boundlist.sass
│ ├── _box.sass
│ ├── _btn.sass
│ ├── _column.sass
│ ├── _component.sass
│ ├── _datepicker.sass
│ ├── _form.sass
│ ├── _grid.sass
│ ├── _legend.sass
│ ├── _mask.sass
│ ├── _menu.sass
│ ├── _misc.sass
│ ├── _panel.sass
│ ├── _progress.sass
│ ├── _splitter.sass
│ ├── _tab.sass
│ ├── _tip.sass
│ ├── _title.sass
│ ├── _toolbar.sass
│ ├── _tree.sass
│ ├── _treelist.sass
│ ├── _viewport.sass
│ └── _window.sass
├── README.md
├── UtilityUpdater.sh
└── meta
├── imagelist
└── supported
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/PBSDiscordDark.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # https://github.com/Luckyvb/PBSDiscordDark
3 |
4 | #region Consts
5 | RED='\033[0;31m'
6 | BRED='\033[0;31m\033[1m'
7 | GRN='\033[92m'
8 | WARN='\033[93m'
9 | BOLD='\033[1m'
10 | REG='\033[0m'
11 | CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m'
12 |
13 | TEMPLATE_FILE="/usr/share/javascript/proxmox-backup/index.hbs"
14 | SCRIPTPATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
15 |
16 | REPO=${REPO:-"Luckyvb/PBSDiscordDark"}
17 | DEFAULT_TAG="master"
18 | TAG=${TAG:-$DEFAULT_TAG}
19 | BASE_URL="https://raw.githubusercontent.com/$REPO/$TAG"
20 | #endregion Consts
21 |
22 | #region Prerun checks
23 | hash sed 2>/dev/null || {
24 | echo -e >&2 "${BRED}sed is required but missing from your system${REG}";
25 | exit 1;
26 | }
27 |
28 | hash curl 2>/dev/null || {
29 | echo -e >&2 "${BRED}cURL is required but missing from your system${REG}";
30 | exit 1;
31 | }
32 |
33 | #echo -e >&2 "${pbsversion}"
34 | #hash proxmox-backup-manager versions 2>/dev/null || {
35 | # echo -e >&2 "${BRED}PBS installation required but missing from your system${REG}";
36 | # exit 1;
37 | #}
38 |
39 | curl -sSf -f https://github.com/robots.txt &> /dev/null || {
40 | echo -e >&2 "${BRED}Could not establish a connection to GitHub (github.com)${REG}";
41 | exit 1;
42 | }
43 |
44 | if [ $TAG != $DEFAULT_TAG ]; then
45 | if !([[ $TAG =~ [0-9] ]] && [ ${#TAG} -ge 7 ] && (! [[ $TAG =~ ['!@#$%^&*()_+.'] ]]) ); then
46 | 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}"
47 | fi
48 | fi
49 | #endregion Prerun checks
50 |
51 | PBSVersion=$(proxmox-backup-manager versions | grep proxmox-backup-server | cut -c 23- | cut -c -7) # Below pbsversion pre-run check
52 | PBSVersionMajor=$(echo $PBSVersion | cut -d'-' -f1)
53 |
54 | #region Helper functions
55 | function checkSupported {
56 | local SUPPORTED=$(curl -f -s "$BASE_URL/meta/supported")
57 | if [ -z "$SUPPORTED" ]; then
58 | echo -e "${WARN}Could not reach supported version file ($BASE_URL/meta/supported). Skipping support check.${REG}"
59 | else
60 | local SUPPORTEDARR=($(echo "$SUPPORTED" | tr ',' '\n'))
61 | if ! (printf '%s\n' "${SUPPORTEDARR[@]}" | grep -q -P "$PBSVersionMajor"); then
62 | echo -e "${WARN}You might encounter issues because your version ($PBSVersionMajor) is not matching currently supported versions ($SUPPORTED)."
63 | 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}"
64 | fi
65 | fi
66 | }
67 |
68 | function isInstalled {
69 | if (grep -Fq "" $TEMPLATE_FILE &&
70 | grep -Fq "" $TEMPLATE_FILE &&
71 | [ -f "/usr/share/javascript/proxmox-backup/css/dd_style.css" ] && [ -f "/usr/share/javascript/proxmox-backup/js/dd_patcher.js" ]); then
72 | true
73 | else
74 | false
75 | fi
76 | }
77 |
78 | #endregion Helper functions
79 |
80 | #region Main functions
81 | function usage {
82 | if [ "$_silent" = false ]; then
83 | echo -e "Usage: $0 [OPTIONS...] {COMMAND}\n"
84 | echo -e "Manages the PBSDiscordDark theme."
85 | echo -e " -h --help Show this help"
86 | echo -e " -s --silent Silent mode\n"
87 | echo -e "Commands:"
88 | echo -e " status Check current theme status (in silent mode, returns 0 if installed, and 1 if not installed)"
89 | echo -e " install Install the theme"
90 | echo -e " uninstall Uninstall the theme"
91 | echo -e " update Update the theme (runs uninstall, then install)"
92 | # echo -e " utility-update Update this utility\n" (to be implemented)
93 | echo -e "Exit status:"
94 | echo -e " 0 OK"
95 | echo -e " 1 Failure"
96 | echo -e " 2 Already installed, OR not installed (when using install/uninstall commands)\n"
97 | echo -e "Report issues at: "
98 | fi
99 | }
100 |
101 | function status {
102 | if [ "$_silent" = false ]; then
103 | echo -e "Theme"
104 | if isInstalled; then
105 | echo -e " Status: ${GRN}present${REG}"
106 | else
107 | echo -e " Status: ${RED}not present${REG}"
108 | fi
109 | echo -e " CSS: $(sha256sum /usr/share/javascript/proxmox-backup/css/dd_style.css 2>/dev/null || echo N/A)"
110 | echo -e " JS: $(sha256sum /usr/share/javascript/proxmox-backup/js/dd_patcher.js 2>/dev/null || echo N/A)\n"
111 | echo -e "PBS"
112 | echo -e " Version: $PBSVersion (major $PBSVersionMajor)\n"
113 | echo -e "Utility hash: $(sha256sum $SCRIPTPATH 2>/dev/null || echo N/A)"
114 | exit 0
115 | else
116 | if isInstalled; then exit 0; else exit 1; fi
117 | fi
118 | }
119 |
120 | function install {
121 | if isInstalled; then
122 | if [ "$_silent" = false ]; then echo -e "${RED}Theme already installed${REG}"; fi
123 | exit 2
124 | else
125 | if [ "$_silent" = false ]; then checkSupported; fi
126 |
127 | if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Backing up template file"; fi
128 | cp $TEMPLATE_FILE $TEMPLATE_FILE.bak
129 |
130 | if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Downloading stylesheet"; fi
131 | curl -s $BASE_URL/PBSDiscordDark/sass/PBSDiscordDark.css > /usr/share/javascript/proxmox-backup/css/dd_style.css
132 |
133 | if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Downloading patcher"; fi
134 | curl -s $BASE_URL/PBSDiscordDark/js/PBSDiscordDark.js > /usr/share/javascript/proxmox-backup/js/dd_patcher.js
135 |
136 | if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Applying changes to template file"; fi
137 | if !(grep -Fq "" $TEMPLATE_FILE); then
138 | echo "" >> $TEMPLATE_FILE
139 | fi
140 | if !(grep -Fq "" $TEMPLATE_FILE); then
141 | echo "" >> $TEMPLATE_FILE
142 | fi
143 |
144 | local IMAGELIST=$(curl -f -s "$BASE_URL/meta/imagelist")
145 | local IMAGELISTARR=($(echo "$IMAGELIST" | tr ',' '\n'))
146 | if [ "$_silent" = false ]; then echo -e "Downloading images (0/${#IMAGELISTARR[@]})"; fi
147 | ITER=0
148 | for image in "${IMAGELISTARR[@]}"
149 | do
150 | curl -s $BASE_URL/PBSDiscordDark/images/$image > /usr/share/javascript/proxmox-backup/images/$image
151 | ((ITER++))
152 | if [ "$_silent" = false ]; then echo -e "\e[1A\e[KDownloading images ($ITER/${#IMAGELISTARR[@]})"; fi
153 | done
154 | if [ "$_silent" = false ]; then echo -e "\e[1A\e[K${CHECKMARK} Downloading images (${#IMAGELISTARR[@]}/${#IMAGELISTARR[@]})"; fi
155 |
156 | if [ "$_silent" = false ]; then echo -e "Theme installed."; fi
157 | if [ "$_noexit" = false ]; then exit 0; fi
158 | fi
159 | }
160 |
161 | function uninstall {
162 | if ! isInstalled; then
163 | echo -e "${RED}Theme not installed${REG}"
164 | exit 2
165 | else
166 | if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Removing stylesheet"; fi
167 | rm /usr/share/javascript/proxmox-backup/css/dd_style.css
168 |
169 | if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Removing patcher"; fi
170 | rm /usr/share/javascript/proxmox-backup/js/dd_patcher.js
171 |
172 | if [ "$_silent" = false ]; then echo -e "${CHECKMARK} Reverting changes to template file"; fi
173 | sed -i "//d" /usr/share/javascript/proxmox-backup/index.hbs
174 | sed -i "/