Compare commits

..

82 Commits

Author SHA1 Message Date
elseif
a988945f52 update keygen 2026-08-26 01:34:39 +08:00
elseif
e94750a0d8 update keygen 2026-08-25 21:21:44 +08:00
elseif
489427c34f use musl-toolchain compile busybox 2026-08-25 19:48:01 +08:00
elseif
f7a2316049 Merge branch 'main' of github.com:elseif/MikroTikPatch 2026-08-25 17:22:51 +08:00
elseif
7410c6dc6b modified: .github/workflows/build_docker.yml
modified:   index.html
2026-08-25 17:22:35 +08:00
elseif
fc1d950da6 Update patch_v7.yml
Signed-off-by: elseif <elseif@live.cn>
2026-08-21 19:00:54 +08:00
elseif
622ba70c2a Update patch_v7.yml
Signed-off-by: elseif <elseif@live.cn>
2026-08-21 17:42:56 +08:00
elseif
4761e53917 Update main.yml
Signed-off-by: elseif <elseif@live.cn>
2026-08-21 17:40:18 +08:00
elseif
74a6a9c8dd modified: .github/workflows/build_docker.yml 2026-08-05 01:39:42 +08:00
elseif
e29a43041c modified: .github/workflows/build_docker.yml 2026-08-05 01:36:43 +08:00
elseif
3dc5e43434 modified: .github/workflows/build_docker.yml 2026-08-05 01:21:20 +08:00
elseif
68dcd99bc0 modified: keygen/keygen_arm64
modified:   keygen/keygen_x86
2026-07-22 23:00:59 +08:00
elseif
63bff2eed4 modified: keygen/keygen_arm64
modified:   keygen/keygen_x86
2026-07-22 19:21:38 +08:00
elseif
7163a9d629 Change alignment setting from 1 to 8 in sgdisk commands
change to 4k align

Signed-off-by: elseif <elseif@live.cn>
2026-07-22 04:38:39 +08:00
elseif
1403e9c3d5 Update cloud service section in README_CN.md
Signed-off-by: elseif <elseif@live.cn>
2026-07-22 04:29:43 +08:00
elseif
e7899eef0a Update README_CN.md
Signed-off-by: elseif <elseif@live.cn>
2026-07-22 04:29:20 +08:00
elseif
3bb2470535 Fix formatting in feature guide of README
Correct formatting of feature guide section in README.

Signed-off-by: elseif <elseif@live.cn>
2026-07-22 04:28:32 +08:00
elseif
072d684830 Update README.md
Signed-off-by: elseif <elseif@live.cn>
2026-07-22 04:27:52 +08:00
elseif
e2387c9ab3 Update README.md
Signed-off-by: elseif <elseif@live.cn>
2026-07-22 04:26:53 +08:00
elseif
3d7033276a Update README.md
Signed-off-by: elseif <elseif@live.cn>
2026-07-22 04:26:21 +08:00
elseif
34aba15f4c modified: .github/workflows/main.yml 2026-07-21 18:15:03 +08:00
elseif
e6b0e3a7c7 modified: .github/workflows/main.yml 2026-07-21 18:11:30 +08:00
elseif
bf1143fa81 modified: chr.sh 2026-07-21 13:54:24 +08:00
elseif
53cfc32c64 modified: README.md 2026-07-21 09:59:27 +08:00
elseif
4522e4c245 modified: README.md
modified:   README_CN.md
2026-07-21 09:38:40 +08:00
elseif
155823c638 modified: README.md
new file:   README_CN.md
2026-07-21 09:29:18 +08:00
elseif
5ef16bd0a2 modified: README.md 2026-07-21 09:17:20 +08:00
elseif
37bc80919a modified: README.md 2026-07-21 09:16:27 +08:00
elseif
57a1f98516 modified: README.md 2026-07-20 17:12:28 +08:00
elseif
45cfa3693a modified: README.md 2026-07-20 17:05:09 +08:00
elseif
bc4887e9e5 modified: .github/workflows/build_docker.yml 2026-07-20 16:57:24 +08:00
elseif
cd727fe33c modified: .github/workflows/build_docker.yml 2026-07-20 16:49:11 +08:00
elseif
017302e6e6 modified: .github/workflows/patch_v6.yml
modified:   .github/workflows/patch_v7.yml
	modified:   patch.py
2026-07-20 15:54:13 +08:00
elseif
c4aa017ec2 Simplify Docker run command in README
Updated Docker run command by removing memory, CPU, and disk parameters.

Signed-off-by: elseif <elseif@live.cn>
2026-07-19 19:46:44 +08:00
elseif
ec3fc1d8b0 Update README.md
Signed-off-by: elseif <elseif@live.cn>
2026-07-19 19:46:02 +08:00
elseif
9ff5bc4d49 Update README.md
Signed-off-by: elseif <elseif@live.cn>
2026-07-19 19:43:41 +08:00
elseif
2daa51ba67 modified: README.md 2026-07-18 17:02:34 +08:00
elseif
cebf02d5f6 modified: README.md 2026-07-18 17:00:15 +08:00
elseif
85582304cb modified: README.md 2026-07-18 16:56:24 +08:00
elseif
d4287e92a3 modified: README.md 2026-07-18 16:53:58 +08:00
elseif
4de5fd88c0 modified: README.md 2026-07-18 16:51:51 +08:00
elseif
d970a10e08 modified: README.md 2026-07-18 16:51:07 +08:00
elseif
88b7f61b42 modified: index.html 2026-07-18 16:23:42 +08:00
elseif
630e9be8e6 modified: README.md 2026-07-17 09:13:17 +08:00
elseif
b3398d2341 Merge branch 'main' of github.com:elseif/MikroTikPatch 2026-07-17 09:10:23 +08:00
elseif
7aabc6ffcd modified: README.md 2026-07-17 09:08:16 +08:00
elseif
17b6db1acc modified: README.md
modified:   README.md

Changes not staged for commit:
	modified:   README.md
2026-07-17 09:08:09 +08:00
elseif
a6e8bb3c87 modified: README.md 2026-07-17 09:06:37 +08:00
elseif
50b4c1036e modified: README.md 2026-07-17 09:04:42 +08:00
elseif
5e4e7eead0 deleted: README_EN.md
deleted:    README_PT.md
	deleted:    image/arm.png
	deleted:    image/install.png
	deleted:    image/mips.png
	deleted:    image/renew.png
	deleted:    image/renew_v6.png
	deleted:    image/routeros.png
