Skip to content

Commit 4359f23

Browse files
authored
Add reveal.js script (#2806)
1 parent b7968be commit 4359f23

File tree

3 files changed

+188
-0
lines changed

3 files changed

+188
-0
lines changed

ct/revealjs.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/hakimel/reveal.js
7+
8+
APP="RevealJS"
9+
var_tags="presentation"
10+
var_cpu="1"
11+
var_ram="1024"
12+
var_disk="4"
13+
var_os="debian"
14+
var_version="12"
15+
var_unprivileged="1"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
if [[ ! -d "/opt/revealjs" ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
RELEASE=$(curl -s https://api.github.com/repos/hakimel/reveal.js/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
32+
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
33+
msg_info "Stopping $APP"
34+
systemctl stop revealjs
35+
msg_ok "Stopped $APP"
36+
37+
msg_info "Updating $APP to ${RELEASE}"
38+
temp_file=$(mktemp)
39+
wget -q "https://github.com/hakimel/reveal.js/archive/refs/tags/${RELEASE}.tar.gz" -O $temp_file
40+
tar zxf $temp_file
41+
rm -rf /opt/revealjs/node_modules/*
42+
cp -rf reveal.js-${RELEASE}/* /opt/revealjs
43+
cd /opt/revealjs
44+
$STD npm install
45+
sed -i '25s/localhost/0.0.0.0/g' /opt/revealjs/gulpfile.js
46+
echo "${RELEASE}" >/opt/${APP}_version.txt
47+
msg_ok "Updated $APP to ${RELEASE}"
48+
49+
msg_info "Starting $APP"
50+
systemctl start revealjs
51+
msg_ok "Started $APP"
52+
53+
msg_info "Cleaning Up"
54+
rm -f $temp_file
55+
rm -rf ~/reveal.js-${RELEASE}
56+
msg_ok "Cleanup Completed"
57+
58+
msg_ok "Update Successful"
59+
else
60+
msg_ok "No update required. ${APP} is already at ${RELEASE}"
61+
fi
62+
exit
63+
}
64+
65+
start
66+
build_container
67+
description
68+
69+
msg_ok "Completed Successfully!\n"
70+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
71+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
72+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8000${CL}"

install/revealjs-install.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/hakimel/reveal.js
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
curl \
19+
sudo \
20+
mc \
21+
gnupg
22+
msg_ok "Installed Dependencies"
23+
24+
msg_info "Setting up Node.js Repository"
25+
mkdir -p /etc/apt/keyrings
26+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
27+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
28+
msg_ok "Set up Node.js Repository"
29+
30+
msg_info "Setup Node.js"
31+
$STD apt-get update
32+
$STD apt-get install -y nodejs
33+
msg_ok "Setup Node.js"
34+
35+
msg_info "Setup ${APPLICATION}"
36+
temp_file=$(mktemp)
37+
RELEASE=$(curl -s https://api.github.com/repos/hakimel/reveal.js/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
38+
wget -q "https://github.com/hakimel/reveal.js/archive/refs/tags/${RELEASE}.tar.gz" -O $temp_file
39+
tar zxf $temp_file
40+
mv reveal.js-${RELEASE}/ /opt/revealjs
41+
cd /opt/revealjs
42+
$STD npm install
43+
sed -i '25s/localhost/0.0.0.0/g' /opt/revealjs/gulpfile.js
44+
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
45+
msg_ok "Setup ${APPLICATION}"
46+
47+
msg_info "Creating Service"
48+
cat <<EOF >/etc/systemd/system/revealjs.service
49+
[Unit]
50+
Description=Reveal.js Service
51+
After=network.target
52+
53+
[Service]
54+
Type=simple
55+
User=root
56+
WorkingDirectory=/opt/revealjs
57+
ExecStart=/usr/bin/npm start
58+
Restart=always
59+
60+
[Install]
61+
WantedBy=multi-user.target
62+
EOF
63+
systemctl enable -q --now revealjs
64+
msg_ok "Created Service"
65+
66+
motd_ssh
67+
customize
68+
69+
msg_info "Cleaning up"
70+
rm -f $temp_file
71+
$STD apt-get -y autoremove
72+
$STD apt-get -y autoclean
73+
msg_ok "Cleaned"

json/revealjs.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "RevealJS",
3+
"slug": "revealjs",
4+
"categories": [
5+
12
6+
],
7+
"date_created": "2025-03-03",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 8000,
12+
"documentation": "https://github.com/hakimel/reveal.js/wiki",
13+
"website": "https://github.com/hakimel/reveal.js",
14+
"logo": "https://static.slid.es/reveal/logo-v1/reveal-white-text.svg",
15+
"description": "reveal.js is an open source HTML presentation framework. It's a tool that enables anyone with a web browser to create fully-featured and beautiful presentations for free.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/revealjs.sh",
20+
"resources": {
21+
"cpu": 1,
22+
"ram": 1024,
23+
"hdd": 4,
24+
"os": "debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": [
34+
{
35+
"text": "Config file is at `/opt/revealjs/gulpfile.js`. Check the documentation for more information.",
36+
"type": "info"
37+
},
38+
{
39+
"text": "LiveReload is on port: 35729",
40+
"type": "info"
41+
}
42+
]
43+
}

0 commit comments

Comments
 (0)