Skip to content

Commit

Permalink
Open In New Window Links (xbapps#1827)
Browse files Browse the repository at this point in the history
  • Loading branch information
toshski authored Aug 28, 2024
1 parent cffd624 commit 4204175
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 57 deletions.
34 changes: 18 additions & 16 deletions pkg/api/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()
Expand Down
33 changes: 17 additions & 16 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
33 changes: 17 additions & 16 deletions pkg/config/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
5 changes: 4 additions & 1 deletion ui/src/store/optionsWeb.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const state = {
isAvailOpacity: 40,
showScriptHeatmap: false,
showAllHeatmaps: false,
showOpenInNewWindow: true,
updateCheck: true
}
}
Expand Down Expand Up @@ -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
})
},
Expand All @@ -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
})
}
Expand Down
21 changes: 20 additions & 1 deletion ui/src/views/actors/ActorDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@
{{ actor.biography }}
</b-message>
</b-tab-item>
<b-tab-item :label="`Scenes (${actor.scenes.length})`">
<b-tab-item>
<template #header>
Scenes ({{ actor.scenes.length }}) <a v-if="showOpenInNewWindow" :href='getCastScenesUrl([actor.name])' target="_blank" style="padding-left: 0.1em; border-bottom-style: none;"><b-icon pack="mdi" icon="open-in-new" size="is-small" style="background-color: hsl(0, 0%, 100%);"></b-icon></a>
</template>
<div v-show="activeTab == 1" :class="['columns', 'is-multiline', actor.scenes.length > 6 ? 'scroll' : '']">
<div :class="['column', 'is-multiline', 'is-one-third']"
v-for="(scene, idx) in actor.scenes" :key="idx" class="image-wrapper">
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions ui/src/views/options/sections/InterfaceWeb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@
show All Heatmaps
</b-switch>
</b-field>
<b-field>
<b-switch v-model="openInNewWindow" type="is-dark">
show Open Tag in New Window
</b-switch>
</b-field>
<b-field label="Opacity of unavailable scenes">
<div class="columns">
<div class="column is-two-thirds">
Expand Down Expand Up @@ -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) {
Expand Down
56 changes: 49 additions & 7 deletions ui/src/views/scenes/Details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,19 @@

<div class="block-tags block" v-if="activeTab != 1">
<b-taglist>
<a v-for="(c, idx) in item.cast" :key="'cast' + idx" @click='showCastScenes([c.name])'
class="tag is-warning is-small">{{ c.name }} ({{ c.avail_count }}/{{ c.count }})</a>
<a @click='showSiteScenes([item.site])'
class="tag is-primary is-small">{{ item.site }}</a>
<a v-for="(tag, idx) in item.tags" :key="'tag' + idx" @click='showTagScenes([tag.name])'
class="tag is-info is-small">{{ tag.name }} ({{ tag.count }})</a>
</b-taglist>
<span v-for="(c, idx) in item.cast" :key="'cast' + idx" >
<a class="tag is-warning is-small" @click='showCastScenes([c.name])' :style="showOpenInNewWindow ? 'margin-right: 0;': 'margin-right: .5em;'" >{{ c.name }} ({{ c.avail_count }}/{{ c.count }})</a>
<a v-if="showOpenInNewWindow" class="tag is-warning is-small" :href='getCastScenesUrl([c.name])' target="_blank" style="margin-right: 0.5em;"><b-icon pack="mdi" icon="open-in-new" size="is-small"></b-icon></a>
</span>
<span>
<a @click='showSiteScenes([item.site])' class="tag is-primary is-small" :style="showOpenInNewWindow ? 'margin-right: 0;': 'margin-right: .5em;'">{{ item.site }}</a>
<a v-if="showOpenInNewWindow" class="tag is-primary is-small" :href='getSiteScenesUrl([item.site])' target="_blank" style="margin-right: 0.5em;"><b-icon pack="mdi" icon="open-in-new" size="is-small"></b-icon></a>
</span>
<span v-for="(tag, idx) in item.tags" :key="'tag' + idx">
<a @click='showTagScenes([tag.name])' class="tag is-info is-small" :style="showOpenInNewWindow ? 'margin-right: 0;': 'margin-right: .5em;'">{{ tag.name }} ({{ tag.count }})</a>
<a v-if="showOpenInNewWindow" class="tag is-info is-small" :href='getTagScenesUrl([tag.name])' target="_blank" style="margin-right: 0.5em;"><b-icon pack="mdi" icon="open-in-new" size="is-small"></b-icon></a>
</span>
</b-taglist>
</div>

<div class="block-tags block" v-if="activeTab == 1">
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 = []
Expand All @@ -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
Expand All @@ -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){
Expand Down

0 comments on commit 4204175

Please sign in to comment.