Hiding the Unifi OS nag screen

Đang mở
#183 5 bình luận 7 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
bash, docker
Lĩnh vực
devops, infrastructure

Hướng nghiên cứu

Bắt đầu với đường dẫn khởi tạo container và entry point được mount /custom-cont-init.d/unifi-patch-upgrade-nag.sh, sau đó kiểm tra bundle /usr/lib/unifi/webapps/ROOT/app-unifi/react/js/ mà nó nhắm tới. So sánh hành vi của script được cung cấp với luồng khởi động của image. Được xem là hoàn thành khi cảnh báo nâng cấp bị ẩn nếu bundle dự kiến tồn tại, còn các bundle bị thiếu hoặc đã thay đổi được báo cáo mà không âm thầm thành công.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

If you are fully aware of the pending deprecation of unifi network application and the push to move to Unifi OS, you may want to hide the nag screen when you login. Here is how to do so in our container.

Source

note in the volumes section the mapped in script denoted with <-----

  unifi-network-application:
    <<: *lsioint
    image: lscr.io/linuxserver/unifi-network-application:latest
    container_name: unifi-network-application
    networks:
      - dznet
      - logging
    environment:
      <<: *lsio
      UNIFI_VERSION: 9.4.19
      MONGO_USER: ${UNIFIUSER}
      MONGO_PASS: ${UNIFIPASS}
      MONGO_HOST: mongo
      MONGO_PORT: 27017
      MONGO_DBNAME: unifi
      MONGO_AUTHSOURCE: admin
    labels:
      - diun.enable=true
    volumes:
      - ${CONFDIR}/unifi-network-application:/config
      - ${CONFDIR}/swag/etc:/swag-ssl
      - ${TIME}:${TIME}:ro
      - /srv/scripts/unifi-patch-upgrade-nag.sh:/custom-cont-init.d/unifi-patch-upgrade-nag.sh # <-----
    ports:
      - 3478:3478/udp
      - 10001:10001/udp
      - 8080:8080
      - 8081:8081
      - 8143:8443
      - 8843:8843
      - 8880:8880
      - 6789:6789

the script contents should be

#!/bin/bash
# Patch out the "Upgrade to UniFi OS Server" nag modal
# Mount as:
#   -v ./unifi-patch-upgrade-nag.sh:/custom-cont-init.d/unifi-patch-upgrade-nag.sh

set -eu

SWAI_FILE=$(find /usr/lib/unifi/webapps/ROOT/app-unifi/react/js/ -name 'swai.*.js' 2>/dev/null | head -1)

if [ -z "${SWAI_FILE:-}" ]; then
    echo "[patch] swai.js not found, skipping upgrade nag patch"
    exit 0
fi

# Already patched?
if grep -q 'return !1&&r?' "$SWAI_FILE"; then
    echo "[patch] Already patched"
    exit 0
fi

# Replace:
#   return n&&r?<any>.createElement(<any>.aF.Root
# with:
#   return !1&&r?<same>.createElement(<same>.aF.Root
#
# This avoids depending on minified symbol names like e/t and Ne/fe/he.
if sed -E -i \
    's/return n&&r\?([A-Za-z_$][A-Za-z0-9_$]*)\.createElement\(([A-Za-z_$][A-Za-z0-9_$]*)\.aF\.Root/return !1\&\&r?\1.createElement(\2.aF.Root/' \
    "$SWAI_FILE"; then

    if grep -q 'return !1&&r?' "$SWAI_FILE"; then
        echo "[patch] Upgrade to UniFi OS Server nag removed"
    else
        echo "[patch] Pattern not found, UniFi bundle changed"
        exit 1
    fi
else
    echo "[patch] sed failed"
    exit 1
fi

I have tested this in my own environment and it works perfectly.

Ngôn ngữ chính
Dockerfile
Star
1.2k
Fork
96
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của linuxserver/docker-unifi-network-application

Tất cả issue của linuxserver/docker-unifi-network-application

Issue tương tự

Thêm issue về DevOps

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.