1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-03-08 13:19:05 +00:00

Add reveal.js script (#2806)

This commit is contained in:
Slaviša Arežina 2025-03-04 14:29:55 +01:00 committed by GitHub
parent b7968becc3
commit 4359f23e63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 188 additions and 0 deletions

72
ct/revealjs.sh Normal file
View File

@ -0,0 +1,72 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: Slaviša Arežina (tremor021)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/hakimel/reveal.js
APP="RevealJS"
var_tags="presentation"
var_cpu="1"
var_ram="1024"
var_disk="4"
var_os="debian"
var_version="12"
var_unprivileged="1"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d "/opt/revealjs" ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -s https://api.github.com/repos/hakimel/reveal.js/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_info "Stopping $APP"
systemctl stop revealjs
msg_ok "Stopped $APP"
msg_info "Updating $APP to ${RELEASE}"
temp_file=$(mktemp)
wget -q "https://github.com/hakimel/reveal.js/archive/refs/tags/${RELEASE}.tar.gz" -O $temp_file
tar zxf $temp_file
rm -rf /opt/revealjs/node_modules/*
cp -rf reveal.js-${RELEASE}/* /opt/revealjs
cd /opt/revealjs
$STD npm install
sed -i '25s/localhost/0.0.0.0/g' /opt/revealjs/gulpfile.js
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated $APP to ${RELEASE}"
msg_info "Starting $APP"
systemctl start revealjs
msg_ok "Started $APP"
msg_info "Cleaning Up"
rm -f $temp_file
rm -rf ~/reveal.js-${RELEASE}
msg_ok "Cleanup Completed"
msg_ok "Update Successful"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8000${CL}"

View File

@ -0,0 +1,73 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: Slaviša Arežina (tremor021)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/hakimel/reveal.js
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y \
curl \
sudo \
mc \
gnupg
msg_ok "Installed Dependencies"
msg_info "Setting up Node.js Repository"
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
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
msg_ok "Set up Node.js Repository"
msg_info "Setup Node.js"
$STD apt-get update
$STD apt-get install -y nodejs
msg_ok "Setup Node.js"
msg_info "Setup ${APPLICATION}"
temp_file=$(mktemp)
RELEASE=$(curl -s https://api.github.com/repos/hakimel/reveal.js/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
wget -q "https://github.com/hakimel/reveal.js/archive/refs/tags/${RELEASE}.tar.gz" -O $temp_file
tar zxf $temp_file
mv reveal.js-${RELEASE}/ /opt/revealjs
cd /opt/revealjs
$STD npm install
sed -i '25s/localhost/0.0.0.0/g' /opt/revealjs/gulpfile.js
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Setup ${APPLICATION}"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/revealjs.service
[Unit]
Description=Reveal.js Service
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/revealjs
ExecStart=/usr/bin/npm start
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now revealjs
msg_ok "Created Service"
motd_ssh
customize
msg_info "Cleaning up"
rm -f $temp_file
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"

43
json/revealjs.json Normal file
View File

@ -0,0 +1,43 @@
{
"name": "RevealJS",
"slug": "revealjs",
"categories": [
12
],
"date_created": "2025-03-03",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 8000,
"documentation": "https://github.com/hakimel/reveal.js/wiki",
"website": "https://github.com/hakimel/reveal.js",
"logo": "https://static.slid.es/reveal/logo-v1/reveal-white-text.svg",
"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.",
"install_methods": [
{
"type": "default",
"script": "ct/revealjs.sh",
"resources": {
"cpu": 1,
"ram": 1024,
"hdd": 4,
"os": "debian",
"version": "12"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"notes": [
{
"text": "Config file is at `/opt/revealjs/gulpfile.js`. Check the documentation for more information.",
"type": "info"
},
{
"text": "LiveReload is on port: 35729",
"type": "info"
}
]
}