Varied macOS fixes (#2044)

* Fix selects, fix ffprobe download, fix baseurl in dev server
This commit is contained in:
kermieisinthehouse 2021-11-21 17:44:24 -08:00 committed by GitHub
parent 7f94165769
commit 27c0fc8a18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 11 deletions

View file

@ -175,7 +175,7 @@ ui-start: pre-build
$(SET) VITE_APP_DATE="$(BUILD_DATE)" $(SEPARATOR) \ $(SET) VITE_APP_DATE="$(BUILD_DATE)" $(SEPARATOR) \
$(SET) VITE_APP_GITHASH=$(GITHASH) $(SEPARATOR) \ $(SET) VITE_APP_GITHASH=$(GITHASH) $(SEPARATOR) \
$(SET) VITE_APP_STASH_VERSION=$(STASH_VERSION) $(SEPARATOR) \ $(SET) VITE_APP_STASH_VERSION=$(STASH_VERSION) $(SEPARATOR) \
cd ui/v2.5 && yarn start cd ui/v2.5 && yarn start --host
.PHONY: fmt-ui .PHONY: fmt-ui
fmt-ui: fmt-ui:

View file

@ -44,6 +44,15 @@ func Download(ctx context.Context, configDirectory string) error {
return err return err
} }
} }
// validate that the urls contained what we needed
executables := []string{"ffmpeg", "ffprobe"}
for _, executable := range executables {
_, err := os.Stat(filepath.Join(configDirectory, executable))
if err != nil {
return err
}
}
return nil return nil
} }
@ -76,7 +85,6 @@ func DownloadSingle(ctx context.Context, configDirectory, url string) error {
} }
// Configure where we want to download the archive // Configure where we want to download the archive
urlExt := path.Ext(url)
urlBase := path.Base(url) urlBase := path.Base(url)
archivePath := filepath.Join(configDirectory, urlBase) archivePath := filepath.Join(configDirectory, urlBase)
_ = os.Remove(archivePath) // remove archive if it already exists _ = os.Remove(archivePath) // remove archive if it already exists
@ -118,7 +126,7 @@ func DownloadSingle(ctx context.Context, configDirectory, url string) error {
logger.Info("Downloading complete") logger.Info("Downloading complete")
if urlExt == ".zip" { if resp.Header.Get("Content-Type") == "application/zip" {
logger.Infof("Unzipping %s...", archivePath) logger.Infof("Unzipping %s...", archivePath)
if err := unzip(archivePath, configDirectory); err != nil { if err := unzip(archivePath, configDirectory); err != nil {
return err return err
@ -126,12 +134,18 @@ func DownloadSingle(ctx context.Context, configDirectory, url string) error {
// On OSX or Linux set downloaded files permissions // On OSX or Linux set downloaded files permissions
if runtime.GOOS == "darwin" || runtime.GOOS == "linux" { if runtime.GOOS == "darwin" || runtime.GOOS == "linux" {
if err := os.Chmod(filepath.Join(configDirectory, "ffmpeg"), 0755); err != nil { _, err = os.Stat(filepath.Join(configDirectory, "ffmpeg"))
return err if !os.IsNotExist(err) {
if err = os.Chmod(filepath.Join(configDirectory, "ffmpeg"), 0755); err != nil {
return err
}
} }
if err := os.Chmod(filepath.Join(configDirectory, "ffprobe"), 0755); err != nil { _, err = os.Stat(filepath.Join(configDirectory, "ffprobe"))
return err if !os.IsNotExist(err) {
if err := os.Chmod(filepath.Join(configDirectory, "ffprobe"), 0755); err != nil {
return err
}
} }
// TODO: In future possible clear xattr to allow running on osx without user intervention // TODO: In future possible clear xattr to allow running on osx without user intervention
@ -139,8 +153,6 @@ func DownloadSingle(ctx context.Context, configDirectory, url string) error {
// xattr -c /path/to/binary -- xattr.Remove(path, "com.apple.quarantine") // xattr -c /path/to/binary -- xattr.Remove(path, "com.apple.quarantine")
} }
logger.Infof("ffmpeg and ffprobe successfully installed in %s", configDirectory)
} else { } else {
return fmt.Errorf("ffmpeg was downloaded to %s", archivePath) return fmt.Errorf("ffmpeg was downloaded to %s", archivePath)
} }
@ -152,7 +164,7 @@ func getFFMPEGURL() []string {
var urls []string var urls []string
switch runtime.GOOS { switch runtime.GOOS {
case "darwin": case "darwin":
urls = []string{"https://evermeet.cx/ffmpeg/ffmpeg-4.3.1.zip", "https://evermeet.cx/ffmpeg/ffprobe-4.3.1.zip"} urls = []string{"https://evermeet.cx/ffmpeg/getrelease/zip", "https://evermeet.cx/ffmpeg/getrelease/ffprobe/zip"}
case "linux": case "linux":
switch runtime.GOARCH { switch runtime.GOARCH {
case "amd64": case "amd64":

View file

@ -83,7 +83,7 @@ const typePolicies: TypePolicies = {
export const getBaseURL = () => { export const getBaseURL = () => {
const baseURL = window.STASH_BASE_URL; const baseURL = window.STASH_BASE_URL;
if (baseURL === "%BASE_URL%") return "/"; if (baseURL === "/%BASE_URL%/") return "/";
return baseURL; return baseURL;
}; };

View file

@ -743,3 +743,11 @@ dl.details-list {
grid-column-gap: 10px; grid-column-gap: 10px;
grid-template-columns: minmax(16.67%, auto) 1fr; grid-template-columns: minmax(16.67%, auto) 1fr;
} }
// Fix Safari styling on dropdowns
select {
-webkit-appearance: none;
appearance: none;
background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4.95 10' fill='%23fff'><polygon points='1.41 4.67 2.48 3.18 3.54 4.67 1.41 4.67'/><polygon points='3.54 5.33 2.48 6.82 1.41 5.33 3.54 5.33'/></svg>")
no-repeat right 2px center;
}