2026-07-17 09:03:58 +08:00
elseif
37ba5451aa modified: README.md 2026-07-17 09:01:41 +08:00
elseif
e07ec52d34 modified: .github/workflows/build_docker.yml 2026-07-16 14:45:52 +08:00
elseif
bf73ab201b modified: .github/workflows/build_docker.yml 2026-07-16 14:42:38 +08:00
elseif
ae7943de83 modified: .github/workflows/build_docker.yml 2026-07-16 14:26:58 +08:00
elseif
3b42f1c5fb modified: .github/workflows/build_docker.yml 2026-07-16 14:22:52 +08:00
elseif
7b273f0464 modified: .github/workflows/build_docker.yml 2026-07-16 14:01:06 +08:00
elseif
5033270988 modified: .github/workflows/build_docker.yml 2026-07-16 13:54:42 +08:00
elseif
063cd7785f modified: .github/workflows/build_docker.yml 2026-07-16 13:28:07 +08:00
elseif
b628eaadd2 modified: .github/workflows/build_docker.yml 2026-07-16 13:25:36 +08:00
elseif
4d32f80f8b modified: .github/workflows/build_docker.yml 2026-07-16 13:19:44 +08:00
elseif
e576f75398 modified: .github/workflows/build_docker.yml 2026-07-16 13:15:39 +08:00
elseif
c7eba4be0c modified: .github/workflows/build_docker.yml 2026-07-16 13:14:00 +08:00
elseif
78a2720c82 modified: .github/workflows/build_docker.yml 2026-07-16 13:10:22 +08:00
elseif
9cc32db4d2 modified: .github/workflows/build_docker.yml 2026-07-16 12:47:25 +08:00
elseif
4f3f8b5e40 modified: .github/workflows/build_docker.yml 2026-07-16 12:43:14 +08:00
elseif
68e9f1f5c2 modified: .github/workflows/build_docker.yml 2026-07-16 12:14:25 +08:00
elseif
a46286d886 modified: .github/workflows/build_docker.yml 2026-07-16 10:03:43 +08:00
elseif
e44ea1504b modified: .github/workflows/build_docker.yml 2026-07-16 09:59:39 +08:00
elseif
57f2724d69 modified: .github/workflows/build_docker.yml 2026-07-16 09:57:55 +08:00
elseif
672c225645 modified: .github/workflows/build_docker.yml 2026-07-16 09:47:00 +08:00
elseif
ad036099ce modified: .github/workflows/build_docker.yml 2026-07-16 09:42:18 +08:00
elseif
723969a497 modified: .github/workflows/build_docker.yml 2026-07-16 09:31:54 +08:00
elseif
ae84c4ecde modified: .github/workflows/build_docker.yml 2026-07-16 09:12:32 +08:00
elseif
54c562f054 Simplify multi arch manifest creation
Removed unnecessary output of JSON file contents before creating the multi-architecture manifest.

Signed-off-by: elseif <elseif@live.cn>
2026-07-16 07:00:23 +08:00
elseif
ddb8fe368e Update Docker build workflow to use QEMU setup
Signed-off-by: elseif <elseif@live.cn>
2026-07-16 06:57:58 +08:00
elseif
e4138453e1 Add IMAGE variable for Docker build process
Signed-off-by: elseif <elseif@live.cn>
2026-07-16 06:55:37 +08:00
elseif
db0273d518 Output digests before creating Docker manifest
Add commands to output digests from JSON files before creating a multi-architecture Docker manifest.

Signed-off-by: elseif <elseif@live.cn>
2026-07-16 06:45:05 +08:00
elseif
c4cada441a Add permissions for package writing in workflow
Signed-off-by: elseif <elseif@live.cn>
2026-07-16 06:33:59 +08:00
elseif
89ea52c7df Refactor Docker build workflow and update inputs
Signed-off-by: elseif <elseif@live.cn>
2026-07-16 06:26:37 +08:00
elseif
0670bf0818 Add Patch_Development_V7 workflow for version v7
Signed-off-by: elseif <elseif@live.cn>
2026-07-16 03:20:46 +08:00
elseif
ea433daaf8 Add 'development' option to channel input
Signed-off-by: elseif <elseif@live.cn>
2026-07-16 03:20:05 +08:00
elseif
18fd42ae68 Rename jobs for V7 in GitHub Actions workflow
Signed-off-by: elseif <elseif@live.cn>
2026-07-16 01:16:56 +08:00
21 changed files with 539 additions and 255 deletions

293
.github/workflows/build_docker.yml vendored Normal file
View File

