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/
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
pnpm install
$STD pnpm install
cat <<EOF > /opt/meilisearch-ui/.env.local
VITE_SINGLETON_MODE=true
VITE_SINGLETON_HOST=http://${LOCAL_IP}:7700

View File

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