Skip to content

Commit 19e840f

Browse files
committed
build: 2.5.32
0 parents  commit 19e840f

18 files changed

+399
-0
lines changed

.editorconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This file is for unifying the coding style for different editors and IDEs.
2+
# More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 2
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.go]
18+
indent_style = tab

.github/workflows/build.yml

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- '*'
8+
9+
env:
10+
# don't auto-upgrade the gotoolchain
11+
# https://github.com/docker-library/golang/issues/472
12+
GOTOOLCHAIN: local
13+
14+
jobs:
15+
run:
16+
runs-on: windows-latest
17+
env:
18+
GO_VERSION: '1.21'
19+
NODE_VERSION: '16'
20+
JAVA_VERSION: '11'
21+
ANT_VERSION: '1.10.8'
22+
JAVA_TOOL_OPTIONS: '-Dfile.encoding=UTF8'
23+
steps:
24+
-
25+
name: Checkout
26+
uses: actions/checkout@v4
27+
-
28+
name: Set up Go
29+
uses: actions/setup-go@v5
30+
with:
31+
go-version: ${{ env.GO_VERSION }}
32+
cache: true
33+
-
34+
name: Set up Node
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: ${{ env.NODE_VERSION }}
38+
-
39+
name: Set up Java
40+
uses: actions/setup-java@v4
41+
with:
42+
distribution: adopt
43+
java-version: ${{ env.JAVA_VERSION }}
44+
-
45+
name: Set up ANT
46+
run: |
47+
choco install ant --no-progress --force -y --version $Env:ANT_VERSION
48+
$Env:PATH = "C:\ProgramData\chocolatey\lib\ant\tools\apache-ant-$Env:ANT_VERSION\bin;$Env:PATH"
49+
echo "ANT_HOME=C:\ProgramData\chocolatey\lib\ant\tools\apache-ant-$Env:ANT_VERSION" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
50+
-
51+
name: Java version
52+
run: |
53+
java -XshowSettings:properties -version
54+
-
55+
name: ANT version
56+
run: |
57+
ant -version
58+
-
59+
name: Node version
60+
run: |
61+
node --version
62+
-
63+
name: Config
64+
run: |
65+
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
66+
echo "$(go env GOPATH)/bin/windows_386" >> $GITHUB_PATH
67+
68+
echo "PORTAPPS_VERSION=$(cat go.mod | grep github.com/portapps/portapps | awk '{print $NF}')" >> $GITHUB_ENV
69+
echo "PORTAPPS_DIR=./.portapps" >> $GITHUB_ENV
70+
71+
if [[ $GITHUB_REF == refs/tags/* ]]; then
72+
echo "GIT_TAGNAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
73+
fi
74+
shell: bash
75+
-
76+
name: Checkout core
77+
uses: actions/checkout@v4
78+
with:
79+
repository: portapps/portapps
80+
ref: ${{ env.PORTAPPS_VERSION }}
81+
path: ${{ env.PORTAPPS_DIR }}
82+
-
83+
name: Cache Portapps bin
84+
uses: actions/cache@v4
85+
with:
86+
path: ${{ env.PORTAPPS_DIR }}/bin
87+
key: portapps-bin-${{ env.PORTAPPS_VERSION }}
88+
-
89+
name: Build
90+
run: |
91+
ant release -Dcore.dir=${{ env.PORTAPPS_DIR }}
92+
shell: bash
93+
-
94+
name: Upload assets
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: ${{ github.event.repository.name }}
98+
path: bin/release/*
99+
-
100+
name: GitHub Release
101+
uses: crazy-max/ghaction-github-release@v2
102+
if: startsWith(github.ref, 'refs/tags/')
103+
with:
104+
draft: true
105+
files: |
106+
bin/release/*
107+
name: ${{ env.GIT_TAGNAME }}
108+
token: ${{ secrets.REPO_TOKEN }}
109+
-
110+
name: Dump context
111+
if: always()
112+
uses: crazy-max/ghaction-dump-context@v2

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Intellij
2+
/.idea
3+
/*.iml
4+
5+
# App
6+
/.dev
7+
/bin
8+
/vendor
9+
/*.syso
10+
/*.exe
11+
/versioninfo.json
12+
/package-lock.json

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 2.5.32-1 (2024/06/24)
4+
5+
* Initial version based on Apifox 2.5.32

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 ptma
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## About
2+
3+
本项目为 Apifox 便携版打包工程,使用 🚀 [Portapps](https://github.com/portapps/portapps) 制作,制作过程不会篡改 Apifox 应用中的任何文件。
4+
5+
Apifox 官网: https://www.apifox.com/

build.properties

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Portapps
2+
core.dir = ../portapps
3+
4+
# App
5+
app = apifox
6+
app.name = Apifox
7+
app.type = archive
8+
app.version = 2.5.32
9+
app.release = 1
10+
app.homepage = https://www.apifox.com/
11+
12+
# Portable app
13+
papp.id = ${app}-portable
14+
papp.guid = {9BC9D4F6-AB7F-4732-BF49-1369789D22ED}
15+
papp.name = ${app.name} Portable
16+
papp.desc = ${app.name} portable on Windows
17+
papp.url = https://github.com/PortableApplications/${papp.id}
18+
papp.folder = app
19+
20+
# Official artifacts
21+
atf.id = apifox
22+
atf.win64.filename = Apifox-windows-latest
23+
atf.win64.ext = .zip
24+
atf.win64.url = https://file-assets.apifox.com/download/Apifox-windows-latest.zip
25+
atf.win64.assertextract = Apifox-${app.version}.exe

build.xml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project name="apifox" basedir=".">
3+
4+
<dirname property="app.basedir" file="${ant.file.apifox}"/>
5+
<property name="build.properties" value="${app.basedir}/build.properties"/>
6+
<property file="${build.properties}"/>
7+
8+
<!-- Load Portapps core build -->
9+
<property name="core.basedir" location="${app.basedir}\${core.dir}"/>
10+
<fail unless="core.basedir" message="Core directory '${core.basedir}' not found in ${core.basedir}"/>
11+
<echo message="Core found in ${core.basedir}" level="debug"/>
12+
13+
<!-- Import build-app.xml -->
14+
<import file="${core.basedir}\.build\build-app.xml"/>
15+
16+
<!-- Targets -->
17+
<target name="release" depends="release.app" description="Release"/>
18+
19+
<target name="prepare" depends="load.lib.asar">
20+
<echo message="Preparing release..."/>
21+
22+
<echo message="Extracting ${atf.assertextract}..."/>
23+
<sevenzip-x src="${extract.path}\${atf.assertextract}" dest="${extract.path}" overwrite="${archive.extract.overwrite}"/>
24+
25+
<echo message="Extracting embedded ${atf.arch} archive"/>
26+
<property name="extract.path2" value="${tmp.path}\extract2"/>
27+
<if>
28+
<equals arg1="${atf.arch}" arg2="win32"/>
29+
<then>
30+
<sevenzip-ax src="${extract.path}\$PLUGINSDIR\app-32.7z" dest="${extract.path2}"/>
31+
</then>
32+
<else>
33+
<sevenzip-ax src="${extract.path}\$PLUGINSDIR\app-64.7z" dest="${extract.path2}"/>
34+
</else>
35+
</if>
36+
<delete dir="${extract.path}"/>
37+
<move todir="${extract.path}">
38+
<fileset dir="${extract.path2}" defaultexcludes="no"/>
39+
</move>
40+
</target>
41+
42+
</project>

go.mod

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module github.com/portapps/apifox-portable
2+
3+
go 1.21
4+
5+
require github.com/portapps/portapps/v3 v3.10.0
6+
7+
require (
8+
github.com/akavel/rsrc v0.10.2 // indirect
9+
github.com/ilya1st/rotatewriter v0.0.0-20171126183947-3df0c1a3ed6d // indirect
10+
github.com/josephspurrier/goversioninfo v1.4.0 // indirect
11+
github.com/mattn/go-colorable v0.1.13 // indirect
12+
github.com/mattn/go-isatty v0.0.19 // indirect
13+
github.com/mitchellh/mapstructure v1.5.0 // indirect
14+
github.com/pkg/errors v0.9.1 // indirect
15+
github.com/rs/zerolog v1.32.0 // indirect
16+
golang.org/x/sys v0.18.0 // indirect
17+
gopkg.in/yaml.v3 v3.0.1 // indirect
18+
)

go.sum

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw=
2+
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
3+
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
4+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
6+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7+
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
8+
github.com/ilya1st/rotatewriter v0.0.0-20171126183947-3df0c1a3ed6d h1:OGuVAVny/97zsQ5BWg0mOjzTBBD9zR+Lug1co144+rU=
9+
github.com/ilya1st/rotatewriter v0.0.0-20171126183947-3df0c1a3ed6d/go.mod h1:S1q6q+21PRGd0WRX+fHjQ+TOe3CgpSv7zgCWnZcbxCs=
10+
github.com/josephspurrier/goversioninfo v1.4.0 h1:Puhl12NSHUSALHSuzYwPYQkqa2E1+7SrtAPJorKK0C8=
11+
github.com/josephspurrier/goversioninfo v1.4.0/go.mod h1:JWzv5rKQr+MmW+LvM412ToT/IkYDZjaclF2pKDss8IY=
12+
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
13+
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
14+
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
15+
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
16+
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
17+
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
18+
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
19+
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
20+
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
21+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
22+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
23+
github.com/portapps/portapps/v3 v3.10.0 h1:wrJrzoog3n8TMp7XiYpN279mDxLziwrTDklchGvCkhU=
24+
github.com/portapps/portapps/v3 v3.10.0/go.mod h1:u5eNDI5dB3/vaejW/X3oPvYYlfjErIgTsabJvsXybOU=
25+
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
26+
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
27+
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
28+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
29+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
30+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
31+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
32+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
33+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
34+
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
35+
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
36+
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
37+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
38+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
39+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
40+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
41+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

main.go

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
//go:generate go install -v github.com/josephspurrier/goversioninfo/cmd/goversioninfo
2+
//go:generate goversioninfo -icon=res/papp.ico -manifest=res/papp.manifest
3+
package main
4+
5+
import (
6+
"os"
7+
"path"
8+
9+
"github.com/portapps/portapps/v3"
10+
"github.com/portapps/portapps/v3/pkg/log"
11+
"github.com/portapps/portapps/v3/pkg/utl"
12+
)
13+
14+
type config struct {
15+
Cleanup bool `yaml:"cleanup" mapstructure:"cleanup"`
16+
}
17+
18+
var (
19+
app *portapps.App
20+
cfg *config
21+
)
22+
23+
func init() {
24+
var err error
25+
26+
// Default config
27+
cfg = &config{
28+
Cleanup: false,
29+
}
30+
31+
// Init app
32+
if app, err = portapps.NewWithCfg("apifox-portable", "Apifox", cfg); err != nil {
33+
log.Fatal().Err(err).Msg("Cannot initialize application. See log file for more info.")
34+
}
35+
}
36+
37+
func main() {
38+
utl.CreateFolder(app.DataPath)
39+
app.Process = utl.PathJoin(app.AppPath, "Apifox.exe")
40+
app.Args = []string{
41+
"--user-data-dir=" + app.DataPath,
42+
}
43+
44+
// Cleanup on exit
45+
if cfg.Cleanup {
46+
defer func() {
47+
utl.Cleanup([]string{
48+
path.Join(os.Getenv("APPDATA"), "apifox"),
49+
})
50+
}()
51+
}
52+
53+
configFile := utl.PathJoin(app.DataPath, "config.yaml")
54+
if !utl.Exists(configFile) {
55+
log.Info().Msg("Creating default config...")
56+
if err := utl.WriteToFile(configFile, `enableAutomaticUpdates: false`); err != nil {
57+
log.Error().Err(err).Msg("Cannot write default config")
58+
}
59+
}
60+
if err := utl.ReplaceByPrefix(configFile, "enableAutomaticUpdates:", "enableAutomaticUpdates: false"); err != nil {
61+
log.Fatal().Err(err).Msg("Cannot set enableAutomaticUpdates property")
62+
}
63+
64+
defer app.Close()
65+
app.Launch(os.Args[1:])
66+
}

res/app.ico

73 KB
Binary file not shown.

res/papp.ico

73 KB
Binary file not shown.

0 commit comments

Comments
 (0)