Skip to content

Commit 951441c

Browse files
authored
Merge pull request #1665 from doge0420/submit/mini-qr
feat: Add Mini QR
2 parents a87d423 + f2a8e95 commit 951441c

3 files changed

Lines changed: 147 additions & 0 deletions

File tree

ct/mini-qr.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2026 community-scripts ORG
4+
# Author: doge0420
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/lyqht/mini-qr
7+
8+
APP="Mini-QR"
9+
var_tags="${var_tags:-QRcode;}"
10+
var_cpu="${var_cpu:-2}"
11+
var_ram="${var_ram:-2048}"
12+
var_disk="${var_disk:-6}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-13}"
15+
var_unprivileged="${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/mini-qr ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
if check_for_gh_release "mini-qr" "lyqht/mini-qr"; then
33+
msg_info "Stopping Service"
34+
systemctl stop caddy
35+
msg_ok "Stopped Service"
36+
37+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "mini-qr" "lyqht/mini-qr" "tarball" "latest" "/opt/mini-qr"
38+
39+
msg_info "Installing Dependencies"
40+
cd /opt/mini-qr
41+
$STD npm install
42+
msg_ok "Installed Dependencies"
43+
44+
msg_info "Building MiniQR"
45+
$STD npm run build
46+
msg_ok "Built MiniQR"
47+
48+
msg_info "Starting Service"
49+
systemctl start caddy
50+
msg_ok "Started Service"
51+
msg_ok "Updated successfully!"
52+
fi
53+
exit
54+
}
55+
56+
start
57+
build_container
58+
description
59+
60+
msg_ok "Completed successfully!\n"
61+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
62+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
63+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:80${CL}"

install/mini-qr-install.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2026 community-scripts ORG
4+
# Author: doge0420
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/lyqht/mini-qr
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 install -y \
18+
libharfbuzz0b \
19+
caddy \
20+
fontconfig
21+
msg_ok "Installed Dependencies"
22+
23+
NODE_VERSION="20" setup_nodejs
24+
fetch_and_deploy_gh_release "mini-qr" "lyqht/mini-qr" "tarball" "latest" "/opt/mini-qr"
25+
26+
msg_info "Building MiniQR"
27+
cd /opt/mini-qr
28+
$STD npm install
29+
$STD npm run build
30+
msg_ok "Built MiniQR"
31+
32+
msg_info "Configuring Caddy"
33+
cat <<EOF >/etc/caddy/Caddyfile
34+
:80 {
35+
root * /opt/mini-qr/dist
36+
file_server
37+
38+
# Handle client-side routing
39+
try_files {path} /index.html
40+
41+
# Cache static assets
42+
@assets {
43+
path /assets/*
44+
}
45+
header @assets Cache-Control "public, immutable, max-age=31536000"
46+
47+
# Correct MIME types for JS modules
48+
@jsmodules {
49+
path *.js *.mjs
50+
}
51+
header @jsmodules Content-Type "application/javascript"
52+
}
53+
EOF
54+
systemctl enable -q --now caddy
55+
systemctl reload caddy
56+
msg_ok "Configured Caddy"
57+
58+
motd_ssh
59+
customize
60+
cleanup_lxc

json/mini-qr.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "Mini QR",
3+
"slug": "mini-qr",
4+
"description": "Create & scan cute qr codes easily 👾",
5+
"type": "ct",
6+
"privileged": false,
7+
"documentation": "https://github.com/lyqht/mini-qr",
8+
"website": "https://mini-qr-code-generator.vercel.app/",
9+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/mini-qr.webp",
10+
"config_path": "/etc/caddy/Caddyfile",
11+
"install_methods_json": [
12+
{
13+
"type": "default",
14+
"resources": {
15+
"cpu": 2,
16+
"ram": 2048,
17+
"hdd": 6,
18+
"os": "Debian",
19+
"version": "13"
20+
}
21+
}
22+
],
23+
"notes_json": []
24+
}

0 commit comments

Comments
 (0)