mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-11 10:54:08 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11015c7be1 | ||
|
|
57befd2c03 | ||
|
|
35156ed968 | ||
|
|
ee6c36174f | ||
|
|
fdfd95555d | ||
|
|
7ec824edda | ||
|
|
1f8b1be669 | ||
|
|
b0bcfeae34 | ||
|
|
10b346a326 | ||
|
|
a85af39b35 | ||
|
|
576f0d2e24 | ||
|
|
95eb3a427c | ||
|
|
e9442edd94 | ||
|
|
77e59f7376 | ||
|
|
135fba1b54 | ||
|
|
ff813e3bc9 | ||
|
|
babfe79023 | ||
|
|
89ac52bebd | ||
|
|
15e1c2f2d5 | ||
|
|
203f0ccc82 | ||
|
|
2422bd2c66 | ||
|
|
0306a1ed6b | ||
|
|
8a94650370 | ||
|
|
837a193e96 | ||
|
|
fcf0746f9a | ||
|
|
9eb466ccd3 | ||
|
|
c54f22613e |
No files matched your search
@@ -0,0 +1,8 @@
|
|||||||
|
<!--
|
||||||
|
请根据以下模版提issue
|
||||||
|
-->
|
||||||
|
### 问题描述(必要)
|
||||||
|
### 版本号(必要)
|
||||||
|
### 操作系统(必要)
|
||||||
|
### 相关截图
|
||||||
|
### 相关日志
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
name-template: 'v1.0.0 🌈'
|
name-template: 'v$NEXT_PATCH_VERSION 🌈'
|
||||||
tag-template: 'v1.0.0'
|
tag-template: 'v$NEXT_PATCH_VERSION'
|
||||||
categories:
|
categories:
|
||||||
- title: '🆕 Features'
|
- title: '🆕 Features'
|
||||||
labels:
|
labels:
|
||||||
|
|||||||
@@ -0,0 +1,336 @@
|
|||||||
|
name: build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
jobs:
|
||||||
|
get-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
tag_name: ${{ steps.get-release.outputs.tag_name }}
|
||||||
|
upload_url: ${{ steps.get-release.outputs.upload_url }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: thebritican/[email protected]
|
||||||
|
id: get-release
|
||||||
|
build-windows:
|
||||||
|
runs-on: windows-latest
|
||||||
|
needs: [get-release]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: "^1.19"
|
||||||
|
cache: true
|
||||||
|
- uses: subosito/flutter-action@v2
|
||||||
|
- name: Build
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.get-release.outputs.tag_name }}
|
||||||
|
run: |
|
||||||
|
go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/windows/libgopeed.dll github.com/monkeyWie/gopeed/bind/desktop
|
||||||
|
cd ui/flutter
|
||||||
|
flutter build windows
|
||||||
|
$mingw = "C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin"
|
||||||
|
$system = "C:\Windows\System32"
|
||||||
|
$release = "build\windows\runner\Release\"
|
||||||
|
cp $mingw\libstdc++-6.dll $release
|
||||||
|
cp $mingw\libgcc_s_seh-1.dll $release
|
||||||
|
cp $mingw\libwinpthread-1.dll $release
|
||||||
|
cp $system\msvcp140.dll $release
|
||||||
|
cp $system\vcruntime140.dll $release
|
||||||
|
cp $system\vcruntime140_1.dll $release
|
||||||
|
|
||||||
|
New-Item -Path build\windows\Output -ItemType Directory
|
||||||
|
Compress-Archive -Path "$release*" -DestinationPath build\windows\Output\Gopeed-$env:VERSION-windows-amd64.zip
|
||||||
|
|
||||||
|
cd build/windows
|
||||||
|
echo @"
|
||||||
|
; Script generated by the Inno Setup Script Wizard.
|
||||||
|
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||||
|
|
||||||
|
#define MyAppName "Gopeed"
|
||||||
|
#define MyAppVersion "$($env:VERSION.substring(1))"
|
||||||
|
#define MyAppPublisher "monkeyWie"
|
||||||
|
#define MyAppURL "https://gopeed.com"
|
||||||
|
#define MyAppExeName "gopeed.exe"
|
||||||
|
|
||||||
|
[Setup]
|
||||||
|
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
|
||||||
|
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||||
|
AppId={{5960F34D-1E42-402C-8C85-DE2FF24CBAE4}
|
||||||
|
AppName={#MyAppName}
|
||||||
|
AppVersion={#MyAppVersion}
|
||||||
|
;AppVerName={#MyAppName} {#MyAppVersion}
|
||||||
|
AppPublisher={#MyAppPublisher}
|
||||||
|
AppPublisherURL={#MyAppURL}
|
||||||
|
AppSupportURL={#MyAppURL}
|
||||||
|
AppUpdatesURL={#MyAppURL}
|
||||||
|
DefaultDirName={autopf}\gopeed
|
||||||
|
DisableProgramGroupPage=yes
|
||||||
|
LicenseFile=..\..\..\..\LICENSE
|
||||||
|
; Remove the following line to run in administrative install mode (install for all users.)
|
||||||
|
PrivilegesRequired=lowest
|
||||||
|
OutputBaseFilename=gopeed
|
||||||
|
SetupIconFile=..\..\assets\icon\icon.ico
|
||||||
|
Compression=lzma
|
||||||
|
SolidCompression=yes
|
||||||
|
WizardStyle=modern
|
||||||
|
|
||||||
|
[Languages]
|
||||||
|
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||||
|
|
||||||
|
[Tasks]
|
||||||
|
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||||
|
|
||||||
|
[Files]
|
||||||
|
Source: ".\runner\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
|
||||||
|
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||||
|
|
||||||
|
[Icons]
|
||||||
|
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
||||||
|
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
|
||||||
|
|
||||||
|
[Run]
|
||||||
|
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||||
|
"@ > setup.iss
|
||||||
|
iscc.exe setup.iss
|
||||||
|
mv "Output\gopeed.exe" "Output\Gopeed-$env:VERSION-windows-amd64-install.exe"
|
||||||
|
- name: Upload
|
||||||
|
uses: shogo82148/actions-upload-release-asset@v1
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.get-release.outputs.upload_url }}
|
||||||
|
asset_path: ui/flutter/build/windows/Output/*
|
||||||
|
overwrite: true
|
||||||
|
build-macos-arm64-lib:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [get-release]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: "^1.19"
|
||||||
|
cache: true
|
||||||
|
- run: mkdir -p ~/image-cache
|
||||||
|
- id: image-cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/image-cache
|
||||||
|
key: image-cache-xgo-v1.19
|
||||||
|
- if: steps.image-cache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
docker pull techknowlogick/xgo:go-1.19.x
|
||||||
|
docker save -o ~/image-cache/xgo.tar techknowlogick/xgo:go-1.19.x
|
||||||
|
- if: steps.image-cache.outputs.cache-hit == 'true'
|
||||||
|
run: docker load -i ~/image-cache/xgo.tar
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
go install src.techknowlogick.com/xgo@latest
|
||||||
|
xgo --targets=darwin/arm64 -tags="nosqlite" -ldflags="-w -s" -buildmode=c-shared -pkg=bind/desktop -out=libgopeed .
|
||||||
|
mv libgopeed-*.dylib libgopeed.dylib
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: macos-arm64-lib
|
||||||
|
path: libgopeed.dylib
|
||||||
|
build-macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
needs: [get-release, build-macos-arm64-lib]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: "^1.19"
|
||||||
|
cache: true
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
- uses: subosito/flutter-action@v2
|
||||||
|
- name: Install appdmg
|
||||||
|
run: npm install -g appdmg
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: macos-arm64-lib
|
||||||
|
path: ui/flutter/macos/Frameworks
|
||||||
|
- name: Build
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.get-release.outputs.tag_name }}
|
||||||
|
run: |
|
||||||
|
PROJECT_DIR=$(pwd)
|
||||||
|
|
||||||
|
cd ui/flutter
|
||||||
|
flutter build macos
|
||||||
|
cd build/macos/Build/Products/Release
|
||||||
|
cat>appdmg.json<<EOF
|
||||||
|
{
|
||||||
|
"title": "Gopeed",
|
||||||
|
"icon": "Gopeed.app/Contents/Resources/AppIcon.icns",
|
||||||
|
"contents": [
|
||||||
|
{ "x": 448, "y": 344, "type": "link", "path": "/Applications" },
|
||||||
|
{ "x": 192, "y": 344, "type": "file", "path": "Gopeed.app" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
mkdir dist
|
||||||
|
appdmg appdmg.json dist/Gopeed-$VERSION-macos-arm64.dmg
|
||||||
|
|
||||||
|
# amd64
|
||||||
|
cd $PROJECT_DIR
|
||||||
|
go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o bin/libgopeed.dylib github.com/monkeyWie/gopeed/bind/desktop
|
||||||
|
cp bin/libgopeed.dylib ui/flutter/build/macos/Build/Products/Release/Gopeed.app/Contents/Frameworks/
|
||||||
|
cd ui/flutter/build/macos/Build/Products/Release
|
||||||
|
appdmg appdmg.json dist/Gopeed-$VERSION-macos-amd64.dmg
|
||||||
|
- name: Upload
|
||||||
|
uses: shogo82148/actions-upload-release-asset@v1
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.get-release.outputs.upload_url }}
|
||||||
|
asset_path: ui/flutter/build/macos/Build/Products/Release/dist/*
|
||||||
|
overwrite: true
|
||||||
|
build-linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [get-release]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: "^1.19"
|
||||||
|
cache: true
|
||||||
|
- uses: subosito/flutter-action@v2
|
||||||
|
- run: |
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get install -y ninja-build libgtk-3-dev
|
||||||
|
- name: Build
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.get-release.outputs.tag_name }}
|
||||||
|
run: |
|
||||||
|
go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/linux/bundle/lib/libgopeed.so github.com/monkeyWie/gopeed/bind/desktop
|
||||||
|
cd ui/flutter
|
||||||
|
flutter build linux
|
||||||
|
mkdir -p debian/gui
|
||||||
|
cp assets/icon/icon_1024.png debian/gui/gopeed.png
|
||||||
|
cat>debian/debian.yaml<<EOF
|
||||||
|
flutter_app:
|
||||||
|
command: gopeed
|
||||||
|
arch: x64
|
||||||
|
parent: /usr/local/lib
|
||||||
|
control:
|
||||||
|
Package: gopeed
|
||||||
|
Version: ${VERSION:1}
|
||||||
|
Architecture: amd64
|
||||||
|
Essential: no
|
||||||
|
Priority: optional
|
||||||
|
Depends:
|
||||||
|
Maintainer: monkeyWie
|
||||||
|
Description: High speed downloader that supports all platforms.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat>debian/gui/gopeed.desktop<<EOF
|
||||||
|
[Desktop Entry]
|
||||||
|
Version=${VERSION:1}
|
||||||
|
Name=Gopeed
|
||||||
|
GenericName=Gopeed
|
||||||
|
Comment=High speed downloader that supports all platforms.
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
||||||
|
Categories=Utility
|
||||||
|
Keywords=Flutter;Downloader;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
dart pub global activate flutter_to_debian
|
||||||
|
flutter_to_debian
|
||||||
|
mv debian/packages/gopeed*.deb debian/packages/Gopeed-$VERSION-linux-amd64.deb
|
||||||
|
- name: Upload
|
||||||
|
uses: shogo82148/actions-upload-release-asset@v1
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.get-release.outputs.upload_url }}
|
||||||
|
asset_path: ui/flutter/debian/packages/*
|
||||||
|
overwrite: true
|
||||||
|
build-android:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [get-release]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: "^1.19"
|
||||||
|
cache: true
|
||||||
|
- uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: "zulu"
|
||||||
|
java-version: "11"
|
||||||
|
- uses: subosito/flutter-action@v2
|
||||||
|
- name: Build
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.get-release.outputs.tag_name }}
|
||||||
|
run: |
|
||||||
|
mkdir ui/flutter/android/app/libs
|
||||||
|
go install golang.org/x/mobile/cmd/gomobile@latest
|
||||||
|
gomobile init
|
||||||
|
gomobile bind -tags nosqlite -ldflags="-w -s" -o ui/flutter/android/app/libs/libgopeed.aar -target=android -androidapi 19 -javapkg=com.gopeed github.com/monkeyWie/gopeed/bind/mobile
|
||||||
|
cd ui/flutter
|
||||||
|
flutter build apk
|
||||||
|
mkdir dist
|
||||||
|
cp build/app/outputs/flutter-apk/app-release.apk dist/Gopeed-$VERSION-android.apk
|
||||||
|
- name: Upload
|
||||||
|
uses: shogo82148/actions-upload-release-asset@v1
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.get-release.outputs.upload_url }}
|
||||||
|
asset_path: ui/flutter/dist/*
|
||||||
|
overwrite: true
|
||||||
|
build-web:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [get-release]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: "^1.19"
|
||||||
|
cache: true
|
||||||
|
- uses: subosito/flutter-action@v2
|
||||||
|
- name: Build
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.get-release.outputs.tag_name }}
|
||||||
|
run: |
|
||||||
|
cd ui/flutter
|
||||||
|
flutter build web
|
||||||
|
cd ../../
|
||||||
|
cp -r ui/flutter/build/web cmd/web/dist
|
||||||
|
mkdir -p dist/zip
|
||||||
|
goos_arr=(windows darwin linux)
|
||||||
|
goarch_arr=(386 amd64 arm64)
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
for goos in "${goos_arr[@]}"; do
|
||||||
|
for goarch in "${goarch_arr[@]}"; do
|
||||||
|
name=gopeed-web-$VERSION-$goos-$goarch
|
||||||
|
dir="dist/$name/"
|
||||||
|
(GOOS=$goos GOARCH=$goarch go build -tags nosqlite,web -ldflags="-s -w" -o $dir github.com/monkeyWie/gopeed/cmd/web \
|
||||||
|
&& cd $dir \
|
||||||
|
&& file=$(ls -AU | head -1) \
|
||||||
|
&& mkdir $name \
|
||||||
|
&& mv $file $name/$(echo $file | sed -e "s/web/gopeed/g") \
|
||||||
|
&& zip -r ../zip/$name.zip * \
|
||||||
|
&& cd ../..) \
|
||||||
|
|| true
|
||||||
|
done
|
||||||
|
done
|
||||||
|
- name: Upload
|
||||||
|
uses: shogo82148/actions-upload-release-asset@v1
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.get-release.outputs.upload_url }}
|
||||||
|
asset_path: dist/zip/*
|
||||||
|
overwrite: true
|
||||||
|
build-docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [get-release]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Build
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.get-release.outputs.tag_name }}
|
||||||
|
run: |
|
||||||
|
tag=liwei2633/gopeed:${VERSION:1}
|
||||||
|
docker build -t $tag .
|
||||||
|
docker login -u liwei2633 -p ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
docker push $tag
|
||||||
|
docker tag $tag liwei2633/gopeed:latest
|
||||||
|
docker push liwei2633/gopeed:latest
|
||||||
+10
-306
@@ -4,10 +4,15 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths-ignore:
|
paths:
|
||||||
- '_docs/**'
|
- "bind/**"
|
||||||
- '_examples/**'
|
- "cmd/**"
|
||||||
- 'README*.md'
|
- "internal/**"
|
||||||
|
- "pkg/**"
|
||||||
|
- "ui/**"
|
||||||
|
- ".github/workflows/release.yml"
|
||||||
|
- "go.mod"
|
||||||
|
- "go.sum"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
@@ -20,309 +25,8 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: '^1.19'
|
go-version: "^1.19"
|
||||||
- uses: release-drafter/release-drafter@v5
|
- uses: release-drafter/release-drafter@v5
|
||||||
id: create_release
|
id: create_release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
build-windows:
|
|
||||||
runs-on: windows-latest
|
|
||||||
needs: [ release ]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '^1.19'
|
|
||||||
cache: true
|
|
||||||
- uses: subosito/flutter-action@v2
|
|
||||||
- name: Build
|
|
||||||
env:
|
|
||||||
VERSION: ${{ needs.release.outputs.tag_name }}
|
|
||||||
run: |
|
|
||||||
go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/windows/libgopeed.dll github.com/monkeyWie/gopeed/bind/desktop
|
|
||||||
cd ui/flutter
|
|
||||||
flutter build windows
|
|
||||||
$mingw = "C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin"
|
|
||||||
$system = "C:\Windows\System32"
|
|
||||||
$release = "build\windows\runner\Release\"
|
|
||||||
cp $mingw\libstdc++-6.dll $release
|
|
||||||
cp $mingw\libgcc_s_seh-1.dll $release
|
|
||||||
cp $mingw\libwinpthread-1.dll $release
|
|
||||||
cp $system\msvcp140.dll $release
|
|
||||||
cp $system\vcruntime140.dll $release
|
|
||||||
cp $system\vcruntime140_1.dll $release
|
|
||||||
|
|
||||||
cd build/windows
|
|
||||||
echo @"
|
|
||||||
; Script generated by the Inno Setup Script Wizard.
|
|
||||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
|
||||||
|
|
||||||
#define MyAppName "Gopeed"
|
|
||||||
#define MyAppVersion "$($env:VERSION.substring(1))"
|
|
||||||
#define MyAppPublisher "monkeyWie"
|
|
||||||
#define MyAppURL "https://gopeed.com"
|
|
||||||
#define MyAppExeName "gopeed.exe"
|
|
||||||
|
|
||||||
[Setup]
|
|
||||||
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
|
|
||||||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
|
||||||
AppId={{5960F34D-1E42-402C-8C85-DE2FF24CBAE4}
|
|
||||||
AppName={#MyAppName}
|
|
||||||
AppVersion={#MyAppVersion}
|
|
||||||
;AppVerName={#MyAppName} {#MyAppVersion}
|
|
||||||
AppPublisher={#MyAppPublisher}
|
|
||||||
AppPublisherURL={#MyAppURL}
|
|
||||||
AppSupportURL={#MyAppURL}
|
|
||||||
AppUpdatesURL={#MyAppURL}
|
|
||||||
DefaultDirName={autopf}\gopeed
|
|
||||||
DisableProgramGroupPage=yes
|
|
||||||
LicenseFile=..\..\..\..\LICENSE
|
|
||||||
; Remove the following line to run in administrative install mode (install for all users.)
|
|
||||||
PrivilegesRequired=lowest
|
|
||||||
OutputBaseFilename=gopeed
|
|
||||||
SetupIconFile=..\..\assets\icon\icon.ico
|
|
||||||
Compression=lzma
|
|
||||||
SolidCompression=yes
|
|
||||||
WizardStyle=modern
|
|
||||||
|
|
||||||
[Languages]
|
|
||||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
|
||||||
|
|
||||||
[Tasks]
|
|
||||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
|
||||||
|
|
||||||
[Files]
|
|
||||||
Source: ".\runner\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
|
|
||||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
|
||||||
|
|
||||||
[Icons]
|
|
||||||
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
|
||||||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
|
|
||||||
|
|
||||||
[Run]
|
|
||||||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
|
||||||
"@ > setup.iss
|
|
||||||
iscc.exe setup.iss
|
|
||||||
mv "Output\gopeed.exe" "Output\Gopeed-$env:VERSION-windows-amd64.exe"
|
|
||||||
- name: Upload
|
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
|
||||||
with:
|
|
||||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
||||||
asset_path: ui/flutter/build/windows/Output/*
|
|
||||||
overwrite: true
|
|
||||||
build-macos-arm64-lib:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [ release ]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '^1.19'
|
|
||||||
cache: true
|
|
||||||
- run: mkdir -p ~/image-cache
|
|
||||||
- id: image-cache
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ~/image-cache
|
|
||||||
key: image-cache-xgo-v1.19
|
|
||||||
- if: steps.image-cache.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
docker pull techknowlogick/xgo:go-1.19.x
|
|
||||||
docker save -o ~/image-cache/xgo.tar techknowlogick/xgo:go-1.19.x
|
|
||||||
- if: steps.image-cache.outputs.cache-hit == 'true'
|
|
||||||
run: docker load -i ~/image-cache/xgo.tar
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
go install src.techknowlogick.com/xgo@latest
|
|
||||||
xgo --targets=darwin/arm64 -tags="nosqlite" -ldflags="-w -s" -buildmode=c-shared -pkg=bind/desktop -out=libgopeed .
|
|
||||||
mv libgopeed-*.dylib libgopeed.dylib
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: macos-arm64-lib
|
|
||||||
path: libgopeed.dylib
|
|
||||||
build-macos:
|
|
||||||
runs-on: macos-latest
|
|
||||||
needs: [ release, build-macos-arm64-lib ]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '^1.19'
|
|
||||||
cache: true
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
- uses: subosito/flutter-action@v2
|
|
||||||
- name: Install appdmg
|
|
||||||
run: npm install -g appdmg
|
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: macos-arm64-lib
|
|
||||||
path: ui/flutter/macos/Frameworks
|
|
||||||
- name: Build
|
|
||||||
env:
|
|
||||||
VERSION: ${{ needs.release.outputs.tag_name }}
|
|
||||||
run: |
|
|
||||||
PROJECT_DIR=$(pwd)
|
|
||||||
|
|
||||||
cd ui/flutter
|
|
||||||
flutter build macos
|
|
||||||
cd build/macos/Build/Products/Release
|
|
||||||
cat>appdmg.json<<EOF
|
|
||||||
{
|
|
||||||
"title": "Gopeed",
|
|
||||||
"icon": "Gopeed.app/Contents/Resources/AppIcon.icns",
|
|
||||||
"contents": [
|
|
||||||
{ "x": 448, "y": 344, "type": "link", "path": "/Applications" },
|
|
||||||
{ "x": 192, "y": 344, "type": "file", "path": "Gopeed.app" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
mkdir dist
|
|
||||||
appdmg appdmg.json dist/Gopeed-$VERSION-macos-arm64.dmg
|
|
||||||
|
|
||||||
# amd64
|
|
||||||
cd $PROJECT_DIR
|
|
||||||
go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o bin/libgopeed.dylib github.com/monkeyWie/gopeed/bind/desktop
|
|
||||||
cp bin/libgopeed.dylib ui/flutter/build/macos/Build/Products/Release/Gopeed.app/Contents/Frameworks/
|
|
||||||
cd ui/flutter/build/macos/Build/Products/Release
|
|
||||||
appdmg appdmg.json dist/Gopeed-$VERSION-macos-amd64.dmg
|
|
||||||
- name: Upload
|
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
|
||||||
with:
|
|
||||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
||||||
asset_path: ui/flutter/build/macos/Build/Products/Release/dist/*
|
|
||||||
overwrite: true
|
|
||||||
build-linux:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [ release ]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '^1.19'
|
|
||||||
cache: true
|
|
||||||
- uses: subosito/flutter-action@v2
|
|
||||||
- run: |
|
|
||||||
sudo apt-get update -y
|
|
||||||
sudo apt-get install -y ninja-build libgtk-3-dev
|
|
||||||
- name: Build
|
|
||||||
env:
|
|
||||||
VERSION: ${{ needs.release.outputs.tag_name }}
|
|
||||||
run: |
|
|
||||||
go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/linux/bundle/lib/libgopeed.so github.com/monkeyWie/gopeed/bind/desktop
|
|
||||||
cd ui/flutter
|
|
||||||
flutter build linux
|
|
||||||
mkdir -p debian/gui
|
|
||||||
cp assets/icon/icon_1024.png debian/gui/gopeed.png
|
|
||||||
cat>debian/debian.yaml<<EOF
|
|
||||||
flutter_app:
|
|
||||||
command: gopeed
|
|
||||||
arch: x64
|
|
||||||
parent: /usr/local/lib
|
|
||||||
control:
|
|
||||||
Package: gopeed
|
|
||||||
Version: ${VERSION:1}
|
|
||||||
Architecture: amd64
|
|
||||||
Essential: no
|
|
||||||
Priority: optional
|
|
||||||
Depends:
|
|
||||||
Maintainer: monkeyWie
|
|
||||||
Description: High speed downloader that supports all platforms.
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat>debian/gui/gopeed.desktop<<EOF
|
|
||||||
[Desktop Entry]
|
|
||||||
Version=${VERSION:1}
|
|
||||||
Name=Gopeed
|
|
||||||
GenericName=Gopeed
|
|
||||||
Comment=High speed downloader that supports all platforms.
|
|
||||||
Terminal=false
|
|
||||||
Type=Application
|
|
||||||
Categories=Utility
|
|
||||||
Keywords=Flutter;Downloader;
|
|
||||||
EOF
|
|
||||||
|
|
||||||
dart pub global activate flutter_to_debian
|
|
||||||
flutter_to_debian
|
|
||||||
mv debian/packages/gopeed*.deb debian/packages/Gopeed-$VERSION-linux-amd64.deb
|
|
||||||
- name: Upload
|
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
|
||||||
with:
|
|
||||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
||||||
asset_path: ui/flutter/debian/packages/*
|
|
||||||
overwrite: true
|
|
||||||
build-android:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [ release ]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '^1.19'
|
|
||||||
cache: true
|
|
||||||
- uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
distribution: 'zulu'
|
|
||||||
java-version: '11'
|
|
||||||
- uses: subosito/flutter-action@v2
|
|
||||||
- name: Build
|
|
||||||
env:
|
|
||||||
VERSION: ${{ needs.release.outputs.tag_name }}
|
|
||||||
run: |
|
|
||||||
mkdir ui/flutter/android/app/libs
|
|
||||||
go install golang.org/x/mobile/cmd/gomobile@latest
|
|
||||||
gomobile init
|
|
||||||
gomobile bind -tags nosqlite -ldflags="-w -s" -o ui/flutter/android/app/libs/libgopeed.aar -target=android -androidapi 19 -javapkg=com.gopeed github.com/monkeyWie/gopeed/bind/mobile
|
|
||||||
cd ui/flutter
|
|
||||||
flutter build apk
|
|
||||||
mkdir dist
|
|
||||||
cp build/app/outputs/flutter-apk/app-release.apk dist/Gopeed-$VERSION-android.apk
|
|
||||||
- name: Upload
|
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
|
||||||
with:
|
|
||||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
||||||
asset_path: ui/flutter/dist/*
|
|
||||||
overwrite: true
|
|
||||||
build-web:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [ release ]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '^1.19'
|
|
||||||
cache: true
|
|
||||||
- uses: subosito/flutter-action@v2
|
|
||||||
- name: Build
|
|
||||||
env:
|
|
||||||
VERSION: ${{ needs.release.outputs.tag_name }}
|
|
||||||
run: |
|
|
||||||
cd ui/flutter
|
|
||||||
flutter build web
|
|
||||||
cd ../../
|
|
||||||
cp -r ui/flutter/build/web cmd/web/dist
|
|
||||||
mkdir -p dist/zip
|
|
||||||
goos_arr=(windows darwin linux)
|
|
||||||
goarch_arr=(386 amd64 arm64)
|
|
||||||
export CGO_ENABLED=0
|
|
||||||
for goos in "${goos_arr[@]}"; do
|
|
||||||
for goarch in "${goarch_arr[@]}"; do
|
|
||||||
name=gopeed-web-$VERSION-$goos-$goarch
|
|
||||||
dir="dist/$name/"
|
|
||||||
(GOOS=$goos GOARCH=$goarch go build -tags nosqlite,web -ldflags="-s -w" -o $dir github.com/monkeyWie/gopeed/cmd/web \
|
|
||||||
&& cd $dir \
|
|
||||||
&& file=$(ls -AU | head -1) \
|
|
||||||
&& mkdir $name \
|
|
||||||
&& mv $file $name/$(echo $file | sed -e "s/web/gopeed/g") \
|
|
||||||
&& zip -r ../zip/$name.zip * \
|
|
||||||
&& cd ../..) \
|
|
||||||
|| true
|
|
||||||
done
|
|
||||||
done
|
|
||||||
- name: Upload
|
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
|
||||||
with:
|
|
||||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
||||||
asset_path: dist/zip/*
|
|
||||||
overwrite: true
|
|
||||||
+34
-28
@@ -4,36 +4,42 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths-ignore:
|
paths:
|
||||||
- '.github/workflows/release.yml'
|
- "bind/**"
|
||||||
- '.github/release-drafter.yml'
|
- "cmd/**"
|
||||||
- '_docs/**'
|
- "internal/**"
|
||||||
- '_examples/**'
|
- "pkg/**"
|
||||||
- 'README*.md'
|
- "ui/**"
|
||||||
|
- ".github/workflows/test.yml"
|
||||||
|
- "go.mod"
|
||||||
|
- "go.sum"
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths-ignore:
|
paths:
|
||||||
- '.github/workflows/release.yml'
|
- "bind/**"
|
||||||
- '.github/release-drafter.yml'
|
- "cmd/**"
|
||||||
- '_docs/**'
|
- "internal/**"
|
||||||
- '_examples/**'
|
- "pkg/**"
|
||||||
- 'README*.md'
|
- "ui/**"
|
||||||
|
- ".github/workflows/test.yml"
|
||||||
|
- "go.mod"
|
||||||
|
- "go.sum"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# lint:
|
# lint:
|
||||||
# name: Lint
|
# name: Lint
|
||||||
# runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
# steps:
|
# steps:
|
||||||
# - uses: actions/setup-go@v2
|
# - uses: actions/setup-go@v2
|
||||||
# with:
|
# with:
|
||||||
# go-version: '^1.19'
|
# go-version: '^1.19'
|
||||||
# - uses: actions/checkout@v2
|
# - uses: actions/checkout@v2
|
||||||
# - name: Lint Go Code
|
# - name: Lint Go Code
|
||||||
# run: |
|
# run: |
|
||||||
# export PATH=$PATH:$(go env GOPATH)/bin # temporary fix. See https://github.com/actions/setup-go/issues/14
|
# export PATH=$PATH:$(go env GOPATH)/bin # temporary fix. See https://github.com/actions/setup-go/issues/14
|
||||||
# go get -u golang.org/x/lint/golint
|
# go get -u golang.org/x/lint/golint
|
||||||
# golint -set_exit_status ./...
|
# golint -set_exit_status ./...
|
||||||
test:
|
test:
|
||||||
name: Test
|
name: Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -41,7 +47,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: '^1.19'
|
go-version: "^1.19"
|
||||||
cache: true
|
cache: true
|
||||||
- name: Run Unit tests.
|
- name: Run Unit tests.
|
||||||
run: go test $(go list ./... | grep -v /cmd/ | grep -v /bind/ ) -v -covermode=count -coverprofile=coverage.txt
|
run: go test $(go list ./... | grep -v /cmd/ | grep -v /bind/ ) -v -covermode=count -coverprofile=coverage.txt
|
||||||
@@ -52,13 +58,13 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# needs: [lint, test]
|
# needs: [lint, test]
|
||||||
needs: [test]
|
needs: [test]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: '^1.19'
|
go-version: "^1.19"
|
||||||
cache: true
|
cache: true
|
||||||
- name: Build
|
- name: Build
|
||||||
run: go build github.com/monkeyWie/gopeed/cmd/gopeed
|
run: go build github.com/monkeyWie/gopeed/cmd/gopeed
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
FROM cirrusci/flutter:3.3.7 AS flutter
|
||||||
|
WORKDIR /app
|
||||||
|
COPY ./ui/flutter/pubspec.yaml ./ui/flutter/pubspec.lock ./
|
||||||
|
RUN flutter pub get
|
||||||
|
COPY ./ui/flutter ./
|
||||||
|
RUN flutter build web
|
||||||
|
|
||||||
|
FROM golang:1.19.3 AS go
|
||||||
|
WORKDIR /app
|
||||||
|
COPY ./go.mod ./go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
COPY . .
|
||||||
|
COPY --from=flutter /app/build/web/* ./cmd/web/dist/
|
||||||
|
RUN go build -tags nosqlite,web -ldflags="-s -w" -o dist/gopeed github.com/monkeyWie/gopeed/cmd/web
|
||||||
|
|
||||||
|
FROM alpine:3.14.2
|
||||||
|
LABEL maintainer="monkeyWie"
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=go /app/dist/gopeed ./
|
||||||
|
EXPOSE 9999
|
||||||
|
ENTRYPOINT ["./gopeed"]
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
[](https://github.com/monkeyWie/gopeed/actions?query=workflow%3Atest)
|
[](https://github.com/monkeyWie/gopeed/actions?query=workflow%3Atest)
|
||||||
[](https://codecov.io/gh/monkeyWie/gopeed)
|
[](https://codecov.io/gh/monkeyWie/gopeed)
|
||||||
[](https://github.com/monkeyWie/gopeed/releases)
|
[](https://github.com/monkeyWie/gopeed/releases)
|
||||||
|
[](https://discord.gg/ZUJqJrwCGB)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 介绍
|
[English](/README.md) | [中文](/README_zh-CN.md)
|
||||||
|
|
||||||
Gopeed 是一款由`Golang`+`Flutter`开发的高速下载器,支持(HTTP、BitTorrent、Magnet)协议下载,并且支持全平台使用。
|
## Introduction
|
||||||
|
|
||||||
## 下载
|
Gopeed is a high-speed downloader developed by `Golang`+`Flutter`, which supports (HTTP, BitTorrent, Magnet) protocol downloads and supports all platforms.
|
||||||
|
|
||||||
**已支持平台**
|
## Installation
|
||||||
|
|
||||||
|
**Supported platforms**
|
||||||
|
|
||||||
- [x] windows
|
- [x] windows
|
||||||
- [x] macos
|
- [x] macos
|
||||||
@@ -18,45 +21,57 @@ Gopeed 是一款由`Golang`+`Flutter`开发的高速下载器,支持(HTTP、
|
|||||||
- [x] android
|
- [x] android
|
||||||
- [ ] ios
|
- [ ] ios
|
||||||
- [x] web
|
- [x] web
|
||||||
|
- [x] docker
|
||||||
|
|
||||||
[点击前往](https://github.com/monkeyWie/gopeed/releases/latest)
|
[To Release](https://github.com/monkeyWie/gopeed/releases/latest)
|
||||||
|
|
||||||
### 命令行工具
|
> Tips: If the macos open failed, please execute the `xattr -d com.apple.quarantine /Applications/gopeed.app` command in the terminal
|
||||||
|
|
||||||
使用`go install`安装:
|
### Command tool
|
||||||
|
|
||||||
|
use `go install`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go install github.com/monkeyWie/gopeed/cmd/gopeed
|
go install github.com/monkeyWie/gopeed/cmd/gopeed
|
||||||
```
|
```
|
||||||
|
|
||||||
## 界面展示
|
### Docker
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run liwei2633/gopeed:latest -v /path/to/download:/download -p 9999:9999
|
||||||
|
```
|
||||||
|
|
||||||
|
When the docker container is running, you can access the web page through `http://localhost:9999`.
|
||||||
|
> Tip: Modify the download path to `/download` on the setting page to access the downloaded files on the host.
|
||||||
|
|
||||||
|
## Showcase
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 开发
|
## Development
|
||||||
|
|
||||||
本项目分为前端和后端两个部分,前端使用`flutter`,后端使用`Golang`,两边通过`http`协议进行通讯,在 unix 系统下,使用的是`unix socket`,在 windows 系统下,使用的是`tcp`协议。
|
This project is divided into two parts, the front end uses `flutter`, the back end uses `Golang`, and the two sides communicate through the `http` protocol. On the unix system, `unix socket` is used, and on the windows system, `tcp` protocol is used.
|
||||||
|
|
||||||
> 前端代码位于`ui/flutter`目录下。
|
> The front code is located in the `ui/flutter` directory.
|
||||||
|
|
||||||
### 环境要求
|
### Environment
|
||||||
|
|
||||||
1. Golang 1.9+
|
1. Golang 1.19+
|
||||||
2. Flutter 3.0+
|
2. Flutter 3.0+
|
||||||
|
|
||||||
### 克隆项目
|
### Clone
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone [email protected]:monkeyWie/gopeed.git
|
git clone [email protected]:monkeyWie/gopeed.git
|
||||||
```
|
```
|
||||||
|
|
||||||
### 编译
|
### Build
|
||||||
|
|
||||||
#### 桌面端
|
#### Desktop
|
||||||
|
|
||||||
首先需要按照[flutter desktop 官网文档](https://docs.flutter.dev/development/platform-integration/desktop)进行环境配置,然后需要准备好`cgo`环境,具体可以自行搜索。
|
First, you need to configure the environment according to the [flutter desktop official website document](https://docs.flutter.dev/development/platform-integration/desktop), and then you need to prepare the `cgo` environment, which can be searched for yourself.
|
||||||
|
|
||||||
构建命令:
|
command:
|
||||||
|
|
||||||
- windows
|
- windows
|
||||||
|
|
||||||
@@ -82,16 +97,16 @@ cd ui/flutter
|
|||||||
flutter build linux
|
flutter build linux
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 移动端
|
#### Mobile
|
||||||
|
|
||||||
同样的也是需要准备好`cgo`环境,接着安装`gomobile`:
|
Same as before, you also need to prepare the `cgo` environment, and then install `gomobile`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go install golang.org/x/mobile/cmd/gomobile@latest
|
go install golang.org/x/mobile/cmd/gomobile@latest
|
||||||
gomobile init
|
gomobile init
|
||||||
```
|
```
|
||||||
|
|
||||||
构建命令:
|
command:
|
||||||
|
|
||||||
- android
|
- android
|
||||||
|
|
||||||
@@ -101,11 +116,11 @@ cd ui/flutter
|
|||||||
flutter build apk
|
flutter build apk
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Web 端(推荐本地调试使用)
|
#### Web
|
||||||
|
|
||||||
Web 端直接与后端 http 服务通讯,不需要额外准备环境。
|
Web platform communicates directly with the backend http server, no additional environment is required.
|
||||||
|
|
||||||
构建命令:
|
command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ui/flutter
|
cd ui/flutter
|
||||||
@@ -113,8 +128,8 @@ flutter build web
|
|||||||
cd ../../
|
cd ../../
|
||||||
cp -r ui/flutter/build/web cmd/web/dist
|
cp -r ui/flutter/build/web cmd/web/dist
|
||||||
go build -tags nosqlite,web -ldflags="-s -w" -o bin/ github.com/monkeyWie/gopeed/cmd/web
|
go build -tags nosqlite,web -ldflags="-s -w" -o bin/ github.com/monkeyWie/gopeed/cmd/web
|
||||||
```
|
````
|
||||||
|
|
||||||
## 开源许可
|
## License
|
||||||
|
|
||||||
基于 [GPLv3](LICENSE) 协议开源。
|
[GPLv3](LICENSE)
|
||||||
+135
@@ -0,0 +1,135 @@
|
|||||||
|
[](https://github.com/monkeyWie/gopeed/actions?query=workflow%3Atest)
|
||||||
|
[](https://codecov.io/gh/monkeyWie/gopeed)
|
||||||
|
[](https://github.com/monkeyWie/gopeed/releases)
|
||||||
|
[](https://discord.gg/ZUJqJrwCGB)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
[English](/README.md) | [中文](/README_zh-CN.md)
|
||||||
|
|
||||||
|
## 介绍
|
||||||
|
|
||||||
|
Gopeed 是一款由`Golang`+`Flutter`开发的高速下载器,支持(HTTP、BitTorrent、Magnet)协议下载,并且支持全平台使用。
|
||||||
|
|
||||||
|
## 下载
|
||||||
|
|
||||||
|
**已支持平台**
|
||||||
|
|
||||||
|
- [x] windows
|
||||||
|
- [x] macos
|
||||||
|
- [x] linux
|
||||||
|
- [x] android
|
||||||
|
- [ ] ios
|
||||||
|
- [x] web
|
||||||
|
- [x] docker
|
||||||
|
|
||||||
|
[点击前往](https://github.com/monkeyWie/gopeed/releases/latest)
|
||||||
|
|
||||||
|
> 注:macos 版本运行如果提示损坏,请在终端执行 `xattr -d com.apple.quarantine /Applications/gopeed.app` 命令
|
||||||
|
|
||||||
|
### 命令行工具
|
||||||
|
|
||||||
|
使用`go install`安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go install github.com/monkeyWie/gopeed/cmd/gopeed
|
||||||
|
```
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run liwei2633/gopeed:latest -v /path/to/download:/download -p 9999:9999
|
||||||
|
```
|
||||||
|
|
||||||
|
当 docker 容器运行时,可以通过 `http://localhost:9999` 访问 web 页面。
|
||||||
|
> 提示:在设置页面把下载路径修改为 `/download` 以便在宿主机访问下载完的文件。
|
||||||
|
|
||||||
|
## 界面展示
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 开发
|
||||||
|
|
||||||
|
本项目分为前端和后端两个部分,前端使用`flutter`,后端使用`Golang`,两边通过`http`协议进行通讯,在 unix 系统下,使用的是`unix socket`,在 windows 系统下,使用的是`tcp`协议。
|
||||||
|
|
||||||
|
> 前端代码位于`ui/flutter`目录下。
|
||||||
|
|
||||||
|
### 环境要求
|
||||||
|
|
||||||
|
1. Golang 1.19+
|
||||||
|
2. Flutter 3.0+
|
||||||
|
|
||||||
|
### 克隆项目
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone [email protected]:monkeyWie/gopeed.git
|
||||||
|
```
|
||||||
|
|
||||||
|
### 编译
|
||||||
|
|
||||||
|
#### 桌面端
|
||||||
|
|
||||||
|
首先需要按照[flutter desktop 官网文档](https://docs.flutter.dev/development/platform-integration/desktop)进行环境配置,然后需要准备好`cgo`环境,具体可以自行搜索。
|
||||||
|
|
||||||
|
构建命令:
|
||||||
|
|
||||||
|
- windows
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/windows/libgopeed.dll github.com/monkeyWie/gopeed/bind/desktop
|
||||||
|
cd ui/flutter
|
||||||
|
flutter build windows
|
||||||
|
```
|
||||||
|
|
||||||
|
- macos
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/macos/Frameworks/libgopeed.dylib github.com/monkeyWie/gopeed/bind/desktop
|
||||||
|
cd ui/flutter
|
||||||
|
flutter build macos
|
||||||
|
```
|
||||||
|
|
||||||
|
- linux
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/linux/bundle/lib/libgopeed.so github.com/monkeyWie/gopeed/bind/desktop
|
||||||
|
cd ui/flutter
|
||||||
|
flutter build linux
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 移动端
|
||||||
|
|
||||||
|
同样的也是需要准备好`cgo`环境,接着安装`gomobile`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go install golang.org/x/mobile/cmd/gomobile@latest
|
||||||
|
gomobile init
|
||||||
|
```
|
||||||
|
|
||||||
|
构建命令:
|
||||||
|
|
||||||
|
- android
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gomobile bind -tags nosqlite -ldflags="-w -s" -o ui/flutter/android/app/libs/libgopeed.aar -target=android -androidapi 19 -javapkg=com.gopeed github.com/monkeyWie/gopeed/bind/mobile
|
||||||
|
cd ui/flutter
|
||||||
|
flutter build apk
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Web 端(推荐本地调试使用)
|
||||||
|
|
||||||
|
Web 端直接与后端 http 服务通讯,不需要额外准备环境。
|
||||||
|
|
||||||
|
构建命令:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ui/flutter
|
||||||
|
flutter build web
|
||||||
|
cd ../../
|
||||||
|
cp -r ui/flutter/build/web cmd/web/dist
|
||||||
|
go build -tags nosqlite,web -ldflags="-s -w" -o bin/ github.com/monkeyWie/gopeed/cmd/web
|
||||||
|
```
|
||||||
|
|
||||||
|
## 开源许可
|
||||||
|
|
||||||
|
基于 [GPLv3](LICENSE) 协议开源。
|
||||||
+1
-2
@@ -4,7 +4,6 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type args struct {
|
type args struct {
|
||||||
@@ -14,7 +13,7 @@ type args struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parse() *args {
|
func parse() *args {
|
||||||
dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
|
dir, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ func main() {
|
|||||||
cfg := &model.StartConfig{
|
cfg := &model.StartConfig{
|
||||||
Network: "tcp",
|
Network: "tcp",
|
||||||
Address: "127.0.0.1:9999",
|
Address: "127.0.0.1:9999",
|
||||||
Storage: model.StorageMem,
|
Storage: model.StorageBolt,
|
||||||
WebEnable: true,
|
WebEnable: true,
|
||||||
WebFS: sub,
|
WebFS: sub,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ android/app/libs/libgopeed-sources.jar
|
|||||||
|
|
||||||
debian/packages
|
debian/packages
|
||||||
|
|
||||||
generated_plugin_registrant.cc
|
linux/flutter/generated_plugin_registrant.cc
|
||||||
generated_plugin_registrant.h
|
linux/flutter/generated_plugin_registrant.h
|
||||||
generated_plugins.cmake
|
linux/flutter/generated_plugins.cmake
|
||||||
|
macos/Flutter/GeneratedPluginRegistrant.swift
|
||||||
|
windows/flutter/generated_plugin_registrant.cc
|
||||||
|
windows/flutter/generated_plugin_registrant.h
|
||||||
|
windows/flutter/generated_plugins.cmake
|
||||||
@@ -3,6 +3,7 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:dio/adapter.dart';
|
import 'package:dio/adapter.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:gopeed/util/util.dart';
|
||||||
import 'model/create_task.dart';
|
import 'model/create_task.dart';
|
||||||
import 'model/request.dart';
|
import 'model/request.dart';
|
||||||
import 'model/resource.dart';
|
import 'model/resource.dart';
|
||||||
@@ -26,7 +27,9 @@ class _Client {
|
|||||||
final isUnixSocket = LibgopeedBoot.instance.config.network == 'unix';
|
final isUnixSocket = LibgopeedBoot.instance.config.network == 'unix';
|
||||||
dio.options.baseUrl = isUnixSocket
|
dio.options.baseUrl = isUnixSocket
|
||||||
? 'http://127.0.0.1'
|
? 'http://127.0.0.1'
|
||||||
: 'http://${LibgopeedBoot.instance.config.address}';
|
: (Util.isWeb()
|
||||||
|
? ""
|
||||||
|
: 'http://${LibgopeedBoot.instance.config.address}');
|
||||||
_instance!.dio = dio;
|
_instance!.dio = dio;
|
||||||
if (isUnixSocket) {
|
if (isUnixSocket) {
|
||||||
(_instance!.dio.httpClientAdapter as DefaultHttpClientAdapter)
|
(_instance!.dio.httpClientAdapter as DefaultHttpClientAdapter)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class LibgopeedConfig {
|
|||||||
|
|
||||||
LibgopeedConfig({
|
LibgopeedConfig({
|
||||||
this.network = "tcp",
|
this.network = "tcp",
|
||||||
this.address = "127.0.0.1:9999",
|
this.address = "127.0.0.1:0",
|
||||||
this.refreshInterval = 500,
|
this.refreshInterval = 500,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
Locale toLocale(String key) {
|
||||||
|
final arr = key.split('_');
|
||||||
|
return Locale(arr[0], arr[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getLocaleKey(Locale locale) {
|
||||||
|
return '${locale.languageCode}_${locale.countryCode}';
|
||||||
|
}
|
||||||
|
|
||||||
|
final messages = _Messages();
|
||||||
|
const fallbackLocale = Locale('en', 'US');
|
||||||
|
|
||||||
|
class _Messages extends Translations {
|
||||||
|
@override
|
||||||
|
Map<String, Map<String, String>> get keys => {
|
||||||
|
'zh_CN': {
|
||||||
|
'error': '错误',
|
||||||
|
'confirm': '确认',
|
||||||
|
'cancel': '取消',
|
||||||
|
'home.task': '任务',
|
||||||
|
'home.setting': '设置',
|
||||||
|
'create.title': '创建任务',
|
||||||
|
'create.downloadLink': '下载链接',
|
||||||
|
'create.downloadLinkValid': '请输入下载链接',
|
||||||
|
'create.downloadLinkHit': '请输入下载链接,支持 HTTP/HTTPS/MAGNET@append',
|
||||||
|
'create.downloadLinkHitDesktop': ',也可以直接拖拽种子文件到此处',
|
||||||
|
'create.download': '下载',
|
||||||
|
'create.error.noStoragePermission': '需要开启存储权限',
|
||||||
|
'create.selectDir': '选择目录',
|
||||||
|
'setting.title': '设置',
|
||||||
|
'setting.basic': '基础设置',
|
||||||
|
'setting.theme': '主题',
|
||||||
|
'setting.themeSystem': '跟随系统',
|
||||||
|
'setting.themeLight': '明亮主题',
|
||||||
|
'setting.themeDark': '暗黑主题',
|
||||||
|
'setting.downloadDir': '下载目录',
|
||||||
|
'setting.downloadDirValid': '请选择下载目录',
|
||||||
|
'setting.connections': '连接数',
|
||||||
|
'setting.locale': '语言',
|
||||||
|
'setting.locale.zh_CN': '中文(简体)',
|
||||||
|
'setting.locale.en_US': '英文(美国)',
|
||||||
|
'task.deleteTask': '删除任务',
|
||||||
|
'task.deleteTaskTip': '保留已下载的文件',
|
||||||
|
'task.delete': '删除',
|
||||||
|
},
|
||||||
|
'en_US': {
|
||||||
|
'error': 'Error',
|
||||||
|
'confirm': 'Confirm',
|
||||||
|
'cancel': 'Cancel',
|
||||||
|
'home.task': 'Task',
|
||||||
|
'home.setting': 'Setting',
|
||||||
|
'create.title': 'Create Task',
|
||||||
|
'create.downloadLink': 'Download Link',
|
||||||
|
'create.downloadLinkValid': 'Please enter the download link',
|
||||||
|
'create.downloadLinkHit':
|
||||||
|
'Please enter the download link, HTTP/HTTPS/MAGNET supported@append',
|
||||||
|
'create.downloadLinkHitDesktop':
|
||||||
|
', or drag the torrent file here directly',
|
||||||
|
'create.download': 'Download',
|
||||||
|
'create.error.noStoragePermission': 'Storage permission required',
|
||||||
|
'create.selectDir': 'Select Directory',
|
||||||
|
'setting.title': 'Setting',
|
||||||
|
'setting.basic': 'Basic',
|
||||||
|
'setting.theme': 'Theme',
|
||||||
|
'setting.themeSystem': 'System',
|
||||||
|
'setting.themeLight': 'Light',
|
||||||
|
'setting.themeDark': 'Dark',
|
||||||
|
'setting.downloadDir': 'Download Directory',
|
||||||
|
'setting.downloadDirValid': 'Please select the download directory',
|
||||||
|
'setting.connections': 'Connections',
|
||||||
|
'setting.locale': 'Language',
|
||||||
|
'setting.locale.zh_CN': 'Chinese(Simplified)',
|
||||||
|
'setting.locale.en_US': 'English(US)',
|
||||||
|
'task.deleteTask': 'Delete Task',
|
||||||
|
'task.deleteTaskTip': 'Keep downloaded files',
|
||||||
|
'task.delete': 'Delete',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import 'core/libgopeed_boot.dart';
|
import 'core/libgopeed_boot.dart';
|
||||||
|
import 'i18n/messages.dart';
|
||||||
import 'routes/router.dart';
|
import 'routes/router.dart';
|
||||||
import 'setting/setting.dart';
|
import 'setting/setting.dart';
|
||||||
import 'theme/theme.dart';
|
import 'theme/theme.dart';
|
||||||
@@ -24,6 +25,9 @@ void main() async {
|
|||||||
theme: GopeedTheme.light,
|
theme: GopeedTheme.light,
|
||||||
darkTheme: GopeedTheme.dark,
|
darkTheme: GopeedTheme.dark,
|
||||||
themeMode: Setting.instance.themeMode,
|
themeMode: Setting.instance.themeMode,
|
||||||
|
translations: messages,
|
||||||
|
locale: toLocale(Setting.instance.locale),
|
||||||
|
fallbackLocale: fallbackLocale,
|
||||||
getPages: Routes.routes,
|
getPages: Routes.routes,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class CreateController extends GetxController {
|
class CreateController extends GetxController {}
|
||||||
var currentIndex = 0.obs;
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:desktop_drop/desktop_drop.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import '../../api/api.dart';
|
import '../../api/api.dart';
|
||||||
@@ -30,65 +31,77 @@ class CreateView extends GetView<CreateController> {
|
|||||||
icon: const Icon(Icons.arrow_back),
|
icon: const Icon(Icons.arrow_back),
|
||||||
onPressed: () => Get.rootDelegate.offNamed(Routes.task)),
|
onPressed: () => Get.rootDelegate.offNamed(Routes.task)),
|
||||||
actions: [Container()],
|
actions: [Container()],
|
||||||
title: const Text("创建任务"),
|
title: Text('create.title'.tr),
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: DropTarget(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 24.0),
|
onDragDone: (details) {
|
||||||
child: Form(
|
_urlController.text = details.files[0].path;
|
||||||
key: _resolveFormKey,
|
},
|
||||||
autovalidateMode: AutovalidateMode.always, //开启自动校验
|
child: Padding(
|
||||||
child: Column(
|
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 24.0),
|
||||||
children: [
|
child: Form(
|
||||||
TextFormField(
|
key: _resolveFormKey,
|
||||||
autofocus: true,
|
autovalidateMode: AutovalidateMode.always,
|
||||||
controller: _urlController,
|
child: Column(
|
||||||
minLines: 1,
|
children: [
|
||||||
maxLines: 15,
|
TextFormField(
|
||||||
decoration: const InputDecoration(
|
autofocus: true,
|
||||||
hintText: "请输入下载链接,支持 HTTP/HTTPS/MAGNET",
|
controller: _urlController,
|
||||||
labelText: "下载链接",
|
minLines: 1,
|
||||||
icon: Icon(Icons.link)),
|
maxLines: 15,
|
||||||
validator: (v) {
|
decoration: InputDecoration(
|
||||||
return v!.trim().isNotEmpty ? null : "请输入下载链接";
|
hintText: _hitText(),
|
||||||
}),
|
labelText: 'create.downloadLink'.tr,
|
||||||
// 登录按钮
|
icon: const Icon(Icons.link)),
|
||||||
Center(
|
validator: (v) {
|
||||||
child: Padding(
|
return v!.trim().isNotEmpty
|
||||||
padding: const EdgeInsets.all(15.0),
|
? null
|
||||||
child: ConstrainedBox(
|
: 'create.downloadLinkValid'.tr;
|
||||||
constraints: const BoxConstraints.tightFor(
|
}),
|
||||||
width: 150,
|
Center(
|
||||||
height: 40,
|
child: Padding(
|
||||||
),
|
padding: const EdgeInsets.all(15.0),
|
||||||
child: RoundedLoadingButton(
|
child: ConstrainedBox(
|
||||||
color: Get.theme.colorScheme.secondary,
|
constraints: const BoxConstraints.tightFor(
|
||||||
onPressed: () async {
|
width: 150,
|
||||||
if (_resolveFormKey.currentState!.validate()) {
|
height: 40,
|
||||||
_confirmController.start();
|
),
|
||||||
try {
|
child: RoundedLoadingButton(
|
||||||
final res = await resolve(Request(
|
color: Get.theme.colorScheme.secondary,
|
||||||
url: _urlController.text,
|
onPressed: () async {
|
||||||
));
|
if (_resolveFormKey.currentState!.validate()) {
|
||||||
await _showResolveDialog(res);
|
_confirmController.start();
|
||||||
} catch (e) {
|
try {
|
||||||
Get.snackbar("错误", e.toString());
|
final res = await resolve(Request(
|
||||||
} finally {
|
url: _urlController.text,
|
||||||
_confirmController.reset();
|
));
|
||||||
|
await _showResolveDialog(res);
|
||||||
|
} catch (e) {
|
||||||
|
Get.snackbar('error'.tr, e.toString());
|
||||||
|
} finally {
|
||||||
|
_confirmController.reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
controller: _confirmController,
|
||||||
controller: _confirmController,
|
child: Text('confirm'.tr),
|
||||||
child: const Text("确认"),
|
),
|
||||||
),
|
)),
|
||||||
)),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _hitText() {
|
||||||
|
return 'create.downloadLinkHit'.trParams({
|
||||||
|
'append': Util.isDesktop() ? 'create.downloadLinkHitDesktop'.tr : '',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _showResolveDialog(Resource res) async {
|
Future<void> _showResolveDialog(Resource res) async {
|
||||||
final createFormKey = GlobalKey<FormState>();
|
final createFormKey = GlobalKey<FormState>();
|
||||||
final pathController =
|
final pathController =
|
||||||
@@ -142,7 +155,7 @@ class CreateView extends GetView<CreateController> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
child: const Text("取消"),
|
child: Text('cancel'.tr),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
@@ -158,7 +171,8 @@ class CreateView extends GetView<CreateController> {
|
|||||||
downloadController.start();
|
downloadController.start();
|
||||||
if (Util.isAndroid()) {
|
if (Util.isAndroid()) {
|
||||||
if (!await Permission.storage.request().isGranted) {
|
if (!await Permission.storage.request().isGranted) {
|
||||||
Get.snackbar("错误", "需要开启存储权限");
|
Get.snackbar('error'.tr,
|
||||||
|
'create.error.noStoragePermission'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,14 +193,14 @@ class CreateView extends GetView<CreateController> {
|
|||||||
Get.rootDelegate.offNamed(Routes.task);
|
Get.rootDelegate.offNamed(Routes.task);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Get.snackbar("错误", e.toString());
|
Get.snackbar('error'.tr, e.toString());
|
||||||
rethrow;
|
rethrow;
|
||||||
} finally {
|
} finally {
|
||||||
downloadController.reset();
|
downloadController.reset();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
controller: downloadController,
|
controller: downloadController,
|
||||||
child: const Text("下载"),
|
child: Text('create.download'.tr),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ class HomeView extends GetView<HomeController> {
|
|||||||
AnimatedBarItems(
|
AnimatedBarItems(
|
||||||
icon: const Icon(Icons.list),
|
icon: const Icon(Icons.list),
|
||||||
selectedColor: Get.theme.primaryColor,
|
selectedColor: Get.theme.primaryColor,
|
||||||
title: const Text('任务')),
|
title: Text('home.task'.tr)),
|
||||||
AnimatedBarItems(
|
AnimatedBarItems(
|
||||||
icon: const Icon(Icons.settings),
|
icon: const Icon(Icons.settings),
|
||||||
selectedColor: Get.theme.primaryColor,
|
selectedColor: Get.theme.primaryColor,
|
||||||
title: const Text('设置')),
|
title: Text('home.setting'.tr)),
|
||||||
],
|
],
|
||||||
iconSize: 32,
|
iconSize: 32,
|
||||||
barAnimation: BarAnimation.fade,
|
barAnimation: BarAnimation.fade,
|
||||||
|
|||||||
@@ -5,4 +5,8 @@ import '../../setting/setting.dart';
|
|||||||
class SettingController extends GetxController {
|
class SettingController extends GetxController {
|
||||||
final setting = Setting.instance.obs;
|
final setting = Setting.instance.obs;
|
||||||
final tapStatues = <int, bool>{}.obs;
|
final tapStatues = <int, bool>{}.obs;
|
||||||
|
|
||||||
|
void clearTapStatus() {
|
||||||
|
tapStatues.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,8 @@ import 'dart:async';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:gopeed/i18n/messages.dart';
|
||||||
|
import 'package:gopeed/util/util.dart';
|
||||||
import '../../setting/setting.dart';
|
import '../../setting/setting.dart';
|
||||||
import '../../widget/directory_selector.dart';
|
import '../../widget/directory_selector.dart';
|
||||||
|
|
||||||
@@ -15,35 +17,42 @@ class SettingView extends GetView<SettingController> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Timer? timer;
|
Timer? timer;
|
||||||
debounceSave() {
|
debounceSave() {
|
||||||
|
var completer = Completer<void>();
|
||||||
timer?.cancel();
|
timer?.cancel();
|
||||||
timer = Timer(const Duration(milliseconds: 500), Setting.instance.save);
|
timer = Timer(const Duration(milliseconds: 500), () {
|
||||||
|
Setting.instance
|
||||||
|
.save()
|
||||||
|
.then(completer.complete)
|
||||||
|
.onError(completer.completeError);
|
||||||
|
});
|
||||||
|
return completer.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('设置'),
|
title: Text('setting.title'.tr),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
// 左对齐
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text("基本设置", style: Get.textTheme.titleLarge),
|
Text('setting.basic'.tr, style: Get.textTheme.titleLarge),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Obx(() => Card(
|
Obx(() => Card(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: _buildConfigItems([
|
children: _buildConfigItems([
|
||||||
_ConfigItem(
|
_ConfigItem(
|
||||||
"主题",
|
'setting.theme'.tr,
|
||||||
() => _getThemeName(controller.setting.value.themeMode),
|
() => _getThemeName(controller.setting.value.themeMode),
|
||||||
() => DropdownButton<ThemeMode>(
|
() => DropdownButton<ThemeMode>(
|
||||||
value: controller.setting.value.themeMode,
|
value: controller.setting.value.themeMode,
|
||||||
isDense: true,
|
isDense: true,
|
||||||
onChanged: (value) {
|
onChanged: (value) async {
|
||||||
controller.setting.value.themeMode = value!;
|
controller.setting.value.themeMode = value!;
|
||||||
|
controller.clearTapStatus();
|
||||||
Get.changeThemeMode(value);
|
Get.changeThemeMode(value);
|
||||||
|
|
||||||
debounceSave();
|
await debounceSave();
|
||||||
},
|
},
|
||||||
items: ThemeMode.values
|
items: ThemeMode.values
|
||||||
.map((e) => DropdownMenuItem<ThemeMode>(
|
.map((e) => DropdownMenuItem<ThemeMode>(
|
||||||
@@ -52,17 +61,20 @@ class SettingView extends GetView<SettingController> {
|
|||||||
))
|
))
|
||||||
.toList(),
|
.toList(),
|
||||||
)),
|
)),
|
||||||
_ConfigItem(
|
_ConfigItem('setting.downloadDir'.tr,
|
||||||
"下载目录", () => controller.setting.value.downloadDir, () {
|
() => controller.setting.value.downloadDir, () {
|
||||||
final downloadDirController = TextEditingController(
|
final downloadDirController = TextEditingController(
|
||||||
text: controller.setting.value.downloadDir);
|
text: controller.setting.value.downloadDir);
|
||||||
downloadDirController.addListener(() {
|
downloadDirController.addListener(() async {
|
||||||
if (downloadDirController.text !=
|
if (downloadDirController.text !=
|
||||||
controller.setting.value.downloadDir) {
|
controller.setting.value.downloadDir) {
|
||||||
controller.setting.value.downloadDir =
|
controller.setting.value.downloadDir =
|
||||||
downloadDirController.text;
|
downloadDirController.text;
|
||||||
|
if (Util.isDesktop()) {
|
||||||
|
controller.clearTapStatus();
|
||||||
|
}
|
||||||
|
|
||||||
debounceSave();
|
await debounceSave();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return DirectorySelector(
|
return DirectorySelector(
|
||||||
@@ -70,19 +82,19 @@ class SettingView extends GetView<SettingController> {
|
|||||||
showLabel: false,
|
showLabel: false,
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
_ConfigItem("连接数",
|
_ConfigItem('setting.connections'.tr,
|
||||||
() => controller.setting.value.connections.toString(),
|
() => controller.setting.value.connections.toString(),
|
||||||
() {
|
() {
|
||||||
final connectionsController = TextEditingController(
|
final connectionsController = TextEditingController(
|
||||||
text: controller.setting.value.connections.toString());
|
text: controller.setting.value.connections.toString());
|
||||||
connectionsController.addListener(() {
|
connectionsController.addListener(() async {
|
||||||
if (connectionsController.text.isNotEmpty &&
|
if (connectionsController.text.isNotEmpty &&
|
||||||
connectionsController.text !=
|
connectionsController.text !=
|
||||||
controller.setting.value.connections.toString()) {
|
controller.setting.value.connections.toString()) {
|
||||||
controller.setting.value.connections =
|
controller.setting.value.connections =
|
||||||
int.parse(connectionsController.text);
|
int.parse(connectionsController.text);
|
||||||
|
|
||||||
debounceSave();
|
await debounceSave();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -95,6 +107,27 @@ class SettingView extends GetView<SettingController> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
_ConfigItem(
|
||||||
|
'setting.locale'.tr,
|
||||||
|
() => _getLocaleName(controller.setting.value.locale),
|
||||||
|
() => DropdownButton<String>(
|
||||||
|
value: controller.setting.value.locale,
|
||||||
|
isDense: true,
|
||||||
|
onChanged: (value) async {
|
||||||
|
controller.setting.value.locale = value!;
|
||||||
|
controller.clearTapStatus();
|
||||||
|
Get.updateLocale(toLocale(value));
|
||||||
|
|
||||||
|
await debounceSave();
|
||||||
|
},
|
||||||
|
items: _getLocales()
|
||||||
|
.map((e) => DropdownMenuItem<String>(
|
||||||
|
value:
|
||||||
|
e.substring(_settingLocaleKey.length),
|
||||||
|
child: Text(e.tr),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
)),
|
||||||
]),
|
]),
|
||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
@@ -130,13 +163,30 @@ class SettingView extends GetView<SettingController> {
|
|||||||
String _getThemeName(ThemeMode themeMode) {
|
String _getThemeName(ThemeMode themeMode) {
|
||||||
switch (themeMode) {
|
switch (themeMode) {
|
||||||
case ThemeMode.system:
|
case ThemeMode.system:
|
||||||
return "跟随系统";
|
return 'setting.themeSystem'.tr;
|
||||||
case ThemeMode.light:
|
case ThemeMode.light:
|
||||||
return "明亮主题";
|
return 'setting.themeLight'.tr;
|
||||||
case ThemeMode.dark:
|
case ThemeMode.dark:
|
||||||
return "暗黑主题";
|
return 'setting.themeDark'.tr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final _settingLocaleKey = 'setting.locale.';
|
||||||
|
|
||||||
|
List<String> _getLocales() {
|
||||||
|
return messages.keys[getLocaleKey(fallbackLocale)]!.entries
|
||||||
|
.where((e) => e.key.startsWith(_settingLocaleKey))
|
||||||
|
.map((e) => e.key)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
String _getLocaleName(String locale) {
|
||||||
|
final localeKey = '$_settingLocaleKey${locale.toString()}';
|
||||||
|
if (messages.keys[locale]?.containsKey(localeKey) ?? false) {
|
||||||
|
return localeKey.tr;
|
||||||
|
}
|
||||||
|
return '$_settingLocaleKey$locale'.tr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ConfigItem {
|
class _ConfigItem {
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ class Item extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var controller = Get.find<TaskController>();
|
|
||||||
|
|
||||||
return Card(
|
return Card(
|
||||||
elevation: 4.0,
|
elevation: 4.0,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
@@ -153,22 +151,23 @@ class Item extends StatelessWidget {
|
|||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
builder: (_) => AlertDialog(
|
builder: (_) => AlertDialog(
|
||||||
title: const Text("删除任务"),
|
title: Text('task.deleteTask'.tr),
|
||||||
content: Obx(() => CheckboxListTile(
|
content: Obx(() => CheckboxListTile(
|
||||||
value: keep.value,
|
value: keep.value,
|
||||||
title: Text("保留已下载的文件", style: Get.textTheme.bodyText1),
|
title: Text('task.deleteTaskTip'.tr,
|
||||||
|
style: Get.textTheme.bodyText1),
|
||||||
onChanged: (v) {
|
onChanged: (v) {
|
||||||
keep.value = v!;
|
keep.value = v!;
|
||||||
})),
|
})),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
child: const Text("取消"),
|
child: Text('cancel'.tr),
|
||||||
onPressed: () => Get.back(), //关闭对话框
|
onPressed: () => Get.back(),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
child: const Text(
|
child: Text(
|
||||||
"删除",
|
'task.delete'.tr,
|
||||||
style: TextStyle(color: Colors.redAccent),
|
style: const TextStyle(color: Colors.redAccent),
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
try {
|
try {
|
||||||
@@ -176,7 +175,7 @@ class Item extends StatelessWidget {
|
|||||||
Get.find<TaskController>().loadTab();
|
Get.find<TaskController>().loadTab();
|
||||||
Get.back();
|
Get.back();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Get.snackbar("错误", e.toString());
|
Get.snackbar('error'.tr, e.toString());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import 'package:external_path/external_path.dart';
|
import 'package:external_path/external_path.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gopeed/i18n/messages.dart';
|
||||||
import '../api/api.dart';
|
import '../api/api.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
|
||||||
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
import '../api/model/server_config.dart';
|
import '../api/model/server_config.dart';
|
||||||
import '../util/util.dart';
|
import '../util/util.dart';
|
||||||
|
|
||||||
@@ -10,22 +13,17 @@ class Setting {
|
|||||||
String host = "127.0.0.1";
|
String host = "127.0.0.1";
|
||||||
int port = 0;
|
int port = 0;
|
||||||
int connections = 0;
|
int connections = 0;
|
||||||
String downloadDir = "";
|
late String downloadDir;
|
||||||
ThemeMode themeMode = ThemeMode.system;
|
late ThemeMode themeMode;
|
||||||
|
late String locale;
|
||||||
Setting({
|
|
||||||
required this.host,
|
|
||||||
required this.port,
|
|
||||||
required this.connections,
|
|
||||||
required this.downloadDir,
|
|
||||||
required this.themeMode,
|
|
||||||
});
|
|
||||||
|
|
||||||
// singleton pattern
|
// singleton pattern
|
||||||
static Setting? _instance;
|
static Setting? _instance;
|
||||||
|
|
||||||
static Setting get instance {
|
static Setting get instance {
|
||||||
_instance ??= Setting._internal();
|
_instance ??= Setting._internal();
|
||||||
|
_instance!.themeMode = ThemeMode.system;
|
||||||
|
_instance!.locale = getLocaleKey(ui.window.locale);
|
||||||
return _instance!;
|
return _instance!;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,16 +36,14 @@ class Setting {
|
|||||||
connections = config.connections;
|
connections = config.connections;
|
||||||
downloadDir = config.downloadDir;
|
downloadDir = config.downloadDir;
|
||||||
final themeMode = config.extra?['themeMode'];
|
final themeMode = config.extra?['themeMode'];
|
||||||
if (themeMode == null) {
|
if (themeMode != null) {
|
||||||
this.themeMode = ThemeMode.system;
|
|
||||||
} else {
|
|
||||||
this.themeMode = ThemeMode.values.byName(themeMode);
|
this.themeMode = ThemeMode.values.byName(themeMode);
|
||||||
}
|
}
|
||||||
|
final locale = config.extra?['locale'];
|
||||||
if (Util.isWeb()) {
|
if (locale != null) {
|
||||||
downloadDir = "./";
|
this.locale = locale;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Util.isAndroid()) {
|
if (Util.isAndroid()) {
|
||||||
downloadDir =
|
downloadDir =
|
||||||
'${await ExternalPath.getExternalStoragePublicDirectory(ExternalPath.DIRECTORY_DOWNLOADS)}/com.gopeed';
|
'${await ExternalPath.getExternalStoragePublicDirectory(ExternalPath.DIRECTORY_DOWNLOADS)}/com.gopeed';
|
||||||
@@ -55,6 +51,9 @@ class Setting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (downloadDir.isEmpty) {
|
if (downloadDir.isEmpty) {
|
||||||
|
if (Util.isWeb()) {
|
||||||
|
downloadDir = './';
|
||||||
|
}
|
||||||
if (Util.isDesktop()) {
|
if (Util.isDesktop()) {
|
||||||
downloadDir = (await getDownloadsDirectory())!.path;
|
downloadDir = (await getDownloadsDirectory())!.path;
|
||||||
}
|
}
|
||||||
@@ -69,6 +68,7 @@ class Setting {
|
|||||||
downloadDir: downloadDir,
|
downloadDir: downloadDir,
|
||||||
extra: {
|
extra: {
|
||||||
'themeMode': themeMode.name,
|
'themeMode': themeMode.name,
|
||||||
|
'locale': locale,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
await putConfig(config);
|
await putConfig(config);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:file_selector/file_selector.dart';
|
import 'package:file_selector/file_selector.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:gopeed/util/util.dart';
|
||||||
|
|
||||||
import '../util/mac_secure_util.dart';
|
import '../util/mac_secure_util.dart';
|
||||||
|
|
||||||
@@ -23,29 +24,31 @@ class _DirectorySelectorState extends State<DirectorySelector> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
readOnly: true,
|
readOnly: Util.isWeb() ? false : true,
|
||||||
controller: widget.controller,
|
controller: widget.controller,
|
||||||
decoration: widget.showLabel
|
decoration: widget.showLabel
|
||||||
? const InputDecoration(
|
? InputDecoration(
|
||||||
labelText: "下载目录",
|
labelText: 'setting.downloadDir'.tr,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
validator: (v) {
|
validator: (v) {
|
||||||
return v!.trim().isNotEmpty ? null : "请选择下载目录";
|
return v!.trim().isNotEmpty ? null : 'setting.downloadDirValid'.tr;
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
IconButton(
|
!Util.isDesktop()
|
||||||
icon: const Icon(Icons.folder_open),
|
? null
|
||||||
onPressed: () async {
|
: IconButton(
|
||||||
if (GetPlatform.isDesktop) {
|
icon: const Icon(Icons.folder_open),
|
||||||
var dir = await getDirectoryPath();
|
onPressed: () async {
|
||||||
if (dir != null) {
|
if (GetPlatform.isDesktop) {
|
||||||
widget.controller.text = dir;
|
var dir = await getDirectoryPath();
|
||||||
MacSecureUtil.saveBookmark(dir);
|
if (dir != null) {
|
||||||
}
|
widget.controller.text = dir;
|
||||||
}
|
MacSecureUtil.saveBookmark(dir);
|
||||||
})
|
}
|
||||||
],
|
}
|
||||||
|
})
|
||||||
|
].where((e) => e != null).map((e) => e!).toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import '../util/util.dart';
|
import '../util/util.dart';
|
||||||
|
|
||||||
import '../api/model/resource.dart';
|
import '../api/model/resource.dart';
|
||||||
@@ -29,7 +30,8 @@ class _FileListViewState extends State<FileListView> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const Padding(padding: EdgeInsets.only(top: 10)),
|
const Padding(padding: EdgeInsets.only(top: 10)),
|
||||||
Text("选择文件", style: TextStyle(color: themeData.hintColor)),
|
Text('create.selectDir'.tr,
|
||||||
|
style: TextStyle(color: themeData.hintColor)),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.only(top: 10),
|
margin: const EdgeInsets.only(top: 10),
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
//
|
|
||||||
// Generated file. Do not edit.
|
|
||||||
//
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
|
||||||
|
|
||||||
#include <file_selector_linux/file_selector_plugin.h>
|
|
||||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
|
||||||
|
|
||||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
|
||||||
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
|
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
|
|
||||||
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
|
|
||||||
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
|
||||||
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
//
|
|
||||||
// Generated file. Do not edit.
|
|
||||||
//
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
|
|
||||||
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
|
||||||
#define GENERATED_PLUGIN_REGISTRANT_
|
|
||||||
|
|
||||||
#include <flutter_linux/flutter_linux.h>
|
|
||||||
|
|
||||||
// Registers Flutter plugins.
|
|
||||||
void fl_register_plugins(FlPluginRegistry* registry);
|
|
||||||
|
|
||||||
#endif // GENERATED_PLUGIN_REGISTRANT_
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#
|
|
||||||
# Generated file, do not edit.
|
|
||||||
#
|
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
|
||||||
file_selector_linux
|
|
||||||
url_launcher_linux
|
|
||||||
)
|
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
|
||||||
)
|
|
||||||
|
|
||||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
|
||||||
|
|
||||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
|
||||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
|
|
||||||
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
|
|
||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
|
||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
|
||||||
endforeach(plugin)
|
|
||||||
|
|
||||||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
|
||||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
|
|
||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
|
||||||
endforeach(ffi_plugin)
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
//
|
|
||||||
// Generated file. Do not edit.
|
|
||||||
//
|
|
||||||
|
|
||||||
import FlutterMacOS
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
import file_selector_macos
|
|
||||||
import macos_secure_bookmarks
|
|
||||||
import path_provider_macos
|
|
||||||
import shared_preferences_macos
|
|
||||||
import url_launcher_macos
|
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
|
||||||
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
|
||||||
SecureBookmarksPlugin.register(with: registry.registrar(forPlugin: "SecureBookmarksPlugin"))
|
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
|
||||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
|
||||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
PODS:
|
PODS:
|
||||||
|
- desktop_drop (0.0.1):
|
||||||
|
- FlutterMacOS
|
||||||
- file_selector_macos (0.0.1):
|
- file_selector_macos (0.0.1):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- FlutterMacOS (1.0.0)
|
- FlutterMacOS (1.0.0)
|
||||||
@@ -12,6 +14,7 @@ PODS:
|
|||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
|
- desktop_drop (from `Flutter/ephemeral/.symlinks/plugins/desktop_drop/macos`)
|
||||||
- file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`)
|
- file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`)
|
||||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||||
- macos_secure_bookmarks (from `Flutter/ephemeral/.symlinks/plugins/macos_secure_bookmarks/macos`)
|
- macos_secure_bookmarks (from `Flutter/ephemeral/.symlinks/plugins/macos_secure_bookmarks/macos`)
|
||||||
@@ -20,6 +23,8 @@ DEPENDENCIES:
|
|||||||
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
|
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
|
desktop_drop:
|
||||||
|
:path: Flutter/ephemeral/.symlinks/plugins/desktop_drop/macos
|
||||||
file_selector_macos:
|
file_selector_macos:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos
|
||||||
FlutterMacOS:
|
FlutterMacOS:
|
||||||
@@ -34,6 +39,7 @@ EXTERNAL SOURCES:
|
|||||||
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
|
desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898
|
||||||
file_selector_macos: f1b08a781e66103e3ba279fd5d4024a2478b3af6
|
file_selector_macos: f1b08a781e66103e3ba279fd5d4024a2478b3af6
|
||||||
FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811
|
FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811
|
||||||
macos_secure_bookmarks: cff041c4b377fa00941bb901aaec4d27fac5edf2
|
macos_secure_bookmarks: cff041c4b377fa00941bb901aaec4d27fac5edf2
|
||||||
|
|||||||
@@ -183,6 +183,13 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.4"
|
version: "2.2.4"
|
||||||
|
desktop_drop:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: desktop_drop
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.3.3"
|
||||||
dio:
|
dio:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ dependencies:
|
|||||||
permission_handler: ^10.1.0
|
permission_handler: ^10.1.0
|
||||||
external_path: ^1.0.3
|
external_path: ^1.0.3
|
||||||
logger: ^1.1.0
|
logger: ^1.1.0
|
||||||
|
desktop_drop: ^0.3.3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
//
|
|
||||||
// Generated file. Do not edit.
|
|
||||||
//
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
|
||||||
|
|
||||||
#include <file_selector_windows/file_selector_windows.h>
|
|
||||||
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
|
||||||
#include <url_launcher_windows/url_launcher_windows.h>
|
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
|
||||||
FileSelectorWindowsRegisterWithRegistrar(
|
|
||||||
registry->GetRegistrarForPlugin("FileSelectorWindows"));
|
|
||||||
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
|
||||||
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
|
||||||
UrlLauncherWindowsRegisterWithRegistrar(
|
|
||||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
//
|
|
||||||
// Generated file. Do not edit.
|
|
||||||
//
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
|
|
||||||
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
|
||||||
#define GENERATED_PLUGIN_REGISTRANT_
|
|
||||||
|
|
||||||
#include <flutter/plugin_registry.h>
|
|
||||||
|
|
||||||
// Registers Flutter plugins.
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry);
|
|
||||||
|
|
||||||
#endif // GENERATED_PLUGIN_REGISTRANT_
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#
|
|
||||||
# Generated file, do not edit.
|
|
||||||
#
|
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
|
||||||
file_selector_windows
|
|
||||||
permission_handler_windows
|
|
||||||
url_launcher_windows
|
|
||||||
)
|
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
|
||||||
)
|
|
||||||
|
|
||||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
|
||||||
|
|
||||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
|
||||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
|
|
||||||
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
|
|
||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
|
||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
|
||||||
endforeach(plugin)
|
|
||||||
|
|
||||||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
|
||||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
|
|
||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
|
||||||
endforeach(ffi_plugin)
|
|
||||||
Reference in new issue
Block a user