mirror of
https://github.com/majd/ipatool
synced 2026-11-28 02:07:52 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56cc64fcef | ||
|
|
7813e78e3c | ||
|
|
50a1e546ef | ||
|
|
094ff93693 | ||
|
|
5d014266e3 | ||
|
|
8dd1a8508d |
No files matched your search
@@ -114,6 +114,9 @@ jobs:
|
||||
- run: tar -czvf $BIN.tar.gz bin/$BIN
|
||||
env:
|
||||
BIN: ipatool-${{ needs.get_version.outputs.version }}-${{ matrix.os }}-${{ matrix.arch }}
|
||||
- run: ./tools/sha256sum.sh $TARBALL > $TARBALL.sha256sum
|
||||
env:
|
||||
TARBALL: ipatool-${{ needs.get_version.outputs.version }}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
|
||||
- uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 159 KiB After Width: | Height: | Size: 108 KiB |
@@ -237,7 +237,7 @@ func (a *appstore) resolveDestinationPath(app App, path string) (string, error)
|
||||
file := fmt.Sprintf("/%s_%d_v%s_%d.ipa", app.BundleID, app.ID, app.Version, util.RandInt(100, 999))
|
||||
|
||||
if path == "" {
|
||||
workdir, err := a.currentDirectory()
|
||||
workdir, err := a.os.Getwd()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, ErrGetCurrentDirectory.Error())
|
||||
}
|
||||
@@ -257,15 +257,6 @@ func (a *appstore) resolveDestinationPath(app App, path string) (string, error)
|
||||
return path, nil
|
||||
}
|
||||
|
||||
func (a *appstore) currentDirectory() (string, error) {
|
||||
path, err := a.os.Executable()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, ErrGetExecutablePath.Error())
|
||||
}
|
||||
|
||||
return filepath.Dir(path), nil
|
||||
}
|
||||
|
||||
func (a *appstore) isDirectory(path string) (bool, error) {
|
||||
info, err := a.os.Stat(path)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
@@ -377,7 +368,9 @@ func (a *appstore) replicateZip(src *zip.ReadCloser, dst *zip.Writer, info *byte
|
||||
return "", errors.Wrap(err, ErrDecompressInfoFile.Error())
|
||||
}
|
||||
|
||||
appBundle = filepath.Base(strings.TrimSuffix(file.Name, ".app/Info.plist"))
|
||||
if !strings.Contains(file.Name, "/Watch/") {
|
||||
appBundle = filepath.Base(strings.TrimSuffix(file.Name, ".app/Info.plist"))
|
||||
}
|
||||
|
||||
_, err = io.Copy(info, srcFileD)
|
||||
if err != nil {
|
||||
|
||||
@@ -150,7 +150,7 @@ var _ = Describe("AppStore (Download)", func() {
|
||||
}, nil)
|
||||
|
||||
mockOS.EXPECT().
|
||||
Executable().
|
||||
Getwd().
|
||||
Return("", nil)
|
||||
|
||||
mockMachine.EXPECT().
|
||||
@@ -181,7 +181,7 @@ var _ = Describe("AppStore (Download)", func() {
|
||||
}, nil)
|
||||
|
||||
mockOS.EXPECT().
|
||||
Executable().
|
||||
Getwd().
|
||||
Return("", nil)
|
||||
|
||||
mockMachine.EXPECT().
|
||||
@@ -220,7 +220,7 @@ var _ = Describe("AppStore (Download)", func() {
|
||||
}, nil)
|
||||
|
||||
mockOS.EXPECT().
|
||||
Executable().
|
||||
Getwd().
|
||||
Return("", nil)
|
||||
|
||||
mockMachine.EXPECT().
|
||||
@@ -307,7 +307,7 @@ var _ = Describe("AppStore (Download)", func() {
|
||||
}, nil)
|
||||
|
||||
mockOS.EXPECT().
|
||||
Executable().
|
||||
Getwd().
|
||||
Return("", nil)
|
||||
|
||||
mockMachine.EXPECT().
|
||||
@@ -408,7 +408,7 @@ var _ = Describe("AppStore (Download)", func() {
|
||||
}, nil)
|
||||
|
||||
mockOS.EXPECT().
|
||||
Executable().
|
||||
Getwd().
|
||||
Return("", nil)
|
||||
|
||||
mockMachine.EXPECT().
|
||||
@@ -474,7 +474,7 @@ var _ = Describe("AppStore (Download)", func() {
|
||||
}, nil)
|
||||
|
||||
mockOS.EXPECT().
|
||||
Executable().
|
||||
Getwd().
|
||||
Return("", nil)
|
||||
|
||||
mockMachine.EXPECT().
|
||||
@@ -518,7 +518,7 @@ var _ = Describe("AppStore (Download)", func() {
|
||||
}, nil)
|
||||
|
||||
mockOS.EXPECT().
|
||||
Executable().
|
||||
Getwd().
|
||||
Return("", nil)
|
||||
|
||||
mockMachine.EXPECT().
|
||||
@@ -690,7 +690,7 @@ var _ = Describe("AppStore (Download)", func() {
|
||||
|
||||
It("writes data to file", func() {
|
||||
mockOS.EXPECT().
|
||||
Executable().
|
||||
Getwd().
|
||||
Return("", nil)
|
||||
|
||||
mockOS.EXPECT().
|
||||
@@ -773,7 +773,7 @@ var _ = Describe("AppStore (Download)", func() {
|
||||
})
|
||||
})
|
||||
|
||||
When("app uses modern FiarPlay protection", func() {
|
||||
When("app uses modern FairPlay protection", func() {
|
||||
BeforeEach(func() {
|
||||
zipFile = zip.NewWriter(tmpFile)
|
||||
w, err := zipFile.Create("Payload/Test.app/SC_Info/Manifest.plist")
|
||||
@@ -810,6 +810,68 @@ var _ = Describe("AppStore (Download)", func() {
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
})
|
||||
|
||||
When("app uses modern FairPlay protection and has Watch app", func() {
|
||||
BeforeEach(func() {
|
||||
zipFile = zip.NewWriter(tmpFile)
|
||||
w, err := zipFile.Create("Payload/Test.app/SC_Info/Manifest.plist")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
manifest, err := plist.Marshal(PackageManifest{
|
||||
SinfPaths: []string{
|
||||
"SC_Info/TestApp.sinf",
|
||||
},
|
||||
}, plist.BinaryFormat)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
_, err = w.Write(manifest)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
w, err = zipFile.Create("Payload/Test.app/Info.plist")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
info, err := plist.Marshal(map[string]interface{}{
|
||||
"CFBundleExecutable": "Test",
|
||||
}, plist.BinaryFormat)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
_, err = w.Write(info)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
w, err = zipFile.Create("Payload/Test.app/Watch/Test Watch App.app/Info.plist")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
watchInfo, err := plist.Marshal(map[string]interface{}{
|
||||
"WKWatchKitApp": true,
|
||||
}, plist.BinaryFormat)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
_, err = w.Write(watchInfo)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
err = zipFile.Close()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("sinf is in the correct path", func() {
|
||||
outputPath := strings.TrimSuffix(tmpFile.Name(), ".tmp")
|
||||
err := as.Download("", outputPath, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
r, err := zip.OpenReader(outputPath)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer r.Close()
|
||||
|
||||
found := false
|
||||
for _, f := range r.File {
|
||||
if f.Name == "Payload/Test Watch App.app/SC_Info/TestApp.sinf" {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
Expect(found).To(BeFalse())
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -4,6 +4,7 @@ var StoreFronts = map[string]string{
|
||||
"AE": "143481",
|
||||
"AG": "143540",
|
||||
"AI": "143538",
|
||||
"AL": "143575",
|
||||
"AM": "143524",
|
||||
"AO": "143564",
|
||||
"AR": "143505",
|
||||
@@ -79,6 +80,7 @@ var StoreFronts = map[string]string{
|
||||
"MG": "143531",
|
||||
"MK": "143530",
|
||||
"ML": "143532",
|
||||
"MN": "143592",
|
||||
"MO": "143515",
|
||||
"MS": "143547",
|
||||
"MT": "143521",
|
||||
|
||||
@@ -6,7 +6,7 @@ import "os"
|
||||
type OperatingSystem interface {
|
||||
Getenv(key string) string
|
||||
Stat(name string) (os.FileInfo, error)
|
||||
Executable() (string, error)
|
||||
Getwd() (string, error)
|
||||
OpenFile(name string, flag int, perm os.FileMode) (*os.File, error)
|
||||
Remove(name string) error
|
||||
IsNotExist(err error) bool
|
||||
@@ -27,8 +27,8 @@ func (*operatingSystem) Stat(name string) (os.FileInfo, error) {
|
||||
return os.Stat(name)
|
||||
}
|
||||
|
||||
func (*operatingSystem) Executable() (string, error) {
|
||||
return os.Executable()
|
||||
func (*operatingSystem) Getwd() (string, error) {
|
||||
return os.Getwd()
|
||||
}
|
||||
|
||||
func (*operatingSystem) OpenFile(name string, flag int, perm os.FileMode) (*os.File, error) {
|
||||
|
||||
@@ -34,21 +34,6 @@ func (m *MockOperatingSystem) EXPECT() *MockOperatingSystemMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// Executable mocks base method.
|
||||
func (m *MockOperatingSystem) Executable() (string, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Executable")
|
||||
ret0, _ := ret[0].(string)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Executable indicates an expected call of Executable.
|
||||
func (mr *MockOperatingSystemMockRecorder) Executable() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Executable", reflect.TypeOf((*MockOperatingSystem)(nil).Executable))
|
||||
}
|
||||
|
||||
// Getenv mocks base method.
|
||||
func (m *MockOperatingSystem) Getenv(key string) string {
|
||||
m.ctrl.T.Helper()
|
||||
@@ -63,6 +48,21 @@ func (mr *MockOperatingSystemMockRecorder) Getenv(key interface{}) *gomock.Call
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Getenv", reflect.TypeOf((*MockOperatingSystem)(nil).Getenv), key)
|
||||
}
|
||||
|
||||
// Getwd mocks base method.
|
||||
func (m *MockOperatingSystem) Getwd() (string, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Getwd")
|
||||
ret0, _ := ret[0].(string)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Getwd indicates an expected call of Getwd.
|
||||
func (mr *MockOperatingSystemMockRecorder) Getwd() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Getwd", reflect.TypeOf((*MockOperatingSystem)(nil).Getwd))
|
||||
}
|
||||
|
||||
// IsNotExist mocks base method.
|
||||
func (m *MockOperatingSystem) IsNotExist(err error) bool {
|
||||
m.ctrl.T.Helper()
|
||||
|
||||
@@ -65,9 +65,9 @@ var _ = Describe("Operating System", func() {
|
||||
})
|
||||
})
|
||||
|
||||
When("executing", func() {
|
||||
It("returns executable path", func() {
|
||||
res, err := os.Executable()
|
||||
When("running", func() {
|
||||
It("returns current working directory", func() {
|
||||
res, err := os.Getwd()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(res).ToNot(BeNil())
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user