mirror of
https://github.com/YuCat-OVO/BaiduNetdisk-Docker
synced 2025-05-10 20:10:04 +08:00
commit
ade68d4a2d
89
.github/codeql.yml
vendored
89
.github/codeql.yml
vendored
@ -1,89 +0,0 @@
|
|||||||
# For most projects, this workflow file will not need changing; you simply need
|
|
||||||
# to commit it to your repository.
|
|
||||||
#
|
|
||||||
# You may wish to alter this file to override the set of languages analyzed,
|
|
||||||
# or to provide custom queries or build logic.
|
|
||||||
#
|
|
||||||
# ******** NOTE ********
|
|
||||||
# We have attempted to detect the languages in your repository. Please check
|
|
||||||
# the `language` matrix defined below to confirm you have the correct set of
|
|
||||||
# supported CodeQL languages.
|
|
||||||
#
|
|
||||||
name: "CodeQL"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "main" ]
|
|
||||||
paths:
|
|
||||||
- "get-version.py"
|
|
||||||
pull_request:
|
|
||||||
branches: [ "main" ]
|
|
||||||
paths:
|
|
||||||
- "get-version.py"
|
|
||||||
schedule:
|
|
||||||
- cron: '24 3 * * 2'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
analyze:
|
|
||||||
name: Analyze
|
|
||||||
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
|
||||||
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
|
||||||
# - https://gh.io/supported-runners-and-hardware-resources
|
|
||||||
# - https://gh.io/using-larger-runners
|
|
||||||
# Consider using larger runners for possible analysis time improvements.
|
|
||||||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
|
||||||
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
|
|
||||||
permissions:
|
|
||||||
# required for all workflows
|
|
||||||
security-events: write
|
|
||||||
|
|
||||||
# only required for workflows in private repositories
|
|
||||||
actions: read
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
language: [ 'python' ]
|
|
||||||
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
|
|
||||||
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
|
|
||||||
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
|
|
||||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v3
|
|
||||||
with:
|
|
||||||
languages: ${{ matrix.language }}
|
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
||||||
# By default, queries listed here will override any specified in a config file.
|
|
||||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
||||||
|
|
||||||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
||||||
# queries: security-extended,security-and-quality
|
|
||||||
|
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
|
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v3
|
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
|
||||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
||||||
|
|
||||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
|
||||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
|
||||||
|
|
||||||
# - run: |
|
|
||||||
# echo "Run, Build Application using script"
|
|
||||||
# ./location_of_script_within_repo/buildscript.sh
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v3
|
|
||||||
with:
|
|
||||||
category: "/language:${{matrix.language}}"
|
|
||||||
|
|
||||||
5
.github/dependabot.yml
vendored
5
.github/dependabot.yml
vendored
@ -12,8 +12,3 @@ updates:
|
|||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
|
|
||||||
- package-ecosystem: "pip"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
|
|||||||
199
.github/workflows/build.yml
vendored
199
.github/workflows/build.yml
vendored
@ -1,59 +1,56 @@
|
|||||||
name: Build & Release
|
name: Build & Release
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: "Version"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "main"
|
- "main"
|
||||||
|
- "develop"
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- ".github/**"
|
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
- "README.md"
|
- "**.md"
|
||||||
- "get_version.py"
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: baidunetdisk-docker
|
DOCKERHUB_SLUG: docker.io/yucatovo/baidunetdisk-docker
|
||||||
|
GHCR_SLUG: ghcr.io/yucat-ovo/baidunetdisk-docker
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build:
|
prepare:
|
||||||
name: Build
|
name: prepare
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
arch: [linux/amd64, linux/arm64]
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@master
|
||||||
- name: Set variables
|
|
||||||
id: set-vars
|
|
||||||
run: |
|
|
||||||
VERSION="1.0.4"
|
|
||||||
GITHUB_REF=${{ github.ref }}
|
|
||||||
BRACH=${GITHUB_REF#refs/heads/}
|
|
||||||
DATE=$(date '+%Y-%m-%dT%H:%M:%S%Z')
|
|
||||||
ARCH=${{ matrix.arch }}
|
|
||||||
PLATFORM_PAIR=${ARCH//\//-}
|
|
||||||
PLATFORM=${ARCH//linux\//}
|
|
||||||
|
|
||||||
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
|
|
||||||
echo "GITHUB_REF=${GITHUB_REF}" >> $GITHUB_OUTPUT
|
|
||||||
echo "BRACH=${BRACH}" >> $GITHUB_OUTPUT
|
|
||||||
echo "DATE=${DATE}" >> $GITHUB_OUTPUT
|
|
||||||
echo "PLATFORM_PAIR=${PLATFORM_PAIR}" >> $GITHUB_OUTPUT
|
|
||||||
echo "PLATFORM=${PLATFORM}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Docker Meta
|
- name: Docker Meta
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
|
id: meta
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}
|
${{ env.DOCKERHUB_SLUG }}
|
||||||
ghcr.io/${{ github.repository }}
|
${{ env.GHCR_SLUG }}
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=${{ steps.set-vars.outputs.VERSION }}
|
type=ref,event=branch,enable=${{ github.ref_name != github.event.repository.default_branch }}
|
||||||
type=raw,value=${{ steps.set-vars.outputs.BRACH }}
|
type=edge,branch=develop
|
||||||
type=raw,value=${{ steps.set-vars.outputs.PLATFORM }}
|
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
||||||
type=raw,value=latest
|
type=sha
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=BaiduNetdisk-Docker
|
||||||
|
org.opencontainers.image.description=A BaiduNetdisk image base on Linuxserver.io's KasmVNC image.
|
||||||
|
org.opencontainers.image.vendor=YuCat-OVO
|
||||||
|
|
||||||
|
- name: Rename meta bake definition file
|
||||||
|
run: |
|
||||||
|
mv "${{ steps.meta.outputs.bake-file }}" "/tmp/bake-meta.json"
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
@ -61,66 +58,106 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Upload meta bake definition
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: bake-meta
|
||||||
|
path: /tmp/bake-meta.json
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- prepare
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform: ["linux/amd64", "linux/arm64"]
|
||||||
|
steps:
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
platform=${{ matrix.platform }}
|
||||||
|
echo "PLATFORM_PAIR=${platform//\//-}" >> "$GITHUB_ENV"
|
||||||
|
echo "ARCH=${platform//linux\//}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Download meta bake definition
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: bake-meta
|
||||||
|
path: /tmp
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
buildkitd-flags: "--debug"
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_TOKEN }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Login to GHCR
|
- name: Login to GHCR
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push by digest
|
- name: Build
|
||||||
id: build
|
id: bake
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/bake-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
files: |
|
||||||
platforms: ${{ matrix.arch }}
|
./docker-bake.hcl
|
||||||
build-args: |
|
/tmp/bake-meta.json
|
||||||
BUILD_DATE=${{ steps.set-vars.outputs.DATE }}
|
targets: ${{ env.PLATFORM_PAIR }}
|
||||||
VERSION=${{ steps.set-vars.outputs.VERSION }}
|
set: |
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
*.tags=
|
||||||
outputs: type=image,name=${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
|
*.platform=${{ matrix.platform }}
|
||||||
|
*.cache-from=type=gha,scope=build-${{ env.PLATFORM_PAIR }}
|
||||||
|
*.cache-to=type=gha,scope=build-${{ env.PLATFORM_PAIR }}
|
||||||
|
*.output=type=image,"name=${{ env.DOCKERHUB_SLUG }},${{ env.GHCR_SLUG }}",push-by-digest=true,name-canonical=true,push=true
|
||||||
|
|
||||||
- name: Export digest
|
- name: Export digest (amd64)
|
||||||
|
if: ${{ matrix.platform }} == "linux/amd64"
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/digests
|
mkdir -p /tmp/digests
|
||||||
digest="${{ steps.build.outputs.digest }}"
|
digest="${{ fromJSON(steps.bake.outputs.metadata).image-amd64['containerimage.digest'] }}"
|
||||||
|
touch "/tmp/digests/${digest#sha256:}"
|
||||||
|
|
||||||
|
- name: Export digest (arm64)
|
||||||
|
if: ${{ matrix.platform }} == "linux/arm64"
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/digests
|
||||||
|
digest="${{ fromJSON(steps.bake.outputs.metadata).image-arm64['containerimage.digest'] }}"
|
||||||
touch "/tmp/digests/${digest#sha256:}"
|
touch "/tmp/digests/${digest#sha256:}"
|
||||||
|
|
||||||
- name: Upload digest
|
- name: Upload digest
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: digests-${{ steps.set-vars.outputs.PLATFORM_PAIR }}
|
name: digests-${{ env.PLATFORM_PAIR }}
|
||||||
path: /tmp/digests/*
|
path: /tmp/digests/*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
Merge:
|
merge:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- Build
|
- build
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Download meta bake definition
|
||||||
uses: actions/checkout@master
|
uses: actions/download-artifact@v4
|
||||||
- name: Set variables
|
with:
|
||||||
id: set-vars
|
name: bake-meta
|
||||||
run: |
|
path: /tmp
|
||||||
VERSION="1.0.3"
|
|
||||||
GITHUB_REF=${{ github.ref }}
|
|
||||||
BRACH=${GITHUB_REF#refs/heads/}
|
|
||||||
DATE=$(date '+%Y-%m-%dT%H:%M:%S%Z')
|
|
||||||
ACTOR=${{ github.actor }}
|
|
||||||
|
|
||||||
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
|
|
||||||
echo "GITHUB_REF=${GITHUB_REF}" >> $GITHUB_OUTPUT
|
|
||||||
echo "BRACH=${BRACH}" >> $GITHUB_OUTPUT
|
|
||||||
echo "DATE=${DATE}" >> $GITHUB_OUTPUT
|
|
||||||
echo "ACTOR=${ACTOR,,}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Download digests
|
- name: Download digests
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@ -132,39 +169,29 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Docker Meta
|
- name: Login to DockerHub
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}
|
|
||||||
ghcr.io/${{ github.repository }}
|
|
||||||
tags: |
|
|
||||||
type=raw,value=${{ steps.set-vars.outputs.VERSION }}
|
|
||||||
type=raw,value=${{ steps.set-vars.outputs.BRACH }}
|
|
||||||
type=raw,value=latest
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_TOKEN }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Login to GHCR
|
- name: Login to GHCR
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Create manifest list and push
|
- name: Create manifest list and push
|
||||||
working-directory: /tmp/digests
|
working-directory: /tmp/digests
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
docker buildx imagetools create $(jq -cr '.target."docker-metadata-action".tags | map(select(startswith("${{ env.DOCKERHUB_SLUG }}")) | "-t " + .) | join(" ")' /tmp/bake-meta.json) \
|
||||||
$(printf '${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
|
$(printf '${{ env.DOCKERHUB_SLUG }}@sha256:%s ' *)
|
||||||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
docker buildx imagetools create $(jq -cr '.target."docker-metadata-action".tags | map(select(startswith("${{ env.GHCR_SLUG }}")) | "-t " + .) | join(" ")' /tmp/bake-meta.json) \
|
||||||
$(printf 'ghcr.io/${{ steps.set-vars.outputs.ACTOR }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
|
$(printf '${{ env.GHCR_SLUG }}@sha256:%s ' *)
|
||||||
|
|
||||||
- name: Inspect image
|
- name: Inspect image
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools inspect ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
|
tag=$(jq -r '.target."docker-metadata-action".args.DOCKER_META_VERSION' /tmp/bake-meta.json)
|
||||||
|
docker buildx imagetools inspect ${{ env.DOCKERHUB_SLUG }}:${tag}
|
||||||
|
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:${tag}
|
||||||
|
|||||||
59
.github/workflows/test.yml
vendored
Normal file
59
.github/workflows/test.yml
vendored
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
name: test
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
# push:
|
||||||
|
# branches:
|
||||||
|
# - "main"
|
||||||
|
# - "develop"
|
||||||
|
# paths-ignore:
|
||||||
|
# - "docs/**"
|
||||||
|
# - "**.md"
|
||||||
|
|
||||||
|
env:
|
||||||
|
BUILD_TAG: localhost:5000/yucatovo/baidunetdisk-docker:test
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform: ["linux/amd64", "linux/arm64"]
|
||||||
|
services:
|
||||||
|
registry:
|
||||||
|
image: registry:3.0.0-alpha.1
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set the value
|
||||||
|
id: set-vars
|
||||||
|
run: |
|
||||||
|
platform=${{ matrix.platform }}
|
||||||
|
echo "PLATFORM_PAIR=${platform//\//-}" >> "$GITHUB_ENV"
|
||||||
|
echo "ARCH=${platform//linux\//}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
driver-opts: network=host
|
||||||
|
platforms: ${{ matrix.platform }}
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
uses: docker/bake-action@v4
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
targets: ${{ env.TARGET }}
|
||||||
|
env:
|
||||||
|
DEFAULT_TAG: ${{ env.BUILD_TAG }}-${{ env.PLATFORM_PAIR }}
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: |
|
||||||
|
uname -m
|
||||||
|
docker run --rm --platform "${{ matrix.platform }}" alpine:edge echo hello
|
||||||
44
.github/workflows/version.yml
vendored
44
.github/workflows/version.yml
vendored
@ -1,44 +0,0 @@
|
|||||||
name: Get BaiduNetdisk Version
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
schedule:
|
|
||||||
- cron: "0 3 * * 0"
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- "main"
|
|
||||||
paths:
|
|
||||||
- "get_version.py"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
get-version:
|
|
||||||
name: Get BaiduNetdisk Version
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set variables
|
|
||||||
id: set-vars
|
|
||||||
run: |
|
|
||||||
RELEASE_NAME="Released on $(date +%Y%m%d%H%M)"
|
|
||||||
|
|
||||||
echo "RELEASE_NAME=${RELEASE_NAME}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "3.11.7"
|
|
||||||
|
|
||||||
- name: Run Script
|
|
||||||
run: |
|
|
||||||
pip install -r requirements.txt
|
|
||||||
python get_version.py
|
|
||||||
|
|
||||||
- name: Git push assets to branch
|
|
||||||
run: |
|
|
||||||
git config --local user.name "github-actions[bot]"
|
|
||||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
||||||
git add *.json
|
|
||||||
git commit -m "${{ steps.set-vars.outputs.RELEASE_NAME }}" || true
|
|
||||||
git push
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
|
.vscode/
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|||||||
74
Dockerfile
74
Dockerfile
@ -1,14 +1,15 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM docker.io/library/alpine:edge as download
|
||||||
|
|
||||||
FROM ghcr.io/linuxserver/baseimage-kasmvnc:debianbookworm
|
RUN \
|
||||||
|
sed -i 's/dl-cdn.alpinelinux.org/mirrors.lzu.edu.cn/g' /etc/apk/repositories && \
|
||||||
|
apk update && \
|
||||||
|
apk add wget curl jq &&\
|
||||||
|
wget -nv $(curl 'https://yun.baidu.com/disk/cmsdata?platform=linux&page=1&num=1' | jq -r '.["list"][0]["url_1"]') -O /tmp/baidunetdisk.deb
|
||||||
|
|
||||||
# set version label
|
FROM ghcr.io/linuxserver/baseimage-kasmvnc:debianbookworm-062d5346-ls56
|
||||||
ARG BUILD_DATE
|
|
||||||
ARG VERSION
|
LABEL org.opencontainers.image.source="https://github.com/YuCat-OVO/BaiduNetdisk-Docker"
|
||||||
ARG TARGETPLATFORM
|
|
||||||
LABEL build_version="version:- ${VERSION} Build-date:- ${BUILD_DATE}"
|
|
||||||
LABEL maintainer="YuCat-OVO"
|
|
||||||
LABEL org.opencontainers.image.source="https://github.com/linuxserver/docker-baseimage-kasmvnc"
|
|
||||||
|
|
||||||
ENV \
|
ENV \
|
||||||
CUSTOM_PORT="8080" \
|
CUSTOM_PORT="8080" \
|
||||||
@ -16,67 +17,22 @@ ENV \
|
|||||||
HOME="/config" \
|
HOME="/config" \
|
||||||
TITLE="Baidunetdisk"
|
TITLE="Baidunetdisk"
|
||||||
|
|
||||||
COPY url.json /tmp/
|
COPY --from=download /tmp/baidunetdisk.deb /tmp/baidunetdisk.deb
|
||||||
|
|
||||||
# add local files
|
# add local files
|
||||||
COPY root/ /
|
COPY root/ /
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64} && \
|
sed -i "s/deb.debian.org/mirror.bfsu.edu.cn/g" /etc/apt/sources.list &&\
|
||||||
echo "**** arch: ${TARGETPLATFORM} ****" && \
|
sed -i "s/security.debian.org/mirror.bfsu.edu.cn/g" /etc/apt/sources.list &&\
|
||||||
echo "**** add icon ****" && \
|
|
||||||
curl -o \
|
|
||||||
/kclient/public/icon.png \
|
|
||||||
https://raw.githubusercontent.com/YuCat-OVO/BaiduNetdisk-Docker/master/docs/baidunetdisk.png && \
|
|
||||||
echo "**** fix trusted.gpg ****" && \
|
echo "**** fix trusted.gpg ****" && \
|
||||||
mv /etc/apt/trusted.gpg /etc/apt/trusted.gpg.d/docker.gpg && \
|
mv /etc/apt/trusted.gpg /etc/apt/trusted.gpg.d/docker.gpg && \
|
||||||
echo "**** install runtime packages ****" && \
|
apt-get update -y && \
|
||||||
if [ -n ${TZ} ]; then \
|
|
||||||
echo "**** TZ not found, setting up ****" && \
|
|
||||||
export TZ=Asia/Shanghai; \
|
|
||||||
fi && \
|
|
||||||
export DEBIAN_FRONTEND=noninteractive && \
|
|
||||||
apt-get update && \
|
|
||||||
apt-get -yy -qq install --no-install-recommends --no-install-suggests --fix-missing \
|
apt-get -yy -qq install --no-install-recommends --no-install-suggests --fix-missing \
|
||||||
wget \
|
|
||||||
fonts-wqy-microhei \
|
fonts-wqy-microhei \
|
||||||
fonts-wqy-zenhei \
|
fonts-wqy-zenhei \
|
||||||
dbus \
|
|
||||||
fcitx-rime \
|
|
||||||
libnss3 \
|
|
||||||
libopengl0 \
|
|
||||||
libxkbcommon-x11-0 \
|
|
||||||
libxcb-cursor0 \
|
|
||||||
libxcb-icccm4 \
|
|
||||||
libxcb-image0 \
|
|
||||||
libxcb-keysyms1 \
|
|
||||||
libxcb-randr0 \
|
|
||||||
libxcb-render-util0 \
|
|
||||||
libxcb-xinerama0 \
|
|
||||||
libxdamage1 \
|
|
||||||
poppler-utils \
|
|
||||||
python3 \
|
|
||||||
python3-xdg \
|
|
||||||
desktop-file-utils && \
|
desktop-file-utils && \
|
||||||
|
\
|
||||||
echo "**** install BaiduNetdisk ****" && \
|
echo "**** install BaiduNetdisk ****" && \
|
||||||
if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
|
|
||||||
echo "**** ${TARGETPLATFORM}, reading from url.json ****"; \
|
|
||||||
BAIDUNETDISK_VERSION=$(jq -r ".[-2]" /tmp/url.json); \
|
|
||||||
BAIDUNETDISK_URL=$(jq -r ".[-2]" /tmp/url.json); \
|
|
||||||
elif [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
|
|
||||||
echo "**** ${TARGETPLATFORM}, reading from url.json ****"; \
|
|
||||||
BAIDUNETDISK_VERSION=$(jq -r ".[-1]" /tmp/url.json); \
|
|
||||||
BAIDUNETDISK_URL=$(jq -r ".[-1]" /tmp/url.json); \
|
|
||||||
echo "**** ${TARGETPLATFORM}, add args ****" && \
|
|
||||||
sed -i "s/baidunetdisk --no-sandbox/baidunetdisk --no-sandbox --disable-gpu-sandbox/g" /defaults/*; \
|
|
||||||
else \
|
|
||||||
echo "**** err, use default url ****" && \
|
|
||||||
BAIDUNETDISK_URL="https://issuepcdn.baidupcs.com/issue/netdisk/LinuxGuanjia/4.17.7/baidunetdisk_4.17.7_amd64.deb"; \
|
|
||||||
fi && \
|
|
||||||
echo "***** Getting ${BAIDUNETDISK_URL} ****" && \
|
|
||||||
curl -o \
|
|
||||||
/tmp/baidunetdisk.deb -L \
|
|
||||||
"$BAIDUNETDISK_URL" && \
|
|
||||||
for i in \
|
for i in \
|
||||||
$(dpkg -I /tmp/baidunetdisk.deb | grep "Depends" | cut -c11- | awk -F ', ' '{ for(i=1; i<=NF; i++) print $i }'); \
|
$(dpkg -I /tmp/baidunetdisk.deb | grep "Depends" | cut -c11- | awk -F ', ' '{ for(i=1; i<=NF; i++) print $i }'); \
|
||||||
do \
|
do \
|
||||||
@ -88,6 +44,8 @@ RUN \
|
|||||||
fi \
|
fi \
|
||||||
done && \
|
done && \
|
||||||
dpkg -i /tmp/baidunetdisk.deb && \
|
dpkg -i /tmp/baidunetdisk.deb && \
|
||||||
|
echo "**** add test ****" && \
|
||||||
|
chmod +x /usr/bin/mytest && \
|
||||||
echo "**** cleanup ****" && \
|
echo "**** cleanup ****" && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf \
|
rm -rf \
|
||||||
|
|||||||
56
Dockerfile.arm64
Normal file
56
Dockerfile.arm64
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM docker.io/library/alpine:edge as download
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
sed -i 's/dl-cdn.alpinelinux.org/mirrors.lzu.edu.cn/g' /etc/apk/repositories && \
|
||||||
|
apk update && \
|
||||||
|
apk add wget curl jq &&\
|
||||||
|
wget -nv $(curl 'https://yun.baidu.com/disk/cmsdata?platform=linux&page=1&num=1' | jq -r '.["list"][0]["url_1"]' | sed "s/amd64/arm64/g") -O /tmp/baidunetdisk.deb
|
||||||
|
|
||||||
|
FROM ghcr.io/linuxserver/baseimage-kasmvnc:debianbookworm-062d5346-ls56
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/YuCat-OVO/BaiduNetdisk-Docker"
|
||||||
|
|
||||||
|
ENV \
|
||||||
|
CUSTOM_PORT="8080" \
|
||||||
|
CUSTOM_HTTPS_PORT="8181" \
|
||||||
|
HOME="/config" \
|
||||||
|
TITLE="Baidunetdisk"
|
||||||
|
|
||||||
|
COPY --from=download /tmp/baidunetdisk.deb /tmp/baidunetdisk.deb
|
||||||
|
# add local files
|
||||||
|
COPY root/ /
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
sed -i "s/deb.debian.org/mirror.bfsu.edu.cn/g" /etc/apt/sources.list &&\
|
||||||
|
sed -i "s/security.debian.org/mirror.bfsu.edu.cn/g" /etc/apt/sources.list &&\
|
||||||
|
echo "**** fix trusted.gpg ****" && \
|
||||||
|
mv /etc/apt/trusted.gpg /etc/apt/trusted.gpg.d/docker.gpg && \
|
||||||
|
apt-get update -y && \
|
||||||
|
apt-get -yy -qq install --no-install-recommends --no-install-suggests --fix-missing \
|
||||||
|
fonts-wqy-microhei \
|
||||||
|
fonts-wqy-zenhei \
|
||||||
|
desktop-file-utils && \
|
||||||
|
\
|
||||||
|
echo "**** install BaiduNetdisk ****" && \
|
||||||
|
sed -i "s/baidunetdisk --no-sandbox/baidunetdisk --no-sandbox --disable-gpu-sandbox/g" /defaults/*; \
|
||||||
|
for i in \
|
||||||
|
$(dpkg -I /tmp/baidunetdisk.deb | grep "Depends" | cut -c11- | awk -F ', ' '{ for(i=1; i<=NF; i++) print $i }'); \
|
||||||
|
do \
|
||||||
|
if [ -n "$(dpkg -l | grep ^ii | grep $i)" ]; \
|
||||||
|
then \
|
||||||
|
echo "${i} installed,skip"; \
|
||||||
|
else \
|
||||||
|
apt-get -yy -qq install --no-install-recommends --no-install-suggests --fix-missing ${i}; \
|
||||||
|
fi \
|
||||||
|
done && \
|
||||||
|
dpkg -i /tmp/baidunetdisk.deb && \
|
||||||
|
echo "**** add test ****" && \
|
||||||
|
chmod +x /usr/bin/mytest && \
|
||||||
|
sed -i "s/baidunetdisk --no-sandbox/baidunetdisk --no-sandbox --disable-gpu-sandbox/g" root/usr/bin/mytest; \
|
||||||
|
echo "**** cleanup ****" && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf \
|
||||||
|
/tmp/* \
|
||||||
|
/var/lib/apt/lists/* \
|
||||||
|
/var/tmp/*
|
||||||
25
docker-bake.hcl
Normal file
25
docker-bake.hcl
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
variable "DEFAULT_TAG" {
|
||||||
|
default = "baidunetdisk-docker:latest"
|
||||||
|
}
|
||||||
|
|
||||||
|
group "linux-amd64" {
|
||||||
|
targets = ["image-amd64"]
|
||||||
|
}
|
||||||
|
group "linux-arm64" {
|
||||||
|
targets = ["image-arm64"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "docker-metadata-action" {
|
||||||
|
tags = ["${DEFAULT_TAG}"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "image-amd64" {
|
||||||
|
platforms = ["linux/amd64"]
|
||||||
|
inherits = ["docker-metadata-action"]
|
||||||
|
dockerfile = "Dockerfile"
|
||||||
|
}
|
||||||
|
target "image-arm64" {
|
||||||
|
platforms = ["linux/arm64"]
|
||||||
|
inherits = ["docker-metadata-action"]
|
||||||
|
dockerfile = "Dockerfile.arm64"
|
||||||
|
}
|
||||||
244
get_version.py
244
get_version.py
@ -1,244 +0,0 @@
|
|||||||
import json
|
|
||||||
import re
|
|
||||||
import time
|
|
||||||
|
|
||||||
import requests
|
|
||||||
from lxml import etree
|
|
||||||
|
|
||||||
GLOBAL_HEADER = {
|
|
||||||
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
|
|
||||||
}
|
|
||||||
|
|
||||||
# 截至2024-03-01最新的版本
|
|
||||||
GLOBAL_VERSION = [
|
|
||||||
"https://issuepcdn.baidupcs.com/issue/netdisk/LinuxGuanjia/4.11.5/baidunetdisk_4.11.5_amd64.deb",
|
|
||||||
]
|
|
||||||
|
|
||||||
# 定义需要检测的版本号范围
|
|
||||||
max_version = [4, 20, 0]
|
|
||||||
min_version = [4, 17, 0]
|
|
||||||
|
|
||||||
# 定义请求延时时间(秒)
|
|
||||||
GLOBAL_REQUEST_DELAY = 0.5
|
|
||||||
|
|
||||||
|
|
||||||
def get_js_url() -> str:
|
|
||||||
"""请求百度网盘下载页,获取存在下载链接的js文件"""
|
|
||||||
max_attempts = 5
|
|
||||||
attempt = 0
|
|
||||||
|
|
||||||
url = ""
|
|
||||||
while attempt < max_attempts:
|
|
||||||
try:
|
|
||||||
r = requests.get(
|
|
||||||
"https://pan.baidu.com/download",
|
|
||||||
headers=GLOBAL_HEADER,
|
|
||||||
)
|
|
||||||
e = etree.HTML(r.text, parser=None)
|
|
||||||
|
|
||||||
# 获取包含链接的js文件
|
|
||||||
for i in e.xpath("//script/@src"):
|
|
||||||
if re.search("https:\\/\\/.*chunk-common.*\\.js", i):
|
|
||||||
url = i
|
|
||||||
# print(url)
|
|
||||||
return url
|
|
||||||
except Exception as e:
|
|
||||||
print(f"An error occurred: {e}")
|
|
||||||
attempt += 1
|
|
||||||
time.sleep(1) # 等待1秒再重试
|
|
||||||
|
|
||||||
if attempt == max_attempts:
|
|
||||||
print("Failed after several attempts")
|
|
||||||
return url
|
|
||||||
|
|
||||||
|
|
||||||
def append_json(json_file_name: str, add):
|
|
||||||
"""为Json添加元素"""
|
|
||||||
file = None
|
|
||||||
try:
|
|
||||||
with open(json_file_name, "r") as f:
|
|
||||||
file = json.load(f)
|
|
||||||
# print("file=", file)
|
|
||||||
|
|
||||||
except FileNotFoundError:
|
|
||||||
file = json.loads("")
|
|
||||||
|
|
||||||
file.append(add)
|
|
||||||
|
|
||||||
# print("ufile=", u_file)
|
|
||||||
|
|
||||||
with open(json_file_name, "w") as f:
|
|
||||||
f.write(json.dumps(file, sort_keys=True, indent=4))
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
def parse_url_from_json() -> list:
|
|
||||||
l = ""
|
|
||||||
try:
|
|
||||||
with open("url.json", "r") as f:
|
|
||||||
l = json.load(f)
|
|
||||||
except FileNotFoundError:
|
|
||||||
l = []
|
|
||||||
return l
|
|
||||||
|
|
||||||
|
|
||||||
def parse_url_from_js():
|
|
||||||
"""从js文件中提取下载的链接并且去重,写入文件 url.json"""
|
|
||||||
url = get_js_url()
|
|
||||||
u_url = []
|
|
||||||
|
|
||||||
max_attempts = 5
|
|
||||||
attempt = 0
|
|
||||||
|
|
||||||
while attempt < max_attempts:
|
|
||||||
try:
|
|
||||||
|
|
||||||
d_url = ""
|
|
||||||
r = requests.get(
|
|
||||||
url,
|
|
||||||
headers=GLOBAL_HEADER,
|
|
||||||
)
|
|
||||||
# 过滤链接
|
|
||||||
d_url = re.findall(
|
|
||||||
'(?:link|url(?:_[0-9])?):"https://[a-zA-Z/\\.]*?/netdisk/[a-zA-Z10-9/\\._-]*?(?=")',
|
|
||||||
r.text,
|
|
||||||
)
|
|
||||||
|
|
||||||
# 清理
|
|
||||||
for i in range(len(d_url)):
|
|
||||||
d_url[i] = re.sub('(link|url(?:_[0-9])?):"', "", d_url[i])
|
|
||||||
|
|
||||||
# 去重
|
|
||||||
for i in d_url:
|
|
||||||
if i not in u_url:
|
|
||||||
u_url.append(i)
|
|
||||||
|
|
||||||
break
|
|
||||||
except Exception as e:
|
|
||||||
print(f"An error occurred: {e}")
|
|
||||||
attempt += 1
|
|
||||||
time.sleep(1) # 等待1秒再重试
|
|
||||||
|
|
||||||
if attempt == max_attempts:
|
|
||||||
print("Failed after several attempts,set url to default")
|
|
||||||
u_url = GLOBAL_VERSION
|
|
||||||
|
|
||||||
with open("url.json", "w") as f:
|
|
||||||
f.write(json.dumps(u_url, sort_keys=True, indent=4))
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
def make_info_json(urls: list):
|
|
||||||
"""保存为Json文件"""
|
|
||||||
# print("urls:", urls)
|
|
||||||
l_url = urls[-3:]
|
|
||||||
# print(l_url)
|
|
||||||
j = []
|
|
||||||
for i in l_url:
|
|
||||||
j.append(
|
|
||||||
{
|
|
||||||
"version": re.findall("(?<=/)((?:[0-9]{1,2}(?:\\.)?){1,3})(?=/)", i)[0],
|
|
||||||
"arch": re.findall("(amd64|arm64|x86_64)", i)[0],
|
|
||||||
"pak": re.findall("(rpm|deb)", i)[0],
|
|
||||||
"url": i,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
# print(j)
|
|
||||||
with open("info.json", "w") as f:
|
|
||||||
f.write(json.dumps(j, sort_keys=True, indent=4))
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
def make_url_temple(arch: str):
|
|
||||||
"""按照之前所获取的 url.json,创建模板"""
|
|
||||||
l = ""
|
|
||||||
url_temple = ""
|
|
||||||
try:
|
|
||||||
with open("url.json", "r") as f:
|
|
||||||
l = json.load(f)
|
|
||||||
for i in l:
|
|
||||||
if re.search("amd64", i) != None and re.search("deb", i) != None:
|
|
||||||
url_temple = re.sub("amd64", arch, i)
|
|
||||||
url_temple = re.sub(
|
|
||||||
"(?<=[_/])((?:[0-9]{1,2}(?:\\.)?){1,3})(?=[_/])", "{0}", url_temple
|
|
||||||
)
|
|
||||||
break
|
|
||||||
# print(url_temple)
|
|
||||||
except FileNotFoundError:
|
|
||||||
url_temple = "https://issuepcdn.baidupcs.com/issue/netdisk/LinuxGuanjia/{0}/baidunetdisk_{0}_arm64.deb"
|
|
||||||
# print(url_temple)
|
|
||||||
return url_temple
|
|
||||||
|
|
||||||
|
|
||||||
def check_version(version: list, arch: str):
|
|
||||||
"""检测指定版本号是否可用"""
|
|
||||||
url = make_url_temple(arch).format(".".join(str(v) for v in version))
|
|
||||||
# url = "https://httpbin.org/status/200"
|
|
||||||
# print("Getting {0}".format(url))
|
|
||||||
|
|
||||||
max_attempts = 5
|
|
||||||
attempt = 0
|
|
||||||
|
|
||||||
while attempt < max_attempts:
|
|
||||||
try:
|
|
||||||
response = requests.head(
|
|
||||||
url,
|
|
||||||
headers=GLOBAL_HEADER,
|
|
||||||
)
|
|
||||||
if response.status_code == 200:
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
except Exception as e:
|
|
||||||
print(f"An error occurred: {e}")
|
|
||||||
attempt += 1
|
|
||||||
time.sleep(1) # 等待1秒再重试
|
|
||||||
|
|
||||||
if attempt == max_attempts:
|
|
||||||
print("Failed after several attempts")
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
def find_latest_version(min_version, max_version):
|
|
||||||
"""寻找最新版本号"""
|
|
||||||
version_list = [
|
|
||||||
[x, y, z]
|
|
||||||
for x in range(max_version[0], min_version[0] - 1, -1)
|
|
||||||
for y in range(max_version[1], min_version[1] - 1, -1)
|
|
||||||
for z in range(20, -1, -1)
|
|
||||||
if not (x == max_version[0] and y == max_version[1] and z > max_version[2])
|
|
||||||
if not (x == min_version[0] and y == min_version[1] and z < min_version[2])
|
|
||||||
]
|
|
||||||
for arch in ["amd64", "arm64"]:
|
|
||||||
for version in version_list:
|
|
||||||
# 检测指定版本号是否可用
|
|
||||||
if check_version(version, arch):
|
|
||||||
print(
|
|
||||||
"arch {0} version {1} is available".format(
|
|
||||||
arch, ".".join(str(v) for v in version)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
append_json(
|
|
||||||
"url.json",
|
|
||||||
make_url_temple(arch).format(".".join(str(v) for v in version)),
|
|
||||||
)
|
|
||||||
time.sleep(GLOBAL_REQUEST_DELAY)
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
print(
|
|
||||||
"arch {0} version {1} is not available".format(
|
|
||||||
arch, ".".join(str(v) for v in version)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
time.sleep(GLOBAL_REQUEST_DELAY)
|
|
||||||
|
|
||||||
# 找不到可用版本号,返回None
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
parse_url_from_js()
|
|
||||||
find_latest_version(min_version, max_version)
|
|
||||||
urls = parse_url_from_json()
|
|
||||||
make_info_json(urls)
|
|
||||||
20
info.json
20
info.json
@ -1,20 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"arch": "amd64",
|
|
||||||
"pak": "deb",
|
|
||||||
"url": "https://issuepcdn.baidupcs.com/issue/netdisk/LinuxGuanjia/4.11.5/baidunetdisk_4.11.5_amd64.deb",
|
|
||||||
"version": "4.11.5"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"arch": "amd64",
|
|
||||||
"pak": "deb",
|
|
||||||
"url": "https://issuepcdn.baidupcs.com/issue/netdisk/LinuxGuanjia/4.17.7/baidunetdisk_4.17.7_amd64.deb",
|
|
||||||
"version": "4.17.7"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"arch": "arm64",
|
|
||||||
"pak": "deb",
|
|
||||||
"url": "https://issuepcdn.baidupcs.com/issue/netdisk/LinuxGuanjia/4.17.7/baidunetdisk_4.17.7_arm64.deb",
|
|
||||||
"version": "4.17.7"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
lxml==5.2.1
|
|
||||||
requests==2.31.0
|
|
||||||
9
root/usr/bin/mytest
Normal file
9
root/usr/bin/mytest
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
sudo -u root -s /bin/bash -c "/opt/baidunetdisk/baidunetdisk --no-sandbox" > /tmp/baidunetdisk_output.txt 2>&1 &
|
||||||
|
sleep 15
|
||||||
|
|
||||||
|
echo -e '\033[0;31m'
|
||||||
|
cat /tmp/baidunetdisk_output.txt
|
||||||
|
echo -e '\033[0m'
|
||||||
10
url.json
10
url.json
@ -1,10 +0,0 @@
|
|||||||
[
|
|
||||||
"https://issuepcdn.baidupcs.com/issue/netdisk/yunguanjia/BaiduNetdisk_7.19.0.18.exe",
|
|
||||||
"https://issuepcdn.baidupcs.com/issue/netdisk/yunguanjia/BaiduNetdisk_6.9.10.1.exe",
|
|
||||||
"https://issuepcdn.baidupcs.com/issue/netdisk/MACguanjia/BaiduNetdisk_mac_4.11.0.dmg",
|
|
||||||
"https://issuepcdn.baidupcs.com/issue/netdisk/MACguanjia/BaiduNetdisk_mac_4.11.0_arm64.dmg",
|
|
||||||
"https://issuepcdn.baidupcs.com/issue/netdisk/LinuxGuanjia/4.11.5/baidunetdisk-4.11.5.x86_64.rpm",
|
|
||||||
"https://issuepcdn.baidupcs.com/issue/netdisk/LinuxGuanjia/4.11.5/baidunetdisk_4.11.5_amd64.deb",
|
|
||||||
"https://issuepcdn.baidupcs.com/issue/netdisk/LinuxGuanjia/4.17.7/baidunetdisk_4.17.7_amd64.deb",
|
|
||||||
"https://issuepcdn.baidupcs.com/issue/netdisk/LinuxGuanjia/4.17.7/baidunetdisk_4.17.7_arm64.deb"
|
|
||||||
]
|
|
||||||
Loading…
Reference in New Issue
Block a user