@@ -0,0 +1,293 @@
name: Build CHR Docker
on:
workflow_dispatch:
inputs:
version:
description: "Specify version (e.g., 7.19.2), empty for latest"
required: false
default: ''
type: string
force:
description: "Force rebuild even if version already exists"
required: false
default: false
type: boolean
permissions:
packages: write
jobs:
Prepare:
runs-on: ubuntu-24.04
outputs:
MATRIX: ${{ steps.filter_matrix.outputs.MATRIX }}
steps:
- name: Get versions and generate matrix
id: get_versions
run: |
VERSION="${{ inputs.version }}"
if [ -n "$VERSION" ]; then
MATRIX=$(jq -c -n '
[
{ "version": $VERSION, "channel": ""}
]
' --arg VERSION "$VERSION")
else
TIMESTAMP=$(date +%s)
LONG_TERM=$(wget -nv -O - "https://upgrade.mikrotik.ltd/routeros/NEWESTa7.long-term?t=$TIMESTAMP" | cut -d ' ' -f1)
STABLE=$(wget -nv -O - "https://upgrade.mikrotik.ltd/routeros/NEWESTa7.stable?t=$TIMESTAMP" | cut -d ' ' -f1)
echo "Long-term version: $LONG_TERM"
echo "Stable version: $STABLE"
if [ -z "$LONG_TERM" ]; then
echo "Failed to get long-term version"
exit 1
fi
if [ -z "$STABLE" ]; then
echo "Failed to get stable version"
exit 1
fi
MATRIX=$(jq -c -n '
[
{version: $LONG_TERM, channel: "long-term"},
{version: $STABLE, channel: "stable"}
]
' --arg LONG_TERM "$LONG_TERM" --arg STABLE "$STABLE")
fi
echo "Generated matrix: $MATRIX"
echo "MATRIX=$MATRIX" >> $GITHUB_OUTPUT
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Filter already-published versions from matrix
id: filter_matrix
env:
IMAGE: "ghcr.io/${{ github.repository_owner }}/chr"
FORCE: ${{ github.event.inputs.force == 'true' }}
run: |
MATRIX='${{ steps.get_versions.outputs.MATRIX }}'
if [ "$FORCE" = "true" ]; then
echo "Force mode enabled, skipping version existence check."
FILTERED="$MATRIX"
else
FILTERED='[]'
while read -r row; do
VERSION=$(echo "$row" | jq -r '.version')
CHANNEL=$(echo "$row" | jq -r '.channel')
set +e
docker manifest inspect "${IMAGE}:${VERSION}" >/dev/null 2>&1
RET=$?
set -e
if [ "$RET" -eq 0 ]; then
echo "Skipping already published version: ${VERSION}"
else
FILTERED=$(echo "$FILTERED" | jq -c --arg VERSION "$VERSION" --arg CHANNEL "$CHANNEL" '. + [{"version": $VERSION, "channel": $CHANNEL}]')
fi
done < <(echo "$MATRIX" | jq -c '.[]')
fi
echo "Filtered matrix: $FILTERED"
echo "MATRIX=$FILTERED" >> "$GITHUB_OUTPUT"
Build:
if: needs.Prepare.outputs.MATRIX != '[]'
runs-on: ubuntu-24.04
needs: Prepare
strategy:
max-parallel: 1
matrix:
include: ${{ fromJson(needs.Prepare.outputs.MATRIX != '[]' && needs.Prepare.outputs.MATRIX || '[{"version":"__NO_BUILD__","channel":""}]') }}
env:
TZ: 'Asia/Shanghai'
VERSION: ${{ matrix.version }}
CHANNEL: ${{ matrix.channel }}
IMAGE: "ghcr.io/${{ github.repository_owner }}/chr"
DOCKER_BUILD_SUMMARY: 'false'
DOCKER_BUILD_RECORD_UPLOAD: 'false'
steps:
- name: Show build info
run: |
echo "Version: ${{ env.VERSION }}"
echo "Channel: ${{ env.CHANNEL }}"
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download CHR image
run: |
# x86 架构
mkdir -p "amd64"
wget -nv -O "amd64/chr-$VERSION.img.zip" \
"https://github.com/elseif/MikroTikPatch/releases/download/$VERSION/chr-$VERSION-legacy-bios.img.zip"
unzip "amd64/chr-$VERSION.img.zip" -d "amd64/"
mv "amd64/chr-$VERSION-legacy-bios.img" "amd64/chr.img"
rm "amd64/chr-$VERSION.img.zip"
# arm64 架构
mkdir -p "arm64"
wget -nv -O "arm64/chr-$VERSION-arm64.img.zip" \
"https://github.com/elseif/MikroTikPatch/releases/download/$VERSION-arm64/chr-$VERSION-arm64.img.zip"
unzip "arm64/chr-$VERSION-arm64.img.zip" -d "arm64/"
mv "arm64/chr-$VERSION-arm64.img" "arm64/chr.img"
rm "arm64/chr-$VERSION-arm64.img.zip"
ls -la amd64/ arm64/
- name: Create start.sh
run: |
cat <<'EOF' > start.sh
#!/bin/sh
set -e
MEM="${MEM:=512m}"
DISK="${DISK:=128M}"
CPUS="${CPUS:=1}"
bridge_index=0
get_mac_address() {
ifname="$1"
ip link show "$ifname" 2>/dev/null | awk '/link\/ether/ {print $2}'
}
increment_mac() {
mac=$1
mac_no_colons=$(echo "$mac" | tr -d ':' | tr '[:lower:]' '[:upper:]')
mac_dec=$((16#${mac_no_colons}))
mac_dec=$((mac_dec + 1))
mac_hex=$(printf "%012X" "$mac_dec")
echo "$mac_hex" | sed 's/.\{2\}/&:/g;s/:$//'
}
echo "" > /etc/qemu/bridge.conf
qemu="qemu-system-x86_64"
if [[ `uname -m` == "aarch64" ]]; then
qemu="qemu-system-aarch64 -pflash /usr/share/qemu/edk2-aarch64-code.fd -M virt"
fi
if [ -e /dev/kvm ]; then
qemu="$qemu -enable-kvm -cpu host"
else
if [[ `uname -m` == "aarch64" ]]; then
qemu="$qemu -cpu cortex-a57"
fi
fi
img=`ls /diskimage/*.img`
qemu="$qemu -nographic -m $MEM -smp cpus=$CPUS -drive file=$img,format=raw"
truncate -s $DISK $img
while read -r line; do
iface=$(echo "$line" | sed "s/ *\([a-z0-9]*\):.*/\1/")
if [[ "$iface" =~ " " ]]; then
continue
fi
if [[ "$iface" =~ ^br ]]; then
continue
fi
if [[ "$iface" == "lo" ]]; then
continue
fi
if [[ "$iface" == "" ]]; then
continue
fi
echo "iface: $iface"
bridge="br$bridge_index"
ip link add name "$bridge" type bridge
ip link set dev "$bridge" up
ip link set "$iface" master "$bridge"
echo "allow $bridge" >> /etc/qemu/bridge.conf
veth_mac=$(get_mac_address "$iface")
tap_mac=$(increment_mac "$veth_mac")
bridge_index=$((bridge_index + 1))
qemu="$qemu -netdev bridge,id=$bridge,br=$bridge -device virtio-net,netdev=$bridge,mac=$tap_mac "
done < /proc/net/dev
echo "qemu: $qemu"
exec $qemu
EOF
chmod +x start.sh
- name: Create Dockerfile
run: |
cat > Dockerfile << 'EOF'
FROM alpine:latest
ARG TARGETARCH
ARG VERSION
RUN case "$TARGETARCH" in \
amd64) apk add --no-cache qemu-system-x86_64 ;; \
arm64) apk add --no-cache qemu-system-aarch64 ;; \
esac \
&& rm -rf /var/cache/apk/*
RUN mkdir -p /diskimage
COPY ${TARGETARCH}/*.img /diskimage/
COPY start.sh /start.sh
ENTRYPOINT ["/start.sh"]
EOF
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and Push
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.IMAGE }}:${{ env.VERSION }}
build-args: VERSION=${{ env.VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
sbom: false
outputs: >
type=image,
annotation-index.org.opencontainers.image.title=MikroTik CHR RouterOS,
annotation-index.org.opencontainers.image.description=MikroTik CHR (Cloud Hosted Router) running on QEMU with Docker,
annotation-index.org.opencontainers.image.version=${{ env.VERSION }},
annotation-index.org.opencontainers.image.url=https://mikrotik.ltd
- name: Update channel tags
if: env.CHANNEL != ''
run: |
TAGS="-t ${{ env.IMAGE }}:${{ env.CHANNEL }}"
if [ "${{ env.CHANNEL }}" = "stable" ]; then
TAGS="$TAGS -t ${{ env.IMAGE }}:latest"
fi
echo "Creating tags: $TAGS"
docker buildx imagetools create $TAGS ${{ env.IMAGE }}:${{ env.VERSION }}
- name: Save Docker Image as tar
run: |
mkdir -p artifacts
echo "Exporting amd64 tar..."
docker pull --platform linux/amd64 ${{ env.IMAGE }}:${{ env.VERSION }}
docker save ${{ env.IMAGE }}:${{ env.VERSION }} -o artifacts/chr-${{ env.VERSION }}-amd64.tar
echo "Exporting arm64 tar..."
docker pull --platform linux/arm64 ${{ env.IMAGE }}:${{ env.VERSION }}
docker save ${{ env.IMAGE }}:${{ env.VERSION }} -o artifacts/chr-${{ env.VERSION }}-arm64.tar
ls -lh artifacts/
- name: Upload tar artifact
uses: actions/upload-artifact@v7
with:
name: chr-${{ env.VERSION }}-docker-images
path: artifacts/
retention-days: 30

View File

@@ -2,7 +2,7 @@
name: Patch Mikrotik RouterOS
on:
schedule:
- cron: "00 10 * * *" # At UTC 10:00 (Beijing 18:00) on every day
- cron: "00 09 * * *" # At UTC 09:00 (Beijing 17:00) on every day
workflow_dispatch:
inputs:
version:
@@ -15,7 +15,7 @@ on:
- v6
- v7
jobs:
Patch_Stable:
Patch_Stable_V7:
if: |
(github.event_name == 'schedule') ||
(github.event_name == 'workflow_dispatch' && (github.event.inputs.version == 'all' || github.event.inputs.version == 'v7'))
@@ -25,7 +25,7 @@ jobs:
release: true
secrets: inherit
Patch_LongTerm:
Patch_LongTerm_V7:
if: |
(github.event_name == 'schedule') ||
(github.event_name == 'workflow_dispatch' && (github.event.inputs.version == 'all' || github.event.inputs.version == 'v7'))
@@ -35,16 +35,26 @@ jobs:
release: true
secrets: inherit
Patch_Testing:
if: |
(github.event_name == 'schedule') ||
(github.event_name == 'workflow_dispatch' && (github.event.inputs.version == 'all' || github.event.inputs.version == 'v7'))
uses: ./.github/workflows/patch_v7.yml
with:
channel: testing
release: true
secrets: inherit
# Patch_Testing_V7:
# if: |
# (github.event_name == 'schedule') ||
# (github.event_name == 'workflow_dispatch' && (github.event.inputs.version == 'all' || github.event.inputs.version == 'v7'))
# uses: ./.github/workflows/patch_v7.yml
# with:
# channel: testing
# release: true
# secrets: inherit
# Patch_Development_V7:
# if: |
# (github.event_name == 'schedule') ||
# (github.event_name == 'workflow_dispatch' && (github.event.inputs.version == 'all' || github.event.inputs.version == 'v7'))
# uses: ./.github/workflows/patch_v7.yml
# with:
# channel: development
# release: true
# secrets: inherit
Patch_Stable_V6:
if: |
(github.event_name == 'schedule') ||

View File

@@ -60,7 +60,8 @@ env:
CUSTOM_RENEW_URL: ${{ secrets.CUSTOM_RENEW_URL }}
MIKRO_CLOUD_URL: ${{ secrets.MIKRO_CLOUD_URL }}
CUSTOM_CLOUD_URL: ${{ secrets.CUSTOM_CLOUD_URL }}
MIKRO_CLOUD2_URL: ${{ secrets.MIKRO_CLOUD2_URL }}
CUSTOM_CLOUD2_URL: ${{ secrets.CUSTOM_CLOUD2_URL }}
jobs:
Prepare_Patch:

View File

@@ -3,14 +3,15 @@ on:
workflow_dispatch:
inputs:
channel:
description: 'Channel (stable, long-term, testing)'
description: 'Channel (stable, long-term, testing, development)'
required: true
default: 'stable'
type: choice
options:
- stable
- long-term
- testing
# - testing
# - development
arch:
description: 'Architecture (x86, arm64)'
required: true
@@ -75,7 +76,9 @@ env:
CUSTOM_RENEW_URL: ${{ secrets.CUSTOM_RENEW_URL }}
MIKRO_CLOUD_URL: ${{ secrets.MIKRO_CLOUD_URL }}
CUSTOM_CLOUD_URL: ${{ secrets.CUSTOM_CLOUD_URL }}
MIKRO_CLOUD2_URL: ${{ secrets.MIKRO_CLOUD2_URL }}
CUSTOM_CLOUD2_URL: ${{ secrets.CUSTOM_CLOUD2_URL }}
jobs:
Prepare_Patch:
runs-on: ubuntu-24.04

141
README.md
View File

@@ -1,71 +1,104 @@
# MikroTik RouterOS Patch
[![Patch Mikrotik RouterOS](https://github.com/elseif/MikroTikPatch/actions/workflows/main.yml/badge.svg)](https://github.com/elseif/MikroTikPatch/actions/workflows/main.yml)
![Cloud Status](https://img.shields.io/endpoint?url=https://mikrotik.ltd/status/cloud)
### 感谢赞助
[![DigitalOcean Referral Badge](https://web-platforms.sfo2.cdn.digitaloceanspaces.com/WWW/Badge%201.svg)](https://www.digitalocean.com/?refcode=dbf6ed365068&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge)
[DartNode(aff)](https://dartnode.com?aff=SnazzyLobster067) | [ZMTO(aff)](https://console.zmto.com/?affid=1588) | [Vultr(aff)](https://www.vultr.com/?ref=9807160-9J)
**重要提示:** 仅用于**测试目的**。使用风险自负。生产环境请使用官方授权版本。
继续操作即表示您确认:
- 您已阅读并理解所涉及的法律风险和影响
- 这些工具将仅在非生产测试环境中使用
- 生产部署将使用官方授权软件
# MikroTik RouterOS Patch [[English](README_EN.md)]
[![License: WTFPL](https://img.shields.io/badge/License-WTFPL-brightgreen.svg)](./LICENSE)
[![CoC:WTFCoC](https://img.shields.io/badge/CoC-WTFCoC-brightgreen.svg)](./CODE_OF_CONDUCT.md)
### [[Discord](https://discord.gg/keV6MWQFtX)] [[Telegram](https://telegram.me/mikrotikpatch)] [[Keygen(Telegram Bot)](https://telegram.me/ROS_Keygen_Bot)]
**English** | [中文](./README_CN.md)
支持:在线更新、在线授权、云备份、DDNS
> ## ⚠️ Important Notice
>
> **This project and its tools are for testing purposes only. Use at your own risk. Please use the officially licensed version for production environments.**
![Cloud Status](https://img.shields.io/endpoint?url=https://mikrotik.ltd/status/cloud)
## 🏗️ Architecture Support
### x86 / arm64 (This Project)
- **Homepage:** https://mikrotik.ltd/
- **Demo:** https://demo.mikrotik.ltd/
- **License: Installing `option.npk` will automatically grant the highest-level license.**
- **License Bot:** https://t.me/ROS_Keygen_Bot
- **Docker** `docker run -d --privileged --name chr ghcr.io/elseif/chr:latest`
*如果云服务或部署云服务的虚拟主机都不在线那么在线更新、在线授权、云备份、DDNS以及ROS_Keygen_Bot都暂时不能使用*
### arm64, arm, mipsbe, mmips, ppc, smips, x86
- **Homepage:** https://routeros.ltd/
- **License: Sponsorship required.** *CHR versions (x86/Arm64) support online direct licensing.*
- **Features:** Supports online custom brand package creation.
---
### 从7.19.4和7.20beta8开始安装option包以后会自动激活授权如果有rc.local文件会自动加载运行。
```mermaid
graph TD
A[启动] --> B[检查 keygen 文件是否存在 ]
B -->|是| C[fork 执行 keygen]
B -->|否| D[检查 rc.local 文件是否存在]
C --> D
D -->|是| E[fork 执行 /bin/sh rc.local]
D -->|否| F[启动服务]
E --> F
## 🔧 Feature Guide
> All features below require the `option.npk` package to be installed first.
### 1. Enable Container Mode (No Physical Reboot Required)
```bash
# Step 1: Enable container mode
/system/device-mode/update container=yes
# Step 2: Force reboot (execute in a new terminal)
/system/shell cmd="reboot -f"
```
![](image/install.png)
![](image/routeros.png)
### 2. Shell Access
#### A. Via Terminal
```bash
/system/shell
# or shorthand
/sh
```
#### B. Via SSH / Telnet
```bash
# Username: devel
# Password: Same as the admin password
ssh devel@<router-ip>
```
### 3. x86 Architecture: CHR ↔ x86 Mode Switch
### x86模式在线授权(v6.x)
![](image/renew_v6.png)
### Chr模式在线授权
![](image/renew.png)
```bash
# Execute after entering shell
keygen chr # Switch to CHR mode
keygen x86 # Switch to x86 mode
```
### 4. Boot Auto-Run Script
![](image/arm.png)
![](image/mips.png)
1. Create or edit the `/rw/disk/rc.local` file.
2. Write your script content, for example
## 如何使用Shell
安装 option-{version}.npk 包
在终端执行 /sh 进入shell
## 如何授权许可
安装 option-{version}.npk 包后,重启设备,会自动激活授权许可
Chr镜像支持在线授权许可
## 如何使用Python
安装 python3-{version}.npk 包
在终端执行 /sh 进入shell
运行 python -V
### npk.py
对npk文件进行解包修改创建签名和验证
### patch.py
替换公钥并签名
### 如何在不物理重启的情况下启用容器模式
1. 安装 option.npk 包。
2. 打开终端并执行:`system/device-mode/update container=yes`
3. 打开一个新终端并执行: `system/shell cmd="reboot -f"`
```bash
#!/bin/sh
# This script will be executed *before* RouterOS *loader* start.
# You can put your own initialization stuff in here
echo "Hello, world!"
```
3. You will see the output during boot: `Starting rc.local...`
4. After boot, check the output:
```bash
# Enter shell
cat /ram/startup.catlog | grep 'Hello'
```
---
## ☁️ Cloud Services
| Feature | Command |
|------|------|
| Online Upgrade | `system/package/update/install` |
| Dynamic DNS | `ip/cloud/set ddns-enabled=yes` |
| Cloud Backup | `/system/backup/cloud/upload-file action=create-and-upload password=any` |
| Internet Detection | `/interface/detect-internet/set detect-interface-list=all` |
---
## 📚 Resources
- [MikroTik Official Documentation](https://manual.mikrotik.com/)
- [Telegram Group](https://t.me/+99Mw06p3K7NlMmNl)
- [GitHub Source Code](https://github.com/elseif/MikroTikPatch)
---
## 💖 Sponsors
[![Powered by DartNode](https://dartnode.com/branding/DN-Open-Source-sm.png)](https://dartnode.com "Powered by DartNode - Free VPS for Open Source")
[DartNode(aff)](https://dartnode.com?aff=SnazzyLobster067) | [ZMTO(aff)](https://console.zmto.com/?affid=1588) | [Vultr(aff)](https://www.vultr.com/?ref=9807160-9J)

115
README_CN.md Normal file
View File

@@ -0,0 +1,115 @@
# MikroTik RouterOS Patch
[![Patch Mikrotik RouterOS](https://github.com/elseif/MikroTikPatch/actions/workflows/main.yml/badge.svg)](https://github.com/elseif/MikroTikPatch/actions/workflows/main.yml)
![Cloud Status](https://img.shields.io/endpoint?url=https://mikrotik.ltd/status/cloud)
[![License: WTFPL](https://img.shields.io/badge/License-WTFPL-brightgreen.svg)](./LICENSE)
[![CoC:WTFCoC](https://img.shields.io/badge/CoC-WTFCoC-brightgreen.svg)](./CODE_OF_CONDUCT.md)
[English](./README.md) | **中文**
>## ⚠️ 重要声明
>
>**此项目及工具仅供测试用途。使用风险自负。生产环境请使用官方授权版本。**
## 🏗️ 架构支持
### x86 / arm64 (本项目)
- **主页:** https://mikrotik.ltd/
- **演示:** https://demo.mikrotik.ltd/
- **授权: 安装option.npk后将自动授予最高级别许可证。**
- **授权BOT** https://t.me/ROS_Keygen_Bot
- **Docker** `docker run -d --privileged --name chr ghcr.io/elseif/chr:latest`
### arm64, arm, mipsbe, mmips, ppc, smips, x86
- **主页:** https://routeros.ltd/
- **授权: 需要赞助***CHR版本(x86/Arm64)支持在线直接获取授权*
- **功能:** 支持在线自定义制作品牌包
---
## 🔧 功能指南
> 以下功能均需先安装 `option.npk` 包。
### 1. 启用容器模式(无需物理重启)
```bash
# 步骤 1启用容器模式
/system/device-mode/update container=yes
# 步骤 2强制重启在新终端中执行
/system/shell cmd="reboot -f"
```
### 2. Shell 访问
#### A. 通过终端
```bash
/system/shell
# 或简写
/sh
```
#### B. 通过 SSH / Telnet
```bash
# 用户名: devel
# 密码: 与 admin 密码相同
ssh devel@<router-ip>
```
### 3. x86 架构CHR ↔ x86 模式切换
```bash
# 进入 shell 后执行
keygen chr # 切换为 CHR 模式
keygen x86 # 切换为 x86 模式
```
### 4. 开机自动运行脚本
1. 创建或编辑 `/rw/disk/rc.local` 文件
2. 写入脚本内容,例如:
```bash
#!/bin/sh
# This script will be executed *before* RouterOS *loader* start.
# You can put your own initialization stuff in here
echo "Hello, world!"
```
3. 开机启动时将看到输出:`Starting rc.local...`
4. 启动后查看输出:
```bash
# 进入 shell
cat /ram/startup.catlog | grep 'Hello'
```
---
## ☁️ 云服务
| 功能 | 命令 |
|------|------|
| 在线升级 | `system/package/update/install` |
| 动态域名 | `ip/cloud/set ddns-enabled=yes` |
| 云备份 | `/system/backup/cloud/upload-file action=create-and-upload password=any` |
| 网络检测 | `/interface/detect-internet/set detect-interface-list=all` |
---
## 📚 相关资源
- [MikroTik 官方文档](https://manual.mikrotik.com/)
- [Telegram 群组](https://t.me/+99Mw06p3K7NlMmNl)
- [GitHub 源码](https://github.com/elseif/MikroTikPatch)
---
## 💖 感谢赞助
[![Powered by DartNode](https://dartnode.com/branding/DN-Open-Source-sm.png)](https://dartnode.com "Powered by DartNode - Free VPS for Open Source")
[DartNode(aff)](https://dartnode.com?aff=SnazzyLobster067) | [ZMTO(aff)](https://console.zmto.com/?affid=1588) | [Vultr(aff)](https://www.vultr.com/?ref=9807160-9J)

View File

@@ -1,57 +0,0 @@
[![Patch Mikrotik RouterOS](https://github.com/elseif/MikroTikPatch/actions/workflows/main.yml/badge.svg)](https://github.com/elseif/MikroTikPatch/actions/workflows/main.yml)
**IMPORTANT:** For **testing purposes only**. Use at your own risk. Production environments require official licenses.
By proceeding, you acknowledge that:
- You have reviewed and comprehend the legal implications and risks involved
- These tools will be used exclusively in non-production, test environments
- Production deployments shall utilize officially licensed software
# MikroTik RouterOS Patch [[中文](README.md)]
[![License: WTFPL](https://img.shields.io/badge/License-WTFPL-brightgreen.svg)](./LICENSE)
[![CoC:WTFCoC](https://img.shields.io/badge/CoC-WTFCoC-brightgreen.svg)](./CODE_OF_CONDUCT.md)
### [[Discord](https://discord.gg/keV6MWQFtX)] [[Telegram](https://telegram.me/mikrotikpatch)] [[Keygen(Telegram Bot)](https://telegram.me/ROS_Keygen_Bot)]
### Download [Latest Patched](https://github.com/elseif/MikroTikPatch/releases/latest) iso file,install it and enjoy.
### CHR image is both support BIOS and UEFI boot mode.
### Support online upgrade,online license,cloud backup,cloud DDNS
![](image/install.png)
![](image/routeros.png)
### Renew license for x86 v6.x
![](image/renew_v6.png)
### Renew license for chr
![](image/renew.png)
![](image/arm.png)
![](image/mips.png)
## How to use shell
install option-{version}.npk package
Enter the shell by executing /sh in the terminal.
## How to license RouterOS
After installing the option-{version}.npk package, reboot the device. The license will be activated automatically.
CHR images support online license activation
## How to use python3
install python3-{version}.npk package
Enter the shell by executing /sh in the terminal.
run python -V
### npk.py
SignVerifyCreate, Extract npk file.
### patch.py
Patch public key and sign NPK files
### How to Enable Container Mode Without Physical Reboot
1. Install the option.npk package.
2. Open a terminal and run: `system/device-mode/update container=yes`
3. Open a new terminal and run: `system/shell cmd="reboot -f"`
## all patches are applied automatically with [Github Action](https://github.com/elseif/MikroTikPatch/blob/main/.github/workflows/).

View File

@@ -1,64 +0,0 @@
[![Patch Mikrotik RouterOS](https://github.com/elseif/MikroTikPatch/actions/workflows/main.yml/badge.svg)](https://github.com/elseif/MikroTikPatch/actions/workflows/main.yml)
# Patch para MikroTik RouterOS [[中文](README.md)]
[![License: WTFPL](https://img.shields.io/badge/License-WTFPL-brightgreen.svg)](./LICENSE)
[![CoC:WTFCoC](https://img.shields.io/badge/CoC-WTFCoC-brightgreen.svg)](./CODE_OF_CONDUCT.md)
### [[Discord](https://discord.gg/keV6MWQFtX)] [[Telegram](https://telegram.me/mikrotikpatch)] [[Keygen (Bot do Telegram)](https://telegram.me/ROS_Keygen_Bot)]
### Baixe a [ISO modificada mais recente](https://github.com/elseif/MikroTikPatch/releases/latest), instale e aproveite.
### A imagem CHR suporta modo de boot tanto BIOS quanto UEFI.
### Suporte a atualização online, licença online, backup em nuvem e DDNS em nuvem
![](image/install.png)
![](image/routeros.png)
### Renovar a licença para x86 v6.x
![](image/renew_v6.png)
### Renovar a licença para CHR
![](image/renew.png)
![](image/arm.png)
![](image/mips.png)
## Como usar o shell
```bash
instale o pacote option-{versão}.npk
Execute `/sh` no terminal para entrar no Shell.
```
## Como licenciar o RouterOS
```bash
Após instalar o pacote `option-{version}.npk`, reinicie o dispositivo. A licença será ativada automaticamente.
Imagens CHR suportam ativação de licença online.
```
## Como usar o Python 3
```bash
instale o pacote python3-{versão}.npk
Execute `/sh` no terminal para entrar no Shell.
execute `python -V`
```
### npk.py
```bash
Assina, verifica, cria e extrai arquivos .npk
```
### patch.py
```bash
Altera a chave pública e assina arquivos .npk
```
### Como ativar o modo container sem reiniciar fisicamente
```bash
1. Instale o pacote `option.npk`.
2. Abra o terminal e execute: `system/device-mode/update container=yes`
3. Abra um novo terminal e execute: `system/shell cmd="reboot -f"`
```
## Thanks for sponsoring
[ZMTO](https://console.zmto.com/)
## Todos os patches são aplicados automaticamente com [GitHub Actions](https://github.com/elseif/MikroTikPatch/blob/main/.github/workflows/)

Binary file not shown.

Binary file not shown.

6
chr.sh
View File

@@ -294,6 +294,12 @@ create_autorun() {
ask_until "$MSG_ADMIN_PASSWORD" "$RANDOM_ADMIN_PASS"
RANDOM_ADMIN_PASS=$resp
cat <<EOF > "$MNT/rw/autorun.scr"
/tool mac-server set allowed-interface-list=none
/tool mac-server mac-winbox set allowed-interface-list=none
/tool mac-server ping set enabled=no
/ip neighbor discovery-settings set discover-interface-list=none
/tool bandwidth-server set enabled=no
/ip dns set allow-remote-requests=no
/user set admin password="$RANDOM_ADMIN_PASS"
/ip dns set servers=$DNS
/ip address add address=$ADDRESS interface=[/interface ethernet get [find mac-address=$MAC] name]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 KiB

View File

@@ -196,11 +196,6 @@
<div class="w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"></div>
</label>
</div>
<!-- Clear cache button -->
<div>
<button data-i18n="clearCache" id="clear-cache" class="w-full text-sm font-semibold bg-slate-100 hover:bg-slate-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-slate-700 dark:text-slate-200 py-2 px-4 rounded-lg transition-colors flex items-center justify-center gap-2"></button>
</div>
</div>
</div>
</div>
@@ -285,24 +280,6 @@
</footer>
</div>
<!-- URLs modal for cache clearing -->
<div id="urls-pannel" class="fixed inset-0 bg-black/60 backdrop-blur-sm z-50 flex items-center justify-center p-4 hidden" tabindex="-1">
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col transform transition-all opacity-0 scale-95" id="modal-content">
<header class="p-4 border-b border-slate-200 dark:border-gray-700 flex justify-between items-center">
<h3 class="text-lg font-semibold text-slate-800 dark:text-white" data-i18n="copyUrlsClearCache"></h3>
<button id="urls-close" class="p-1 rounded-full text-slate-400 hover:bg-slate-100 dark:hover:bg-gray-700">
<span class="sr-only">Close modal</span>
<span class="iconify text-2xl" data-icon="ph:x-bold"></span>
</button>
</header>
<!-- URLs list display area -->
<div id="urls-list" class="p-6 text-sm text-slate-600 dark:text-slate-400 overflow-y-auto custom-scrollbar flex-grow bg-slate-50 dark:bg-gray-900/50 rounded-b-xl whitespace-pre-wrap break-all"></div>
<footer class="p-4 border-t border-slate-200 dark:border-gray-700">
<button id="copy-to-clear-cache" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 focus:ring-offset-white dark:focus:ring-offset-gray-800 flex items-center justify-center gap-2" data-i18n="copyUrlsClearCache" href="#"></button>
</footer>
</div>
</div>
<!-- Changelog popup modal -->
<div id="changelog-modal" class="fixed inset-0 bg-black/60 backdrop-blur-sm z-50 flex items-center justify-center p-4 hidden" tabindex="-1">
@@ -366,8 +343,6 @@
infoLabel2:`For more information about <b>install and upgrade</b> see the <a href="https://help.mikrotik.com/docs/" target="_blank" class="text-blue-500 dark:text-blue-400 hover:underline">Documentation</a>. For more information about <b>patch</b> see the <a href="https://github.com/elseif/MikroTikPatch" target="_blank" class="text-blue-500 dark:text-blue-400 hover:underline">MikroTikPatch</a>.`,
installCmdLabel:"Install Command",
proxyLabel:"Enable GitHub Proxy Accelerator",
clearCache:"Clear gh-proxy Cache",
copyUrlsClearCache:"Copy URLs & Open Clear Cache Page",
loading:"Loading latest versions...",
quickInformation:"Quick Information",
settings:"Settings",
@@ -382,8 +357,6 @@
infoLabel2:`有关<b>安装和升级</b>的更多信息,请参阅<a href="https://help.mikrotik.com/docs/" target="_blank" class="text-blue-500 dark:text-blue-400 hover:underline">文档</a><br>有关<b>Patch</b>的更多信息,请参阅<a href="https://github.com/elseif/MikroTikPatch" target="_blank" class="text-blue-500 dark:text-blue-400 hover:underline">MikroTikPatch</a>`,
installCmdLabel:"安装命令",
proxyLabel:"启用GitHub代理加速",
clearCache:"清除gh-proxy缓存",
copyUrlsClearCache:"复制链接并打开缓存清除页面",
loading:"正在加载最新版本...",
quickInformation:"快速信息",
settings:"设置",
@@ -400,11 +373,7 @@
const key = el.getAttribute("data-i18n");
if (i18n[lang] && i18n[lang][key]) {
// Special handling for buttons that need icons
if (key === 'clearCache') {
el.innerHTML = `<span class="iconify" data-icon="${ICONS.trash}"></span> ${i18n[lang][key]}`;
} else if (key === 'copyUrlsClearCache' && el.id === 'copy-to-clear-cache') {
el.innerHTML = `<span class="iconify" data-icon="${ICONS.copyAndOpen}"></span> ${i18n[lang][key]}`;
} else if (key === 'installCmdLabel') {
if (key === 'installCmdLabel') {
el.innerHTML = `<span class="iconify mr-2 text-blue-500" data-icon="ph:terminal-window-bold"></span>${i18n[lang][key]}`;
}
else {
@@ -473,9 +442,9 @@
// Fetch latest version numbers from MikroTik servers
const loadingOverlay = document.getElementById("loading");
const [routeros7_stable, routeros7_testing, routeros6_longterm, routeros6_stable] = await Promise.all([
const [routeros7_stable, routeros7_longterm, routeros6_longterm, routeros6_stable] = await Promise.all([
fetch_latest_versions(`https://upgrade.mikrotik.ltd/routeros/NEWESTa7.stable?ts=${Date.now()}`, "7.19.4"),
fetch_latest_versions(`https://upgrade.mikrotik.ltd/routeros/NEWESTa7.testing?ts=${Date.now()}`, "7.20rc1"),
fetch_latest_versions(`https://upgrade.mikrotik.ltd/routeros/NEWESTa7.long-term?ts=${Date.now()}`, "7.20rc1"),
fetch_latest_versions(`https://upgrade.mikrotik.ltd/routeros/NEWEST6.long-term?ts=${Date.now()}`, "6.49.18"),
fetch_latest_versions(`https://upgrade.mikrotik.ltd/routeros/NEWEST6.stable?ts=${Date.now()}`, "6.49.19"),
]);
@@ -487,7 +456,7 @@
const downloads =[
{
title:"RouterOS v7",
versions:[ { title:"Stable", version:routeros7_stable }, { title:"Testing", version:routeros7_testing } ],
versions:[ { title:"Long-Term", version:routeros7_longterm },{ title:"Stable", version:routeros7_stable } ],
groups: [
{ title:"ARM64 / AMPERE", arch:"arm64", downloads:[ { title:"Main package", type:"main" }, { title:"Extra packages", type:"extra" }, { title:"ISO image for AMPERE", type:"iso" } ] },
{ title:"X86", arch:"x86", downloads:[ { title:"Main package", type:"main" }, { title:"Extra packages", type:"extra" }, { title:"CD Image", type:"iso" }, { title:"Install image", type:"install" } ] },
@@ -503,7 +472,7 @@
},
{
title:"Cloud Hosted Router",
versions:[ { title:"Long-Term", version:routeros6_longterm }, { title:"Stable", version:routeros6_stable }, { title:"Stable", version:routeros7_stable }, { title:"Testing", version:routeros7_testing } ],
versions:[ { title:"Long-Term", version:routeros6_longterm }, { title:"Stable", version:routeros6_stable }, { title:"Long-Term", version:routeros7_longterm }, { title:"Stable", version:routeros7_stable } ],
groups:[
{ title:"X86", arch:"x86", downloads:[ { title:"Main package", type:"main" }, { title:"Extra packages", type:"extra" }, { title:"VHDX image", type:"vhdx" }, { title:"VMDK image", type:"vmdk" }, { title:"VDI image", type:"vdi" }, { title:"VirtualPC image", type:"vhd" }, { title:"Raw disk image", type:"img" }, { title:"OVA template", type:"ova" } ] },
{ title:"ARM64 / AMPERE", arch:"arm64", downloads:[ { title:"Main package", type:"main" }, { title:"Extra packages", type:"extra" }, { title:"VHDX image", type:"vhdx" }, { title:"VMDK image", type:"vmdk" }, { title:"VDI image", type:"vdi" }, { title:"VirtualPC image", type:"vhd" }, { title:"Raw disk image", type:"img" } ] }
@@ -618,13 +587,11 @@
// GitHub proxy functionality
const ghProxyCheckbox = document.getElementById("gh-proxy");
const clearCacheBtn = document.getElementById("clear-cache");
if (localStorage.getItem("gh-proxy-enabled") === null && navigator.language.startsWith("zh")) {
// Enable GitHub proxy by default for Chinese users
localStorage.setItem("gh-proxy-enabled", "true");
}
ghProxyCheckbox.checked = localStorage.getItem("gh-proxy-enabled") === "true";
clearCacheBtn.style.display = ghProxyCheckbox.checked ? "inline-flex" : "none";
// Update all download links with/without GitHub proxy
function updateAllDownloadLinks() {
@@ -646,33 +613,9 @@
// GitHub proxy toggle event listener
ghProxyCheckbox.addEventListener("change", () => {
localStorage.setItem("gh-proxy-enabled", ghProxyCheckbox.checked ? "true" : "false");
clearCacheBtn.style.display = ghProxyCheckbox.checked ? "inline-flex" : "none";
updateAllDownloadLinks();
});
// Cache clearing modal functionality
const modal = document.getElementById("urls-pannel");
const modalContent = document.getElementById("modal-content");
clearCacheBtn.addEventListener("click", () => {
const links = document.querySelectorAll('a[href^="https://gh-proxy.com/https://github.com/elseif/MikroTikPatch/"]');
document.getElementById("urls-list").innerText = Array.from(links).map(a => a.href).filter(href => !href.includes(".yml")).join("\n");
modal.classList.remove('hidden');
setTimeout(() => { modalContent.classList.add('opacity-100', 'scale-100'); modalContent.classList.remove('opacity-0', 'scale-95'); }, 10);
});
// Modal close functionality
document.getElementById("urls-close").addEventListener("click", () => {
modalContent.classList.remove('opacity-100', 'scale-100');
modalContent.classList.add('opacity-0', 'scale-95');
setTimeout(() => modal.classList.add('hidden'), 200);
});
// Copy URLs and open cache clearing page
document.getElementById("copy-to-clear-cache").addEventListener("click", () => {
navigator.clipboard.writeText(document.getElementById("urls-list").innerText);
window.open("https://cache.gh-proxy.com/", "_blank");
document.getElementById("urls-close").click();
});
// Changelog modal functionality
const changelogModal = document.getElementById("changelog-modal");
@@ -766,8 +709,8 @@
// Generate version selection buttons
versionBtnsContainer.innerHTML = `
<button data-version="${routeros7_longterm}" class="px-3 py-1.5 text-sm font-medium rounded-md hover:bg-blue-200 dark:hover:bg-gray-600 transition-all">v7 Long-Term</button>
<button data-version="${routeros7_stable}" class="px-3 py-1.5 text-sm font-medium rounded-md hover:bg-blue-200 dark:hover:bg-gray-600 transition-all">v7 Stable</button>
<button data-version="${routeros7_testing}" class="px-3 py-1.5 text-sm font-medium rounded-md hover:bg-blue-200 dark:hover:bg-gray-600 transition-all">v7 Testing</button>
<button data-version="${routeros6_longterm}" class="px-3 py-1.5 text-sm font-medium rounded-md hover:bg-blue-200 dark:hover:bg-gray-600 transition-all">v6 Long-Term</button>
<button data-version="${routeros6_stable}" class="px-3 py-1.5 text-sm font-medium rounded-md hover:bg-blue-200 dark:hover:bg-gray-600 transition-all">v6 Stable</button>
`;

Binary file not shown.

Binary file not shown.

View File

@@ -340,6 +340,7 @@ def patch_squashfs(path,key_dict):
os.environ.get('MIKRO_LICENCE_URL', '').encode(): os.environ.get('CUSTOM_LICENCE_URL', '').encode(),
os.environ.get('MIKRO_UPGRADE_URL', '').encode(): os.environ.get('CUSTOM_UPGRADE_URL', '').encode(),
os.environ.get('MIKRO_CLOUD_URL', '').encode(): os.environ.get('CUSTOM_CLOUD_URL', '').encode(),
os.environ.get('MIKRO_CLOUD2_URL', '').encode(): os.environ.get('CUSTOM_CLOUD2_URL', '').encode(),
os.environ.get('MIKRO_CLOUD_PUBLIC_KEY', '').encode(): os.environ.get('CUSTOM_CLOUD_PUBLIC_KEY', '').encode(),
}
url_replacements = {k: v for k, v in url_replacements.items() if k and v}