Skip to content

Commit 0e51418

Browse files
Desktop integration (stashapp#2073)
* Open stash in system tray on Windows/MacOS * Add desktop notifications * MacOS Bundling * Add binary icon Co-authored-by: WithoutPants <[email protected]>
1 parent e48b2ba commit 0e51418

File tree

306 files changed

+29542
-4792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+29542
-4792
lines changed

.github/workflows/build.yml

+9-12
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
env:
16-
COMPILER_IMAGE: stashapp/compiler:5
16+
COMPILER_IMAGE: stashapp/compiler:6
1717

1818
jobs:
1919
build:
@@ -91,12 +91,11 @@ jobs:
9191
- name: Compile for all supported platforms
9292
run: |
9393
docker exec -t build /bin/bash -c "make cross-compile-windows"
94-
docker exec -t build /bin/bash -c "make cross-compile-osx-intel"
95-
docker exec -t build /bin/bash -c "make cross-compile-osx-applesilicon"
94+
docker exec -t build /bin/bash -c "make cross-compile-macos"
9695
docker exec -t build /bin/bash -c "make cross-compile-linux"
9796
docker exec -t build /bin/bash -c "make cross-compile-linux-arm64v8"
9897
docker exec -t build /bin/bash -c "make cross-compile-linux-arm32v7"
99-
docker exec -t build /bin/bash -c "make cross-compile-pi"
98+
docker exec -t build /bin/bash -c "make cross-compile-linux-arm32v6"
10099
101100
- name: Cleanup build container
102101
run: docker rm -f -v build
@@ -121,8 +120,8 @@ jobs:
121120
if: ${{ github.event_name == 'pull_request' && github.base_ref != 'refs/heads/develop' && github.base_ref != 'refs/heads/master'}}
122121
uses: actions/upload-artifact@v2
123122
with:
124-
name: stash-osx
125-
path: dist/stash-osx
123+
name: Stash-macos.zip
124+
path: dist/Stash-macos.zip
126125

127126
- name: Upload Linux binary
128127
# only upload binaries for pull requests
@@ -145,13 +144,12 @@ jobs:
145144
automatic_release_tag: latest_develop
146145
title: "${{ env.STASH_VERSION }}: Latest development build"
147146
files: |
148-
dist/stash-osx
149-
dist/stash-osx-applesilicon
147+
dist/Stash-macos.zip
150148
dist/stash-win.exe
151149
dist/stash-linux
152150
dist/stash-linux-arm64v8
153151
dist/stash-linux-arm32v7
154-
dist/stash-pi
152+
dist/stash-linux-arm32v6
155153
CHECKSUMS_SHA1
156154
157155
- name: Master release
@@ -161,13 +159,12 @@ jobs:
161159
token: "${{ secrets.GITHUB_TOKEN }}"
162160
allow_override: true
163161
files: |
164-
dist/stash-osx
165-
dist/stash-osx-applesilicon
162+
dist/Stash-macos.zip
166163
dist/stash-win.exe
167164
dist/stash-linux
168165
dist/stash-linux-arm64v8
169166
dist/stash-linux-arm32v7
170-
dist/stash-pi
167+
dist/stash-linux-arm32v6
171168
CHECKSUMS_SHA1
172169
gzip: false
173170

.github/workflows/golangci-lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
pull_request:
1010

1111
env:
12-
COMPILER_IMAGE: stashapp/compiler:5
12+
COMPILER_IMAGE: stashapp/compiler:6
1313

1414
jobs:
1515
golangci:

Makefile

+50-27
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
IS_WIN =
1+
IS_WIN_SHELL =
22
ifeq (${SHELL}, sh.exe)
3-
IS_WIN = true
3+
IS_WIN_SHELL = true
44
endif
55
ifeq (${SHELL}, cmd)
6-
IS_WIN = true
6+
IS_WIN_SHELL = true
77
endif
88

9-
ifdef IS_WIN
9+
ifdef IS_WIN_SHELL
1010
SEPARATOR := &&
1111
SET := set
1212
else
1313
SEPARATOR := ;
1414
SET := export
1515
endif
1616

17+
IS_WIN_OS =
18+
ifeq ($(OS),Windows_NT)
19+
IS_WIN_OS = true
20+
endif
21+
1722
# set LDFLAGS environment variable to any extra ldflags required
1823
# set OUTPUT to generate a specific binary name
1924

@@ -46,9 +51,13 @@ ifndef OFFICIAL_BUILD
4651
endif
4752

4853
build: pre-build
54+
ifdef IS_WIN_OS
55+
PLATFORM_SPECIFIC_LDFLAGS := -H windowsgui
56+
endif
57+
build:
4958
$(eval LDFLAGS := $(LDFLAGS) -X 'github.com/stashapp/stash/pkg/api.version=$(STASH_VERSION)' -X 'github.com/stashapp/stash/pkg/api.buildstamp=$(BUILD_DATE)' -X 'github.com/stashapp/stash/pkg/api.githash=$(GITHASH)')
50-
$(eval LDFLAGS := $(LDFLAGS) -X 'github.com/stashapp/stash/pkg/api.officialBuild=$(OFFICIAL_BUILD)')
51-
go build $(OUTPUT) -mod=vendor -v -tags "sqlite_omit_load_extension osusergo netgo" $(GO_BUILD_FLAGS) -ldflags "$(LDFLAGS) $(EXTRA_LDFLAGS)"
59+
$(eval LDFLAGS := $(LDFLAGS) -X 'github.com/stashapp/stash/pkg/manager/config.officialBuild=$(OFFICIAL_BUILD)')
60+
go build $(OUTPUT) -mod=vendor -v -tags "sqlite_omit_load_extension osusergo netgo" $(GO_BUILD_FLAGS) -ldflags "$(LDFLAGS) $(EXTRA_LDFLAGS) $(PLATFORM_SPECIFIC_LDFLAGS)"
5261

5362
# strips debug symbols from the release build
5463
build-release: EXTRA_LDFLAGS := -s -w
@@ -65,23 +74,38 @@ cross-compile-windows: export GOARCH := amd64
6574
cross-compile-windows: export CC := x86_64-w64-mingw32-gcc
6675
cross-compile-windows: export CXX := x86_64-w64-mingw32-g++
6776
cross-compile-windows: OUTPUT := -o dist/stash-win.exe
77+
cross-compile-windows: PLATFORM_SPECIFIC_LDFLAGS := -H windowsgui
6878
cross-compile-windows: build-release-static
6979

70-
cross-compile-osx-intel: export GOOS := darwin
71-
cross-compile-osx-intel: export GOARCH := amd64
72-
cross-compile-osx-intel: export CC := o64-clang
73-
cross-compile-osx-intel: export CXX := o64-clang++
74-
cross-compile-osx-intel: OUTPUT := -o dist/stash-osx
80+
cross-compile-macos-intel: export GOOS := darwin
81+
cross-compile-macos-intel: export GOARCH := amd64
82+
cross-compile-macos-intel: export CC := o64-clang
83+
cross-compile-macos-intel: export CXX := o64-clang++
84+
cross-compile-macos-intel: OUTPUT := -o dist/stash-macos-intel
7585
# can't use static build for OSX
76-
cross-compile-osx-intel: build-release
86+
cross-compile-macos-intel: build-release
7787

78-
cross-compile-osx-applesilicon: export GOOS := darwin
79-
cross-compile-osx-applesilicon: export GOARCH := arm64
80-
cross-compile-osx-applesilicon: export CC := oa64e-clang
81-
cross-compile-osx-applesilicon: export CXX := oa64e-clang++
82-
cross-compile-osx-applesilicon: OUTPUT := -o dist/stash-osx-applesilicon
88+
cross-compile-macos-applesilicon: export GOOS := darwin
89+
cross-compile-macos-applesilicon: export GOARCH := arm64
90+
cross-compile-macos-applesilicon: export CC := oa64e-clang
91+
cross-compile-macos-applesilicon: export CXX := oa64e-clang++
92+
cross-compile-macos-applesilicon: OUTPUT := -o dist/stash-macos-applesilicon
8393
# can't use static build for OSX
84-
cross-compile-osx-applesilicon: build-release
94+
cross-compile-macos-applesilicon: build-release
95+
96+
cross-compile-macos:
97+
rm -rf dist/Stash.app dist/Stash-macos.zip
98+
make cross-compile-macos-applesilicon
99+
make cross-compile-macos-intel
100+
# Combine into one universal binary
101+
lipo -create -output dist/stash-macos-universal dist/stash-macos-intel dist/stash-macos-applesilicon
102+
rm dist/stash-macos-intel dist/stash-macos-applesilicon
103+
# Place into bundle and zip up
104+
cp -R scripts/macos-bundle dist/Stash.app
105+
mkdir dist/Stash.app/Contents/MacOS
106+
mv dist/stash-macos-universal dist/Stash.app/Contents/MacOS/stash
107+
cd dist && zip -r Stash-macos.zip Stash.app && cd ..
108+
rm -rf dist/Stash.app
85109

86110
cross-compile-linux: export GOOS := linux
87111
cross-compile-linux: export GOARCH := amd64
@@ -101,21 +125,20 @@ cross-compile-linux-arm32v7: export CC := arm-linux-gnueabihf-gcc
101125
cross-compile-linux-arm32v7: OUTPUT := -o dist/stash-linux-arm32v7
102126
cross-compile-linux-arm32v7: build-release-static
103127

104-
cross-compile-pi: export GOOS := linux
105-
cross-compile-pi: export GOARCH := arm
106-
cross-compile-pi: export GOARM := 6
107-
cross-compile-pi: export CC := arm-linux-gnueabi-gcc
108-
cross-compile-pi: OUTPUT := -o dist/stash-pi
109-
cross-compile-pi: build-release-static
128+
cross-compile-linux-arm32v6: export GOOS := linux
129+
cross-compile-linux-arm32v6: export GOARCH := arm
130+
cross-compile-linux-arm32v6: export GOARM := 6
131+
cross-compile-linux-arm32v6: export CC := arm-linux-gnueabi-gcc
132+
cross-compile-linux-arm32v6: OUTPUT := -o dist/stash-linux-arm32v6
133+
cross-compile-linux-arm32v6: build-release-static
110134

111135
cross-compile-all:
112136
make cross-compile-windows
113-
make cross-compile-osx-intel
114-
make cross-compile-osx-applesilicon
137+
make cross-compile-macos
115138
make cross-compile-linux
116139
make cross-compile-linux-arm64v8
117140
make cross-compile-linux-arm32v7
118-
make cross-compile-pi
141+
make cross-compile-linux-arm32v6
119142

120143
# Regenerates GraphQL files
121144
generate: generate-backend generate-frontend

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ For further information you can [read the in-app manual](ui/v2.5/src/docs/en).
2222

2323
<img src="docs/readme_assets/windows_logo.svg" width="100%" height="75"> Windows | <img src="docs/readme_assets/mac_logo.svg" width="100%" height="75"> MacOS| <img src="docs/readme_assets/linux_logo.svg" width="100%" height="75"> Linux | <img src="docs/readme_assets/docker_logo.svg" width="100%" height="75"> Docker
2424
:---:|:---:|:---:|:---:
25-
[Latest Release](https://github.com/stashapp/stash/releases/latest/download/stash-win.exe) <br /> <sup><sub>[Development Preview](https://github.com/stashapp/stash/releases/download/latest_develop/stash-win.exe)</sub></sup> | [Latest Release (Apple Silicon)](https://github.com/stashapp/stash/releases/latest/download/stash-osx-applesilicon) <br /> <sup><sub>[Development Preview (Apple Silicon)](https://github.com/stashapp/stash/releases/download/latest_develop/stash-osx-applesilicon)</sub></sup> <br>[Latest Release (Intel)](https://github.com/stashapp/stash/releases/latest/download/stash-osx) <br /> <sup><sub>[Development Preview (Intel)](https://github.com/stashapp/stash/releases/download/latest_develop/stash-osx)</sub></sup> | [Latest Release (amd64)](https://github.com/stashapp/stash/releases/latest/download/stash-linux) <br /> <sup><sub>[Development Preview (amd64)](https://github.com/stashapp/stash/releases/download/latest_develop/stash-linux)</sub></sup> <br /> [More Architectures...](https://github.com/stashapp/stash/releases/latest) | [Instructions](docker/production/README.md) <br /> <sup><sub> [Sample docker-compose.yml](docker/production/docker-compose.yml)</sub></sup>
25+
[Latest Release](https://github.com/stashapp/stash/releases/latest/download/stash-win.exe) <br /> <sup><sub>[Development Preview](https://github.com/stashapp/stash/releases/download/latest_develop/stash-win.exe)</sub></sup> | [Latest Release](https://github.com/stashapp/stash/releases/latest/download/Stash-macos.app.zip) <br /> <sup><sub>[Development Preview](https://github.com/stashapp/stash/releases/download/latest_develop/Stash-macos.app.zip)</sub></sup> | [Latest Release (amd64)](https://github.com/stashapp/stash/releases/latest/download/stash-linux) <br /> <sup><sub>[Development Preview (amd64)](https://github.com/stashapp/stash/releases/download/latest_develop/stash-linux)</sub></sup> <br /> [More Architectures...](https://github.com/stashapp/stash/releases/latest) | [Instructions](docker/production/README.md) <br /> <sup><sub> [Sample docker-compose.yml](docker/production/docker-compose.yml)</sub></sup>
2626

2727
## Getting Started
28-
Run the executable (double click the exe on windows or run `./stash-osx` / `./stash-linux` from the terminal on macOS / Linux) to get started.
28+
Run the executable by double-clicking it.
2929

30-
*Note for Windows users:* Running the app might present a security prompt since the binary isn't yet signed. Bypass this by clicking "more info" and then the "run anyway" button.
30+
*Note for Mac users:* Running the app will present a security prompt since the binary isn't yet signed. Bypass this by right (ctrl) clicking on the app and hitting "Open", then "Open" in the next popup.
31+
32+
*Note for Windows users:* Running the app might present a security prompt since the binary isn't yet signed. Bypass this by clicking "more info" and then the "run anyway" button.
3133

3234
#### FFMPEG
3335
Stash requires ffmpeg. If you don't have it installed, Stash will download a copy for you. It is recommended that Linux users install `ffmpeg` from their distro's package manager.

docker/compiler/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RUN apt-get update && \
2020
gcc-arm-linux-gnueabi libc-dev-armel-cross linux-libc-dev-armel-cross \
2121
gcc-arm-linux-gnueabihf libc-dev-armhf-cross \
2222
gcc-aarch64-linux-gnu libc-dev-arm64-cross \
23-
nodejs yarn --no-install-recommends || exit 1; \
23+
nodejs yarn zip --no-install-recommends || exit 1; \
2424
rm -rf /var/lib/apt/lists/*;
2525

2626
# Cross compile setup

docker/compiler/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
user=stashapp
22
repo=compiler
3-
version=5
3+
version=6
44

55
latest:
66
docker build -t ${user}/${repo}:latest .

docker/compiler/README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
Modified from https://github.com/bep/dockerfiles/tree/master/ci-goreleaser
22

3-
When the dockerfile is changed, the version number should be incremented in the Makefile and the new version tag should be pushed to docker hub. The `scripts/cross-compile.sh` script should also be updated to use the new version number tag, and `.travis.yml` needs to be updated to pull the correct image tag.
4-
5-
A MacOS univeral binary can be created using `lipo -create -output stash-osx-universal stash-osx stash-osx-applesilicon`, available in the image.
3+
When the dockerfile is changed, the version number should be incremented in the Makefile and the new version tag should be pushed to docker hub. The `scripts/cross-compile.sh` script should also be updated to use the new version number tag, and the github workflow files need to be updated to pull the correct image tag.

go.mod

+11-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,20 @@ require (
3838
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
3939
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb
4040
golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9
41-
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf
42-
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
41+
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
42+
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b
4343
golang.org/x/text v0.3.7
4444
golang.org/x/tools v0.1.5 // indirect
4545
gopkg.in/sourcemap.v1 v1.0.5 // indirect
4646
gopkg.in/yaml.v2 v2.4.0
4747
)
4848

4949
require (
50+
github.com/apenwarr/fixconsole v0.0.0-20191012055117-5a9f6489cc29
51+
github.com/go-chi/httplog v0.2.1
52+
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4
53+
github.com/kermieisinthehouse/gosx-notifier v0.1.1
54+
github.com/kermieisinthehouse/systray v1.2.3
5055
github.com/lucasb-eyer/go-colorful v1.2.0
5156
github.com/vearutop/statigz v1.1.6
5257
github.com/vektah/gqlparser/v2 v2.0.1
@@ -55,10 +60,12 @@ require (
5560
require (
5661
github.com/agnivade/levenshtein v1.1.0 // indirect
5762
github.com/antchfx/xpath v1.2.0 // indirect
63+
github.com/apenwarr/w32 v0.0.0-20190407065021-aa00fece76ab // indirect
5864
github.com/chromedp/sysutil v1.0.0 // indirect
5965
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
6066
github.com/davecgh/go-spew v1.1.1 // indirect
6167
github.com/fsnotify/fsnotify v1.5.1 // indirect
68+
github.com/go-chi/chi/v5 v5.0.0 // indirect
6269
github.com/gobwas/httphead v0.1.0 // indirect
6370
github.com/gobwas/pool v0.2.1 // indirect
6471
github.com/gobwas/ws v1.1.0-rc.5 // indirect
@@ -77,10 +84,11 @@ require (
7784
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
7885
github.com/modern-go/reflect2 v1.0.1 // indirect
7986
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
87+
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
8088
github.com/pelletier/go-toml v1.9.4 // indirect
8189
github.com/pkg/errors v0.9.1 // indirect
8290
github.com/pmezard/go-difflib v1.0.0 // indirect
83-
github.com/rs/zerolog v1.18.0 // indirect
91+
github.com/rs/zerolog v1.18.1-0.20200514152719-663cbb4c8469 // indirect
8492
github.com/russross/blackfriday/v2 v2.0.1 // indirect
8593
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
8694
github.com/spf13/cast v1.4.1 // indirect

0 commit comments

Comments
 (0)