This commit is contained in:
CanbiZ 2025-03-21 09:36:13 +01:00
parent 0aa76a821d
commit 4268c05a9f
2 changed files with 95 additions and 96 deletions

View File

@ -65,7 +65,7 @@ if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
mv "$tmp_dir"/*/* /opt/meilisearch-ui/ mv "$tmp_dir"/*/* /opt/meilisearch-ui/
cd /opt/meilisearch-ui cd /opt/meilisearch-ui
sed -i 's|const hash = execSync("git rev-parse HEAD").toString().trim();|const hash = "unknown";|' /opt/meilisearch-ui/vite.config.ts sed -i 's|const hash = execSync("git rev-parse HEAD").toString().trim();|const hash = "unknown";|' /opt/meilisearch-ui/vite.config.ts
pnpm install $STD pnpm install
cat <<EOF > /opt/meilisearch-ui/.env.local cat <<EOF > /opt/meilisearch-ui/.env.local
VITE_SINGLETON_MODE=true VITE_SINGLETON_MODE=true
VITE_SINGLETON_HOST=http://${LOCAL_IP}:7700 VITE_SINGLETON_HOST=http://${LOCAL_IP}:7700

View File

@ -5,7 +5,7 @@
post_to_api() { post_to_api() {
echo -e "Posting to API..." echo -e "Posting to API..."
if ! command -v curl &> /dev/null; then if ! command -v curl &>/dev/null; then
return return
fi fi
@ -21,7 +21,8 @@ post_to_api() {
local pve_version="not found" local pve_version="not found"
pve_version=$(pveversion | awk -F'[/ ]' '{print $2}') pve_version=$(pveversion | awk -F'[/ ]' '{print $2}')
JSON_PAYLOAD=$(cat <<EOF JSON_PAYLOAD=$(
cat <<EOF
{ {
"ct_type": $CT_TYPE, "ct_type": $CT_TYPE,
"type":"lxc", "type":"lxc",
@ -38,13 +39,12 @@ post_to_api() {
"random_id": "$RANDOM_UUID" "random_id": "$RANDOM_UUID"
} }
EOF EOF
) )
RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "$JSON_PAYLOAD") || true -d "$JSON_PAYLOAD") || true
} }
get_error_description() { get_error_description() {
local exit_code="$1" local exit_code="$1"
case "$exit_code" in case "$exit_code" in
@ -96,14 +96,13 @@ get_error_description() {
esac esac
} }
post_to_api_vm() { post_to_api_vm() {
if [[ ! -f /usr/local/community-scripts/diagnostics ]]; then if [[ ! -f /usr/local/community-scripts/diagnostics ]]; then
return return
fi fi
DIAGNOSTICS=$(grep -i "^DIAGNOSTICS=" /usr/local/community-scripts/diagnostics | awk -F'=' '{print $2}') DIAGNOSTICS=$(grep -i "^DIAGNOSTICS=" /usr/local/community-scripts/diagnostics | awk -F'=' '{print $2}')
if ! command -v curl &> /dev/null; then if ! command -v curl &>/dev/null; then
return return
fi fi
@ -121,7 +120,8 @@ post_to_api_vm() {
DISK_SIZE_API=${DISK_SIZE%G} DISK_SIZE_API=${DISK_SIZE%G}
JSON_PAYLOAD=$(cat <<EOF JSON_PAYLOAD=$(
cat <<EOF
{ {
"ct_type": 2, "ct_type": 2,
"type":"vm", "type":"vm",
@ -138,7 +138,7 @@ post_to_api_vm() {
"random_id": "$RANDOM_UUID" "random_id": "$RANDOM_UUID"
} }
EOF EOF
) )
RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "$JSON_PAYLOAD") || true -d "$JSON_PAYLOAD") || true
@ -147,7 +147,7 @@ EOF
POST_UPDATE_DONE=false POST_UPDATE_DONE=false
post_update_to_api() { post_update_to_api() {
if ! command -v curl &> /dev/null; then if ! command -v curl &>/dev/null; then
return return
fi fi
@ -162,23 +162,22 @@ post_update_to_api() {
local exit_code="${2:-0}" local exit_code="${2:-0}"
fi fi
local API_URL="http://api.community-scripts.org/dev/upload/updatestatus" local API_URL="http://api.community-scripts.org/dev/upload/updatestatus"
error=$(get_error_description "$exit_code") error=$(get_error_description "$exit_code")
if [ -z "$error" ]; then if [ -z "$error" ]; then
error="Unknown error" error="Unknown error"
fi fi
JSON_PAYLOAD=$(cat <<EOF JSON_PAYLOAD=$(
cat <<EOF
{ {
"status": "$status", "status": "$status",
"error": "$error", "error": "$error",
"random_id": "$RANDOM_UUID" "random_id": "$RANDOM_UUID"
} }
EOF EOF
) )
RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ RESPONSE=$(curl -s -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "$JSON_PAYLOAD") || true -d "$JSON_PAYLOAD") || true