From 42041753a31ed7aea111d1cbf69f5e65c0f856f5 Mon Sep 17 00:00:00 2001 From: toshski <104477758+toshski@users.noreply.github.com> Date: Wed, 28 Aug 2024 21:18:35 +1200 Subject: [PATCH] Open In New Window Links (#1827) --- pkg/api/options.go | 34 +++++------ pkg/config/config.go | 33 +++++------ pkg/config/state.go | 33 +++++------ ui/src/store/optionsWeb.js | 5 +- ui/src/views/actors/ActorDetails.vue | 21 ++++++- .../views/options/sections/InterfaceWeb.vue | 13 +++++ ui/src/views/scenes/Details.vue | 56 ++++++++++++++++--- 7 files changed, 138 insertions(+), 57 deletions(-) diff --git a/pkg/api/options.go b/pkg/api/options.go index 543c670a1..a50417ac8 100644 --- a/pkg/api/options.go +++ b/pkg/api/options.go @@ -43,22 +43,23 @@ type VersionCheckResponse struct { } type RequestSaveOptionsWeb struct { - TagSort string `json:"tagSort"` - SceneHidden bool `json:"sceneHidden"` - SceneWatchlist bool `json:"sceneWatchlist"` - SceneFavourite bool `json:"sceneFavourite"` - SceneWishlist bool `json:"sceneWishlist"` - SceneWatched bool `json:"sceneWatched"` - SceneEdit bool `json:"sceneEdit"` - SceneDuration bool `json:"sceneDuration"` - SceneCuepoint bool `json:"sceneCuepoint"` - ShowHspFile bool `json:"showHspFile"` - ShowSubtitlesFile bool `json:"showSubtitlesFile"` - SceneTrailerlist bool `json:"sceneTrailerlist"` - ShowScriptHeatmap bool `json:"showScriptHeatmap"` - ShowAllHeatmaps bool `json:"showAllHeatmaps"` - UpdateCheck bool `json:"updateCheck"` - IsAvailOpacity int `json:"isAvailOpacity"` + TagSort string `json:"tagSort"` + SceneHidden bool `json:"sceneHidden"` + SceneWatchlist bool `json:"sceneWatchlist"` + SceneFavourite bool `json:"sceneFavourite"` + SceneWishlist bool `json:"sceneWishlist"` + SceneWatched bool `json:"sceneWatched"` + SceneEdit bool `json:"sceneEdit"` + SceneDuration bool `json:"sceneDuration"` + SceneCuepoint bool `json:"sceneCuepoint"` + ShowHspFile bool `json:"showHspFile"` + ShowSubtitlesFile bool `json:"showSubtitlesFile"` + SceneTrailerlist bool `json:"sceneTrailerlist"` + ShowScriptHeatmap bool `json:"showScriptHeatmap"` + ShowAllHeatmaps bool `json:"showAllHeatmaps"` + ShowOpenInNewWindow bool `json:"showOpenInNewWindow"` + UpdateCheck bool `json:"updateCheck"` + IsAvailOpacity int `json:"isAvailOpacity"` } type RequestSaveOptionsAdvanced struct { @@ -470,6 +471,7 @@ func (i ConfigResource) saveOptionsWeb(req *restful.Request, resp *restful.Respo config.Config.Web.SceneTrailerlist = r.SceneTrailerlist config.Config.Web.ShowScriptHeatmap = r.ShowScriptHeatmap config.Config.Web.ShowAllHeatmaps = r.ShowAllHeatmaps + config.Config.Web.ShowOpenInNewWindow = r.ShowOpenInNewWindow config.Config.Web.UpdateCheck = r.UpdateCheck config.Config.Web.IsAvailOpacity = r.IsAvailOpacity config.SaveConfig() diff --git a/pkg/config/config.go b/pkg/config/config.go index a7a77fe6b..c4f4582ea 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -30,22 +30,23 @@ type ObjectConfig struct { Password string `default:"" json:"password"` } `json:"security"` Web struct { - TagSort string `default:"by-tag-count" json:"tagSort"` - SceneHidden bool `default:"true" json:"sceneHidden"` - SceneWatchlist bool `default:"true" json:"sceneWatchlist"` - SceneFavourite bool `default:"true" json:"sceneFavourite"` - SceneWishlist bool `default:"true" json:"sceneWishlist"` - SceneWatched bool `default:"false" json:"sceneWatched"` - SceneEdit bool `default:"false" json:"sceneEdit"` - SceneDuration bool `default:"false" json:"sceneDuration"` - SceneCuepoint bool `default:"true" json:"sceneCuepoint"` - ShowHspFile bool `default:"true" json:"showHspFile"` - ShowSubtitlesFile bool `default:"true" json:"showSubtitlesFile"` - SceneTrailerlist bool `default:"true" json:"sceneTrailerlist"` - ShowScriptHeatmap bool `default:"true" json:"showScriptHeatmap"` - ShowAllHeatmaps bool `default:"false" json:"showAllHeatmaps"` - UpdateCheck bool `default:"true" json:"updateCheck"` - IsAvailOpacity int `default:"40" json:"isAvailOpacity"` + TagSort string `default:"by-tag-count" json:"tagSort"` + SceneHidden bool `default:"true" json:"sceneHidden"` + SceneWatchlist bool `default:"true" json:"sceneWatchlist"` + SceneFavourite bool `default:"true" json:"sceneFavourite"` + SceneWishlist bool `default:"true" json:"sceneWishlist"` + SceneWatched bool `default:"false" json:"sceneWatched"` + SceneEdit bool `default:"false" json:"sceneEdit"` + SceneDuration bool `default:"false" json:"sceneDuration"` + SceneCuepoint bool `default:"true" json:"sceneCuepoint"` + ShowHspFile bool `default:"true" json:"showHspFile"` + ShowSubtitlesFile bool `default:"true" json:"showSubtitlesFile"` + SceneTrailerlist bool `default:"true" json:"sceneTrailerlist"` + ShowScriptHeatmap bool `default:"true" json:"showScriptHeatmap"` + ShowAllHeatmaps bool `default:"false" json:"showAllHeatmaps"` + ShowOpenInNewWindow bool `default:"true" json:"showOpenInNewWindow"` + UpdateCheck bool `default:"true" json:"updateCheck"` + IsAvailOpacity int `default:"40" json:"isAvailOpacity"` } `json:"web"` Advanced struct { ShowInternalSceneId bool `default:"false" json:"showInternalSceneId"` diff --git a/pkg/config/state.go b/pkg/config/state.go index 4e68eba0a..6f71437cb 100644 --- a/pkg/config/state.go +++ b/pkg/config/state.go @@ -12,22 +12,23 @@ type ObjectState struct { BoundIP []string `json:"bound_ip"` } `json:"server"` Web struct { - TagSort string `json:"tagSort"` - SceneHidden bool `json:"sceneHidden"` - SceneWatchlist bool `json:"sceneWatchlist"` - SceneFavourite bool `json:"sceneFavourite"` - SceneWishlist bool `json:"sceneWishlist"` - SceneWatched bool `json:"sceneWatched"` - SceneEdit bool `json:"sceneEdit"` - SceneDuration bool `json:"sceneDuration"` - SceneCuepoint bool `json:"sceneCuepoint"` - ShowHspFile bool `json:"showHspFile"` - ShowSubtitlesFile bool `json:"showSubtitlesFile"` - SceneTrailerlist bool `json:"sceneTrailerlist"` - ShowScriptHeatmap bool `json:"showScriptHeatmap"` - ShowAllHeatmaps bool `json:"showAllHeatmaps"` - UpdateCheck bool `json:"updateCheck"` - IsAvailOpacity int `json:"isAvailOpacity"` + TagSort string `json:"tagSort"` + SceneHidden bool `json:"sceneHidden"` + SceneWatchlist bool `json:"sceneWatchlist"` + SceneFavourite bool `json:"sceneFavourite"` + SceneWishlist bool `json:"sceneWishlist"` + SceneWatched bool `json:"sceneWatched"` + SceneEdit bool `json:"sceneEdit"` + SceneDuration bool `json:"sceneDuration"` + SceneCuepoint bool `json:"sceneCuepoint"` + ShowHspFile bool `json:"showHspFile"` + ShowSubtitlesFile bool `json:"showSubtitlesFile"` + SceneTrailerlist bool `json:"sceneTrailerlist"` + ShowScriptHeatmap bool `json:"showScriptHeatmap"` + ShowAllHeatmaps bool `json:"showAllHeatmaps"` + ShowOpenInNewWindow bool `json:"showOpenInNewWindow"` + UpdateCheck bool `json:"updateCheck"` + IsAvailOpacity int `json:"isAvailOpacity"` } `json:"web"` DLNA struct { Running bool `json:"running"` diff --git a/ui/src/store/optionsWeb.js b/ui/src/store/optionsWeb.js index 999cf4063..e4bf0ae53 100644 --- a/ui/src/store/optionsWeb.js +++ b/ui/src/store/optionsWeb.js @@ -19,6 +19,7 @@ const state = { isAvailOpacity: 40, showScriptHeatmap: false, showAllHeatmaps: false, + showOpenInNewWindow: true, updateCheck: true } } @@ -46,7 +47,8 @@ const actions = { state.web.showScriptHeatmap = data.config.web.showScriptHeatmap state.web.showAllHeatmaps = data.config.web.showAllHeatmaps state.web.updateCheck = data.config.web.updateCheck - state.web.isAvailOpacity = data.config.web.isAvailOpacity + state.web.isAvailOpacity = data.config.web.isAvailOpacity + state.web.showOpenInNewWindow = data.config.web.showOpenInNewWindow state.loading = false }) }, @@ -71,6 +73,7 @@ const actions = { state.web.showAllHeatmaps = data.showAllHeatmaps state.web.updateCheck = data.updateCheck state.web.isAvailOpacity = data.isAvailOpacity + state.web.showOpenInNewWindow = data.showOpenInNewWindow state.loading = false }) } diff --git a/ui/src/views/actors/ActorDetails.vue b/ui/src/views/actors/ActorDetails.vue index a563fbe64..7ec127b28 100644 --- a/ui/src/views/actors/ActorDetails.vue +++ b/ui/src/views/actors/ActorDetails.vue @@ -151,7 +151,10 @@ {{ actor.biography }} - + +
@@ -312,6 +315,9 @@ export default { showEdit () { return this.$store.state.overlay.actoredit.show }, + showOpenInNewWindow () { + return this.$store.state.optionsWeb.web.showOpenInNewWindow + }, }, mounted () { ky.get('/api/actor/countrylist') @@ -595,6 +601,19 @@ export default { } return true }, + getCastScenesUrl(actor) { + let newfilters = Object.assign({}, this.$store.state.sceneList.filters); + console.log(newfilters) + newfilters.cast = actor; + newfilters.dlState = "any" + newfilters.isAvailable=null + newfilters.isAccessible=null + console.log(newfilters) + return this.$router.resolve({ + name: 'scenes', + query: { q: Buffer.from(JSON.stringify(newfilters)).toString('base64') } + }).href + }, refreshScraper(url){ if (url.includes('stashdb')) { this.$store.state.actorList.isLoading = true diff --git a/ui/src/views/options/sections/InterfaceWeb.vue b/ui/src/views/options/sections/InterfaceWeb.vue index a4dd8d656..60b03aa66 100644 --- a/ui/src/views/options/sections/InterfaceWeb.vue +++ b/ui/src/views/options/sections/InterfaceWeb.vue @@ -85,6 +85,11 @@ show All Heatmaps + + + show Open Tag in New Window + +
@@ -241,6 +246,14 @@ export default { this.$store.state.optionsWeb.web.showSubtitlesFile = value } }, + openInNewWindow: { + get () { + return this.$store.state.optionsWeb.web.showOpenInNewWindow + }, + set (value) { + this.$store.state.optionsWeb.web.showOpenInNewWindow = value + } + }, isAvailOpacity: { get () { if (this.$store.state.optionsWeb.web.isAvailOpacity == undefined) { diff --git a/ui/src/views/scenes/Details.vue b/ui/src/views/scenes/Details.vue index df5fd1ced..e80dff764 100644 --- a/ui/src/views/scenes/Details.vue +++ b/ui/src/views/scenes/Details.vue @@ -160,13 +160,19 @@
@@ -581,6 +587,9 @@ export default { quickFindOverlayState() { return this.$store.state.overlay.quickFind.show }, + showOpenInNewWindow () { + return this.$store.state.optionsWeb.web.showOpenInNewWindow + }, alternateSourcesWithTitles() { return this.alternateSources.map(altsrc => { const extdata = JSON.parse(altsrc.external_data); @@ -714,6 +723,17 @@ watch:{ }) this.close() }, + getCastScenesUrl(actor) { + let newfilters = Object.assign({}, this.$store.state.sceneList.filters); + newfilters.cast = actor; + newfilters.sites = [] + newfilters.tags = [] + newfilters.attributes = [] + return this.$router.resolve({ + name: 'scenes', + query: { q: Buffer.from(JSON.stringify(newfilters)).toString('base64') } + }).href + }, showTagScenes (tag) { this.$store.state.sceneList.filters.cast = [] this.$store.state.sceneList.filters.sites = [] @@ -725,6 +745,17 @@ watch:{ }) this.close() }, + getTagScenesUrl(tag) { + let newfilters = Object.assign({}, this.$store.state.sceneList.filters); + newfilters.tags = tag; + newfilters.cast = [] + newfilters.sites = [] + newfilters.attributes = [] + return this.$router.resolve({ + name: 'scenes', + query: { q: Buffer.from(JSON.stringify(newfilters)).toString('base64') } + }).href + }, showSiteScenes (site) { this.$store.state.sceneList.filters.cast = [] this.$store.state.sceneList.filters.sites = site @@ -736,6 +767,17 @@ watch:{ }) this.close() }, + getSiteScenesUrl(site) { + let newfilters = Object.assign({}, this.$store.state.sceneList.filters); + newfilters.sites = site; + newfilters.cast = [] + newfilters.tags = [] + newfilters.attributes = [] + return this.$router.resolve({ + name: 'scenes', + query: { q: Buffer.from(JSON.stringify(newfilters)).toString('base64') } + }).href + }, showActorDetail (actor_id) { ky.get('/api/actor/'+actor_id).json().then(data => { if (data.id != 0){