Compare commits

..

No commits in common. "11e043ca2e5bb2133d0fdd79e02cbd58d1069c53" and "d4919016b67997741ec3903890d573a2ed60de9d" have entirely different histories.

34 changed files with 178 additions and 653 deletions

View File

@ -34,11 +34,18 @@
class="header-social" class="header-social"
/> />
<StashButton <Icon
:stashed-by="stashedBy" v-show="me && isStashed"
class="actor-stash light" icon="heart7"
@stash="(stash) => stashActor(stash)" class="stash stashed noselect"
@unstash="(stash) => unstashActor(stash)" @click="unstashActor"
/>
<Icon
v-show="me && !isStashed"
icon="heart8"
class="stash unstashed noselect"
@click="stashActor"
/> />
</div> </div>
@ -383,7 +390,6 @@ import Expand from '../expand/expand.vue';
import Scroll from '../scroll/scroll.vue'; import Scroll from '../scroll/scroll.vue';
import Gender from './gender.vue'; import Gender from './gender.vue';
import Social from './social.vue'; import Social from './social.vue';
import StashButton from '../stashes/button.vue';
async function fetchActor(scroll = true) { async function fetchActor(scroll = true) {
const { actor, releases, totalCount } = await this.$store.dispatch('fetchActorById', { const { actor, releases, totalCount } = await this.$store.dispatch('fetchActorById', {
@ -396,31 +402,38 @@ async function fetchActor(scroll = true) {
this.actor = actor; this.actor = actor;
this.releases = releases; this.releases = releases;
this.totalCount = totalCount; this.totalCount = totalCount;
this.stashedBy = actor.stashes;
if (this.$refs.filter && scroll) { if (this.$refs.filter && scroll) {
this.$refs.filter.$el.scrollIntoView(); this.$refs.filter.$el.scrollIntoView();
} }
} }
async function stashActor(stashId) { async function stashActor() {
this.stashedBy = await this.$store.dispatch('stashActor', { this.$store.dispatch('stashActor', {
actorId: this.actor.id, actorId: this.actor.id,
stashId, stashId: this.$store.getters.favorites.id,
}); });
this.fetchActor(false);
} }
async function unstashActor(stashId) { async function unstashActor() {
this.stashedBy = await this.$store.dispatch('unstashActor', { this.$store.dispatch('unstashActor', {
actorId: this.actor.id, actorId: this.actor.id,
stashId, stashId: this.$store.getters.favorites.id,
}); });
this.fetchActor(false);
} }
function me() { function me() {
return this.$store.state.auth.user; return this.$store.state.auth.user;
} }
function isStashed() {
return this.actor.stashes?.length > 0;
}
function sfw() { function sfw() {
return this.$store.state.ui.sfw; return this.$store.state.ui.sfw;
} }
@ -454,7 +467,6 @@ export default {
Releases, Releases,
Gender, Gender,
Social, Social,
StashButton,
}, },
data() { data() {
return { return {
@ -465,11 +477,10 @@ export default {
pageTitle: null, pageTitle: null,
bioExpanded: false, bioExpanded: false,
photosExpanded: false, photosExpanded: false,
stashed: false,
stashedBy: [],
}; };
}, },
computed: { computed: {
isStashed,
me, me,
sfw, sfw,
showAlbum, showAlbum,
@ -505,10 +516,6 @@ export default {
background: var(--profile); background: var(--profile);
} }
.actor-stash {
margin: 0 1rem 0 0;
}
.header-name { .header-name {
padding: .5rem 1rem; padding: .5rem 1rem;
margin: 0; margin: 0;

View File

@ -113,7 +113,6 @@ export default {
.photo { .photo {
height: 15rem; height: 15rem;
width: auto;
box-shadow: 0 0 3px var(--darken-weak); box-shadow: 0 0 3px var(--darken-weak);
object-fit: cover; object-fit: cover;
background-position: center; background-position: center;

View File

@ -44,7 +44,7 @@
import Warning from './warning.vue'; import Warning from './warning.vue';
import Header from '../header/header.vue'; import Header from '../header/header.vue';
import Sidebar from '../sidebar/sidebar.vue'; import Sidebar from '../sidebar/sidebar.vue';
import Filters from '../filters/filters.vue'; import Filters from './filters.vue';
function toggleSidebar(state) { function toggleSidebar(state) {
this.showSidebar = typeof state === 'boolean' ? state : !this.showSidebar; this.showSidebar = typeof state === 'boolean' ? state : !this.showSidebar;
@ -124,6 +124,8 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
@import 'theme';
.container { .container {
position: relative; position: relative;
height: 100%; height: 100%;

View File

@ -1,6 +1,6 @@
<template> <template>
<Dialog <Dialog
title="Filters" title="filters"
@close="$emit('close')" @close="$emit('close')"
> >
<div class="filters"> <div class="filters">

View File

@ -76,6 +76,7 @@ export default {
color: var(--text-light); color: var(--text-light);
font-size: 1.5rem; font-size: 1.5rem;
font-weight: bold; font-weight: bold;
text-transform: capitalize;
} }
.header-title { .header-title {
@ -105,11 +106,7 @@ export default {
::v-deep(.dialog-actions) { ::v-deep(.dialog-actions) {
display: flex; display: flex;
padding: 1rem 0 0 0; padding: .5rem 0;
&.center {
justify-content: center;
}
&.right { &.right {
justify-content: flex-end; justify-content: flex-end;

View File

@ -1,8 +1,5 @@
<template> <template>
<label <label class="toggle-container noselect">
class="toggle-container noselect"
:class="{ light: $store.state.ui.theme === 'dark' }"
>
<input <input
:id="`toggle-${id}`" :id="`toggle-${id}`"
:checked="checked" :checked="checked"

View File

@ -3,7 +3,6 @@
v-if="release" v-if="release"
ref="content" ref="content"
class="content" class="content"
@scroll="events.emit('scroll', $event)"
> >
<Scroll <Scroll
v-slot="slotProps" v-slot="slotProps"
@ -52,10 +51,18 @@
/> />
</h2> </h2>
<StashButton <Icon
:stashed-by="stashedBy" v-show="me && release.isStashed"
@stash="(stash) => stashScene(stash)" icon="heart7"
@unstash="(stash) => unstashScene(stash)" class="stash stashed noselect"
@click="unstashScene"
/>
<Icon
v-show="me && !release.isStashed"
icon="heart8"
class="stash unstashed noselect"
@click="stashScene"
/> />
</div> </div>
@ -223,7 +230,6 @@
<script> <script>
import Details from './details.vue'; import Details from './details.vue';
import Banner from './banner.vue'; import Banner from './banner.vue';
import StashButton from '../stashes/button.vue';
import Album from '../album/album.vue'; import Album from '../album/album.vue';
import Tags from './tags.vue'; import Tags from './tags.vue';
import Chapters from './chapters.vue'; import Chapters from './chapters.vue';
@ -243,24 +249,26 @@ async function fetchRelease(scroll = true) {
if (scroll && this.$refs.content) { if (scroll && this.$refs.content) {
this.$refs.content.scrollTop = 0; this.$refs.content.scrollTop = 0;
} }
this.stashedBy = this.release.stashes;
} }
async function stashScene(stashId) { async function stashScene() {
this.stashedBy = await this.$store.dispatch(this.$route.name === 'movie' ? 'stashMovie' : 'stashScene', { this.$store.dispatch(this.$route.name === 'movie' ? 'stashMovie' : 'stashScene', {
sceneId: this.release.id, sceneId: this.release.id,
movieId: this.release.id, movieId: this.release.id,
stashId, stashId: this.$store.getters.favorites.id,
}); });
this.fetchRelease(false);
} }
async function unstashScene(stashId) { async function unstashScene() {
this.stashedBy = await this.$store.dispatch(this.$route.name === 'movie' ? 'unstashMovie' : 'unstashScene', { this.$store.dispatch(this.$route.name === 'movie' ? 'unstashMovie' : 'unstashScene', {
sceneId: this.release.id, sceneId: this.release.id,
movieId: this.release.id, movieId: this.release.id,
stashId, stashId: this.$store.getters.favorites.id,
}); });
this.fetchRelease(false);
} }
function me() { function me() {
@ -286,18 +294,16 @@ export default {
components: { components: {
Actor, Actor,
Album, Album,
Banner,
Chapters,
Details, Details,
Releases, Banner,
Scroll, Scroll,
StashButton, Releases,
Chapters,
Tags, Tags,
}, },
data() { data() {
return { return {
release: null, release: null,
stashedBy: [],
}; };
}, },
computed: { computed: {
@ -388,6 +394,22 @@ export default {
color: var(--shadow); color: var(--shadow);
} }
.stash.icon {
width: 1.5rem;
height: 1.5rem;
padding: 0 1rem;
fill: var(--darken);
&.stashed {
fill: var(--primary);
}
&:hover {
fill: var(--primary);
cursor: pointer;
}
}
.album-toggle { .album-toggle {
height: fit-content; height: fit-content;
display: inline-flex; display: inline-flex;

View File

@ -451,7 +451,7 @@ export default {
.tile.new .poster::after { .tile.new .poster::after {
bottom: 0; bottom: 0;
top: auto; top: auto;
margin: .1rem .25rem; margin: 0 .25rem;
} }
.stash { .stash {

View File

@ -1,99 +0,0 @@
<template>
<span class="stash-container">
<Tooltip class="stash-trigger">
<Icon
v-show="me"
icon="menu"
class="stash noselect"
:class="{ stashed }"
/>
<template v-slot:tooltip>
<StashMenu
:stashed-by="stashedBy"
@stash="(stashId) => $emit('stash', stashId)"
@unstash="(stashId) => $emit('unstash', stashId)"
/>
</template>
</Tooltip>
<Icon
v-show="me && favorited"
icon="heart7"
class="stash stashed noselect"
@click.native="() => $emit('unstash', favorites.id)"
/>
<Icon
v-show="me && !favorited"
icon="heart8"
class="stash unstashed noselect"
@click.native="() => $emit('stash', favorites.id)"
/>
</span>
</template>
<script>
import StashMenu from './menu.vue';
function favorited() {
return this.stashedBy.some(stash => stash.primary);
}
function stashed() {
return this.stashedBy.some(stash => !stash.primary);
}
function favorites() {
return this.$store.getters.favorites;
}
function me() {
return this.$store.state.auth.user;
}
export default {
components: {
StashMenu,
},
props: {
stashedBy: {
type: Array,
default: () => [],
},
},
emits: ['stash', 'unstash'],
computed: {
me,
favorites,
favorited,
stashed,
},
};
</script>
<style lang="scss" scoped>
.stash-container.light .icon {
fill: var(--lighten);
}
.stash.icon {
width: 1.5rem;
height: 1.5rem;
padding: 0 .5rem;
fill: var(--shadow);
&.stashed {
fill: var(--primary);
}
&:hover {
fill: var(--primary);
cursor: pointer;
}
}
.stash-trigger {
display: inline-block;
}
</style>

View File

@ -1,70 +0,0 @@
<template>
<ul class="menu nolist">
<li
v-for="stash in stashes"
:key="`stash-${stash.id}`"
class="menu-item"
>
<label class="menu-stash noselect">
<Checkbox
:checked="stashedByIds.has(stash.id)"
class="menu-check"
@change="(checked) => checked ? $emit('stash', stash.id) : $emit('unstash', stash.id)"
/>{{ stash.name }}
</label>
</li>
</ul>
</template>
<script>
import Checkbox from '../form/checkbox.vue';
function stashes() {
return this.$store.state.auth.user?.stashes || [];
}
export default {
components: {
Checkbox,
},
props: {
stashedBy: {
type: Array,
default: () => [],
},
},
emits: ['stash', 'unstash'],
data() {
const stashedByIds = new Set(this.stashedBy.map(stash => stash.id));
return {
stashedByIds,
};
},
computed: {
stashes,
},
};
</script>
<style lang="scss" scoped>
.menu-item {
display: block;
}
.menu-stash {
display: flex;
align-items: center;
padding: .5rem 1rem .5rem .5rem;
&:hover {
color: var(--primary);
cursor: pointer;
}
}
.menu-check {
display: inline-block;
margin: 0 .75rem 0 0;
}
</style>

View File

@ -1,38 +0,0 @@
<template>
<Dialog
title="Remove stash"
@close="$emit('close', false)"
>
<form @submit.prevent="removeStash">
Are you sure you want to remove stash "{{ stash.name }}"?
<div class="dialog-actions right">
<button
type="submit"
class="button button-primary"
>Remove</button>
</div>
</form>
</Dialog>
</template>
<script>
async function removeStash() {
await this.$store.dispatch('removeStash', this.stash.id);
this.$emit('close', true);
}
export default {
props: {
stash: {
type: Object,
default: null,
},
},
emits: ['close'],
methods: {
removeStash,
},
};
</script>

View File

@ -4,18 +4,9 @@
class="stash content" class="stash content"
> >
<div class="stash-header"> <div class="stash-header">
<h2 <h2 class="stash-name">{{ stash.name }}</h2>
:title="stash.name"
class="stash-name"
>{{ stash.name }}</h2>
<span class="header-section"> <span class="header-section">
<router-link
v-if="stash.user"
:to="{ name: 'user', params: { username: stash.user.username } }"
class="header-item stash-username nolink"
><Icon icon="user3" /><span class="username-name">{{ stash.user.username }}</span></router-link>
<label <label
v-if="isMine" v-if="isMine"
v-tooltip="'Public'" v-tooltip="'Public'"
@ -39,18 +30,11 @@
/> />
</label> </label>
<Icon <router-link
v-if="isMine && !stash.primary" v-if="stash.user"
icon="bin" :to="{ name: 'user', params: { username: stash.user.username } }"
class="stash-remove" class="header-item stash-username nolink"
@click.native="showRemoveStash = true" ><Icon icon="user3" />{{ stash.user.username }}</router-link>
/>
<RemoveStash
v-if="showRemoveStash"
:stash="stash"
@close="removeStash"
/>
</span> </span>
</div> </div>
@ -78,7 +62,6 @@
<script> <script>
import Actor from '../actors/tile.vue'; import Actor from '../actors/tile.vue';
import Releases from '../releases/releases.vue'; import Releases from '../releases/releases.vue';
import RemoveStash from './remove-stash.vue';
import Toggle from '../form/toggle.vue'; import Toggle from '../form/toggle.vue';
async function fetchStash() { async function fetchStash() {
@ -95,19 +78,6 @@ async function publishStash(isPublic) {
this.fetchStash(); this.fetchStash();
} }
async function removeStash(removed) {
this.showRemoveStash = false;
if (removed && this.stash.user) {
this.$router.replace({ name: 'user', params: { username: this.stash.user.username } });
return;
}
if (removed) {
this.$router.replace({ name: 'home' });
}
}
async function mounted() { async function mounted() {
this.fetchStash(); this.fetchStash();
} }
@ -116,13 +86,11 @@ export default {
components: { components: {
Actor, Actor,
Releases, Releases,
RemoveStash,
Toggle, Toggle,
}, },
data() { data() {
return { return {
stash: null, stash: null,
showRemoveStash: false,
isMine: false, isMine: false,
}; };
}, },
@ -130,14 +98,11 @@ export default {
methods: { methods: {
fetchStash, fetchStash,
publishStash, publishStash,
removeStash,
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import 'breakpoints';
.stash-header { .stash-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -158,29 +123,12 @@ export default {
align-items: center; align-items: center;
} }
.stash-name, .header-item:not(:last-child) {
.stash-username { margin: 0 1rem 0 0;
box-sizing: border-box;
padding: .5rem 1rem;
font-weight: bold;
}
.stash-username {
display: inline-flex;
align-items: center;
margin: 0 .5rem 0 0;
}
.stash-name {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin: 0;
} }
.stash-public { .stash-public {
cursor: pointer; cursor: pointer;
margin: 0 .5rem 0 0;
.icon { .icon {
margin: 0 .75rem 0 0; margin: 0 .75rem 0 0;
@ -188,15 +136,13 @@ export default {
} }
} }
.stash-remove.icon { .stash-name,
height: 100%; .stash-username {
padding: 0 1rem; display: inline-flex;
fill: var(--lighten-strong); align-items: center;
padding: .5rem 1rem;
&:hover { margin: 0;
fill: var(--text-light); font-weight: bold;
cursor: pointer;
}
} }
.stash-section:not(:last-child) { .stash-section:not(:last-child) {
@ -218,18 +164,4 @@ export default {
grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr));
} }
} }
@media(max-width: $breakpoint-small) {
.stash-name {
font-size: 1.25rem;
}
.username-name {
display: none;
}
.stash-username {
margin: 0;
}
}
</style> </style>

View File

@ -63,7 +63,7 @@ export default {
align-items: center; align-items: center;
position: absolute; position: absolute;
left: 0; left: 0;
background: var(--darken-weak); background: var(--shadow-weak);
color: var(--text-light); color: var(--text-light);
font-size: .7rem; font-size: .7rem;
font-weight: bold; font-weight: bold;

View File

@ -6,45 +6,29 @@
class="stash-link nolink" class="stash-link nolink"
> >
<h4 class="stash-name">{{ stash.name }}</h4> <h4 class="stash-name">{{ stash.name }}</h4>
<span class="stash-more">Browse</span>
</router-link> </router-link>
<span class="header-actions noselect"> <label
<label v-if="isMe"
v-if="isMe" v-tooltip="'Public'"
v-tooltip="'Public'" :class="{ public: stash.public }"
:class="{ public: stash.public }" class="stash-public"
class="stash-public" >
> <Icon
<Icon v-show="stash.public"
v-show="stash.public" icon="eye"
icon="eye" />
/>
<Icon
v-show="!stash.public"
icon="eye-blocked"
/>
<Toggle
:checked="stash.public"
@change="checked => publishStash(checked)"
/>
</label>
<Icon <Icon
v-if="isMe && !stash.primary" v-show="!stash.public"
icon="bin" icon="eye-blocked"
class="stash-remove"
@click.native="showRemoveStash = true"
/> />
<RemoveStash <Toggle
v-if="showRemoveStash" :checked="stash.public"
:stash="stash" @change="checked => publishStash(stash, checked)"
@close="removeStash"
/> />
</span> </label>
</div> </div>
<ul <ul
@ -84,31 +68,21 @@
<script> <script>
import ActorPreview from './actor-preview.vue'; import ActorPreview from './actor-preview.vue';
import ScenePreview from './scene-preview.vue'; import ScenePreview from './scene-preview.vue';
import RemoveStash from '../stashes/remove-stash.vue';
import Toggle from '../form/toggle.vue'; import Toggle from '../form/toggle.vue';
async function publishStash(isPublic) { async function publishStash(stash, isPublic) {
await this.$store.dispatch('updateStash', { await this.$store.dispatch('updateStash', {
stashId: this.stash.id, stashId: stash.id,
stash: { public: isPublic }, stash: { public: isPublic },
}); });
this.$emit('publish', isPublic); this.$emit('publish', isPublic);
} }
async function removeStash(removed) {
this.showRemoveStash = false;
if (removed) {
this.$emit('remove');
}
}
export default { export default {
components: { components: {
ActorPreview, ActorPreview,
ScenePreview, ScenePreview,
RemoveStash,
Toggle, Toggle,
}, },
props: { props: {
@ -121,15 +95,9 @@ export default {
default: false, default: false,
}, },
}, },
emits: ['publish', 'remove'], emits: ['publish'],
data() {
return {
showRemoveStash: false,
};
},
methods: { methods: {
publishStash, publishStash,
removeStash,
}, },
}; };
</script> </script>
@ -155,46 +123,17 @@ export default {
.stash-header { .stash-header {
justify-content: space-between; justify-content: space-between;
align-items: stretch;
padding: 0; padding: 0;
} }
.stash-link { .stash-link {
display: inline-flex;
align-items: center;
flex-grow: 1; flex-grow: 1;
text-decoration: none;
overflow: hidden;
&:hover .stash-more {
color: var(--primary);
}
}
.stash-name {
display: inline-block; display: inline-block;
padding: 0 .5rem; text-decoration: none;
margin: 0;
color: var(--shadow-strong);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.stash-more {
flex-shrink: 0;
margin: 0 0 0 .5rem;
color: var(--shadow);
font-size: .9rem;
}
.header-actions {
display: flex;
align-items: stretch;
} }
.stash-public { .stash-public {
display: inline-flex; display: flex;
align-items: center; align-items: center;
padding: .5rem; padding: .5rem;
cursor: pointer; cursor: pointer;
@ -205,15 +144,10 @@ export default {
} }
} }
.stash-remove { .stash-name {
height: auto; padding: .5rem;
padding: 0 .5rem 0 .75rem; margin: 0;
fill: var(--shadow); color: var(--shadow-strong);
&:hover {
cursor: pointer;
fill: var(--shadow-strong);
}
} }
.stash-actors, .stash-actors,

View File

@ -11,33 +11,23 @@
v-if="user.stashes?.length > 0" v-if="user.stashes?.length > 0"
class="section" class="section"
> >
<div class="section-header"> <h3 class="heading">Stashes</h3>
<h3 class="section-heading">Stashes</h3>
<Icon <ul class="stashes nolist">
icon="plus3"
class="header-add"
@click="showAddStash = true"
/>
</div>
<ul class="section-body stashes nolist">
<li <li
v-for="stash in user.stashes" v-for="stash in user.stashes"
:key="stash.id" :key="stash.id"
class="stashes-stash"
> >
<Stash <Stash
:stash="stash" :stash="stash"
:is-me="isMe" :is-me="isMe"
@publish="() => fetchUser()" @publish="() => fetchUser()"
@remove="() => fetchUser()"
/> />
</li> </li>
<li <li
v-if="isMe" v-if="isMe"
class="stashes-stash stashes-add" class="stashes-add"
@click="showAddStash = true" @click="showAddStash = true"
> >
<Icon icon="plus2" /> <Icon icon="plus2" />
@ -102,23 +92,18 @@ export default {
@import 'breakpoints'; @import 'breakpoints';
.header { .header {
display: flex; padding: .5rem 1rem;
justify-content: space-between;
background: var(--profile); background: var(--profile);
} }
.username { .username {
padding: .5rem 1rem;
margin: 0; margin: 0;
font-size: 1.5rem; font-size: 1.5rem;
color: var(--text-light); color: var(--text-light);
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
} }
.section { .section {
padding: 1rem 0; padding: 1rem;
margin: 0 0 1rem 0; margin: 0 0 1rem 0;
} }
@ -129,37 +114,8 @@ export default {
grid-gap: 1rem; grid-gap: 1rem;
} }
.section-header { .heading {
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 0 1rem 0;
}
.section-body {
padding: 0 1rem;
}
.section-heading {
color: var(--primary); color: var(--primary);
padding: 0 1rem;
margin: 0;
font-size: 1.25rem;
}
.header-add {
height: auto;
padding: .5rem 1rem;
fill: var(--shadow);
&:hover {
fill: var(--primary);
cursor: pointer;
}
}
.stashes-stash {
min-width: 0;
} }
.stashes-add { .stashes-add {
@ -167,20 +123,20 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: var(--shadow-touch); background: var(--shadow-hint);
.icon { .icon {
width: 1.5rem; width: 1.5rem;
height: 1.5rem; height: 1.5rem;
fill: var(--shadow-hint); fill: var(--shadow-weak);
} }
&:hover { &:hover {
background: var(--shadow-hint); background: var(--shadow-weak);
cursor: pointer; cursor: pointer;
.icon { .icon {
fill: var(--shadow-weak); fill: var(--shadow);
} }
} }
} }

View File

@ -26,14 +26,12 @@ $breakpoint4: 1500px;
--darken-censor: rgba(0, 0, 0, .95); --darken-censor: rgba(0, 0, 0, .95);
--darken-weak: rgba(0, 0, 0, .2); --darken-weak: rgba(0, 0, 0, .2);
--darken-hint: rgba(0, 0, 0, .1); --darken-hint: rgba(0, 0, 0, .1);
--darken-touch: rgba(0, 0, 0, .05);
--lighten: rgba(255, 255, 255, .5); --lighten: rgba(255, 255, 255, .5);
--lighten-strong: rgba(255, 255, 255, .7); --lighten-strong: rgba(255, 255, 255, .7);
--lighten-extreme: rgba(255, 255, 255, .9); --lighten-extreme: rgba(255, 255, 255, .9);
--lighten-weak: rgba(255, 255, 255, .2); --lighten-weak: rgba(255, 255, 255, .2);
--lighten-hint: rgba(255, 255, 255, .05); --lighten-hint: rgba(255, 255, 255, .05);
--lighten-touch: rgba(255, 255, 255, .03);
--logo-shadow: drop-shadow(1px 0 0 $shadow-weak) drop-shadow(-1px 0 0 $shadow-weak) drop-shadow(0 1px 0 $shadow-weak) drop-shadow(0 -1px 0 $shadow-weak); --logo-shadow: drop-shadow(1px 0 0 $shadow-weak) drop-shadow(-1px 0 0 $shadow-weak) drop-shadow(0 1px 0 $shadow-weak) drop-shadow(0 -1px 0 $shadow-weak);
--logo-highlight: drop-shadow(0 0 1px $highlight); --logo-highlight: drop-shadow(0 0 1px $highlight);

View File

@ -246,7 +246,6 @@ function initActorActions(store, router) {
} }
totalCount totalCount
} }
isStashed
stashes: stashesActors( stashes: stashesActors(
filter: { filter: {
stash: { stash: {
@ -260,7 +259,6 @@ function initActorActions(store, router) {
id id
name name
slug slug
primary
} }
} }
} }

View File

@ -66,12 +66,6 @@ async function del(endpoint) {
credentials: 'same-origin', credentials: 'same-origin',
}); });
const contentTypes = res.headers.get('content-type');
if (res.ok && contentTypes?.includes('application/json')) {
return res.json();
}
if (res.ok) { if (res.ok) {
return true; return true;
} }

View File

@ -56,10 +56,6 @@ function curateActor(actor, release) {
curatedActor.aliasFor = curateActor(curatedActor.aliasFor); curatedActor.aliasFor = curateActor(curatedActor.aliasFor);
} }
if (actor.stashes) {
curatedActor.stashes = actor.stashes.filter(Boolean).map(stash => curateStash(stash.stash || stash)); // eslint-disable-line no-use-before-define
}
curatedActor.stashes = actor.stashes?.map(stash => stash.stash || stash) || []; curatedActor.stashes = actor.stashes?.map(stash => stash.stash || stash) || [];
return curatedActor; return curatedActor;
@ -84,7 +80,6 @@ function curateRelease(release) {
if (release.directors) curatedRelease.directors = release.directors.filter(Boolean).map(director => curateActor(director.director || director, curatedRelease)); if (release.directors) curatedRelease.directors = release.directors.filter(Boolean).map(director => curateActor(director.director || director, curatedRelease));
if (release.movieTags && release.movieTags.length > 0) curatedRelease.tags = release.movieTags.filter(Boolean).map(({ tag }) => tag); if (release.movieTags && release.movieTags.length > 0) curatedRelease.tags = release.movieTags.filter(Boolean).map(({ tag }) => tag);
if (release.movieActors && release.movieActors.length > 0) curatedRelease.actors = release.movieActors.filter(Boolean).map(({ actor }) => curateActor(actor, curatedRelease)); if (release.movieActors && release.movieActors.length > 0) curatedRelease.actors = release.movieActors.filter(Boolean).map(({ actor }) => curateActor(actor, curatedRelease));
if (release.stashes) curatedRelease.stashes = release.stashes.filter(Boolean).map(stash => curateStash(stash.stash || stash)); // eslint-disable-line no-use-before-define
if (release.productionLocation) { if (release.productionLocation) {
curatedRelease.productionLocation = { curatedRelease.productionLocation = {
@ -160,7 +155,7 @@ function curateUser(user) {
const curatedUser = user; const curatedUser = user;
if (user.stashes) { if (user.stashes) {
curatedUser.stashes = user.stashes.map(stash => curateStash(stash.stash || stash)); curatedUser.stashes = user.stashes.map(stash => curateStash(stash));
} }
return curatedUser; return curatedUser;

View File

@ -228,8 +228,7 @@ const releaseFields = `
url url
} }
isNew isNew
isFavorited isStashed
isStashed(includeFavorites: false)
stashes: stashesScenesBySceneId( stashes: stashesScenesBySceneId(
filter: { filter: {
stash: { stash: {
@ -243,7 +242,6 @@ const releaseFields = `
id id
name name
slug slug
primary
} }
} }
`; `;
@ -370,8 +368,7 @@ const releaseFragment = `
} }
} }
} }
isFavorited isStashed
isStashed(includeFavorites: false)
stashes: stashesScenesBySceneId( stashes: stashesScenesBySceneId(
filter: { filter: {
stash: { stash: {
@ -385,7 +382,6 @@ const releaseFragment = `
id id
name name
slug slug
primary
} }
} }
} }

View File

@ -273,7 +273,6 @@ function initReleasesActions(store, router) {
id id
name name
slug slug
primary
} }
} }
} }

View File

@ -21,7 +21,6 @@ function initStashesActions(store, _router) {
name name
slug slug
public public
primary
user { user {
id id
username username
@ -69,45 +68,44 @@ function initStashesActions(store, _router) {
} }
async function createStash(context, stash) { async function createStash(context, stash) {
return post('/stashes', stash); const newStash = await post('/stashes', stash);
return newStash;
} }
async function updateStash(context, { stashId, stash }) { async function updateStash(context, { stashId, stash }) {
return patch(`/stashes/${stashId}`, stash); const newStash = await patch(`/stashes/${stashId}`, stash);
}
async function removeStash(context, stashId) { return newStash;
await del(`/stashes/${stashId}`);
} }
async function stashActor(context, { actorId, stashId }) { async function stashActor(context, { actorId, stashId }) {
return post(`/stashes/${stashId}/actors`, { actorId }); await post(`/stashes/${stashId}/actors`, { actorId });
} }
async function unstashActor(context, { actorId, stashId }) { async function unstashActor(context, { actorId, stashId }) {
return del(`/stashes/${stashId}/actors/${actorId}`); await del(`/stashes/${stashId}/actors/${actorId}`);
} }
async function stashScene(context, { sceneId, stashId }) { async function stashScene(context, { sceneId, stashId }) {
return post(`/stashes/${stashId}/scenes`, { sceneId }); await post(`/stashes/${stashId}/scenes`, { sceneId });
} }
async function unstashScene(context, { sceneId, stashId }) { async function unstashScene(context, { sceneId, stashId }) {
return del(`/stashes/${stashId}/scenes/${sceneId}`); await del(`/stashes/${stashId}/scenes/${sceneId}`);
} }
async function stashMovie(context, { movieId, stashId }) { async function stashMovie(context, { movieId, stashId }) {
return post(`/stashes/${stashId}/movies`, { movieId }); await post(`/stashes/${stashId}/movies`, { movieId });
} }
async function unstashMovie(context, { movieId, stashId }) { async function unstashMovie(context, { movieId, stashId }) {
return del(`/stashes/${stashId}/movies/${movieId}`); await del(`/stashes/${stashId}/movies/${movieId}`);
} }
return { return {
createStash, createStash,
fetchStash, fetchStash,
removeStash,
stashActor, stashActor,
stashScene, stashScene,
stashMovie, stashMovie,

View File

@ -19,7 +19,6 @@ function initUsersActions(store, _router) {
name name
slug slug
public public
primary
actors: stashesActors { actors: stashesActors {
comment comment
actor { actor {

View File

@ -1067,10 +1067,6 @@ exports.up = knex => Promise.resolve()
.notNullable() .notNullable()
.defaultTo(false); .defaultTo(false);
table.boolean('primary')
.notNullable()
.defaultTo(false);
table.datetime('created_at') table.datetime('created_at')
.notNullable() .notNullable()
.defaultTo(knex.fn.now()); .defaultTo(knex.fn.now());

4
package-lock.json generated
View File

@ -1,11 +1,11 @@
{ {
"name": "traxxx", "name": "traxxx",
"version": "1.190.0", "version": "1.189.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"version": "1.190.0", "version": "1.189.1",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@casl/ability": "^5.2.2", "@casl/ability": "^5.2.2",

View File

@ -1,6 +1,6 @@
{ {
"name": "traxxx", "name": "traxxx",
"version": "1.190.0", "version": "1.189.1",
"description": "All the latest porn releases in one place", "description": "All the latest porn releases in one place",
"main": "src/app.js", "main": "src/app.js",
"scripts": { "scripts": {

View File

@ -80,7 +80,6 @@ async function signup(credentials) {
name: 'Favorites', name: 'Favorites',
slug: 'favorites', slug: 'favorites',
public: false, public: false,
primary: true,
}); });
return fetchUser(userId); return fetchUser(userId);

View File

@ -13,7 +13,6 @@ function curateStash(stash) {
id: stash.id, id: stash.id,
name: stash.name, name: stash.name,
slug: stash.slug, slug: stash.slug,
primary: stash.primary,
}; };
return curatedStash; return curatedStash;
@ -49,18 +48,6 @@ async function fetchStash(stashId, sessionUser) {
return curateStash(stash); return curateStash(stash);
} }
async function fetchStashes(domain, itemId, sessionUser) {
const stashes = await knex(`stashes_${domain}s`)
.select('stashes.*')
.where({
[`${domain}_id`]: itemId,
user_id: sessionUser.id,
})
.leftJoin('stashes', 'stashes.id', `stashes_${domain}s.stash_id`);
return stashes.map(stash => curateStash(stash));
}
async function createStash(newStash, sessionUser) { async function createStash(newStash, sessionUser) {
if (!sessionUser) { if (!sessionUser) {
throw new HttpError('You are not authenthicated', 401); throw new HttpError('You are not authenthicated', 401);
@ -93,24 +80,6 @@ async function updateStash(stashId, newStash, sessionUser) {
return curateStash(stash); return curateStash(stash);
} }
async function removeStash(stashId, sessionUser) {
if (!sessionUser) {
throw new HttpError('You are not authenthicated', 401);
}
const removed = await knex('stashes')
.where({
id: stashId,
user_id: sessionUser.id,
primary: false,
})
.delete();
if (removed === 0) {
throw new HttpError('Unable to remove this stash', 400);
}
}
async function stashActor(actorId, stashId, sessionUser) { async function stashActor(actorId, stashId, sessionUser) {
const stash = await fetchStash(stashId, sessionUser); const stash = await fetchStash(stashId, sessionUser);
@ -119,8 +88,6 @@ async function stashActor(actorId, stashId, sessionUser) {
stash_id: stash.id, stash_id: stash.id,
actor_id: actorId, actor_id: actorId,
}); });
return fetchStashes('actor', actorId, sessionUser);
} }
async function stashScene(sceneId, stashId, sessionUser) { async function stashScene(sceneId, stashId, sessionUser) {
@ -131,8 +98,6 @@ async function stashScene(sceneId, stashId, sessionUser) {
stash_id: stash.id, stash_id: stash.id,
scene_id: sceneId, scene_id: sceneId,
}); });
return fetchStashes('scene', sceneId, sessionUser);
} }
async function stashMovie(movieId, stashId, sessionUser) { async function stashMovie(movieId, stashId, sessionUser) {
@ -143,8 +108,6 @@ async function stashMovie(movieId, stashId, sessionUser) {
stash_id: stash.id, stash_id: stash.id,
movie_id: movieId, movie_id: movieId,
}); });
return fetchStashes('movie', movieId, sessionUser);
} }
async function unstashActor(actorId, stashId, sessionUser) { async function unstashActor(actorId, stashId, sessionUser) {
@ -157,8 +120,6 @@ async function unstashActor(actorId, stashId, sessionUser) {
.where('stashes_actors.stash_id', knex.raw('deletable.stash_id')) .where('stashes_actors.stash_id', knex.raw('deletable.stash_id'))
.where('stashes.user_id', sessionUser.id)) .where('stashes.user_id', sessionUser.id))
.delete(); .delete();
return fetchStashes('actor', actorId, sessionUser);
} }
async function unstashScene(sceneId, stashId, sessionUser) { async function unstashScene(sceneId, stashId, sessionUser) {
@ -171,8 +132,6 @@ async function unstashScene(sceneId, stashId, sessionUser) {
.where('stashes_scenes.stash_id', knex.raw('deletable.stash_id')) .where('stashes_scenes.stash_id', knex.raw('deletable.stash_id'))
.where('stashes.user_id', sessionUser.id)) .where('stashes.user_id', sessionUser.id))
.delete(); .delete();
return fetchStashes('scene', sceneId, sessionUser);
} }
async function unstashMovie(movieId, stashId, sessionUser) { async function unstashMovie(movieId, stashId, sessionUser) {
@ -185,14 +144,11 @@ async function unstashMovie(movieId, stashId, sessionUser) {
.where('stashes_movies.stash_id', knex.raw('deletable.stash_id')) .where('stashes_movies.stash_id', knex.raw('deletable.stash_id'))
.where('stashes.user_id', sessionUser.id)) .where('stashes.user_id', sessionUser.id))
.delete(); .delete();
return fetchStashes('movie', movieId, sessionUser);
} }
module.exports = { module.exports = {
createStash, createStash,
curateStash, curateStash,
removeStash,
stashActor, stashActor,
stashScene, stashScene,
stashMovie, stashMovie,

View File

@ -26,7 +26,7 @@ function curateUser(user) {
async function fetchUser(userId, raw) { async function fetchUser(userId, raw) {
const user = await knex('users') const user = await knex('users')
.select(knex.raw('users.*, users_roles.abilities as role_abilities, COALESCE(json_agg(stashes ORDER BY stashes.created_at) FILTER (WHERE stashes.id IS NOT NULL), \'[]\') as stashes')) .select(knex.raw('users.*, users_roles.abilities as role_abilities, COALESCE(json_agg(stashes) FILTER (WHERE stashes.id IS NOT NULL), \'[]\') as stashes'))
.modify((builder) => { .modify((builder) => {
if (typeof userId === 'number') { if (typeof userId === 'number') {
builder.where('users.id', userId); builder.where('users.id', userId);

View File

@ -22,7 +22,7 @@ async function logoutApi(req, res) {
async function fetchMeApi(req, res) { async function fetchMeApi(req, res) {
if (req.session.user) { if (req.session.user) {
req.session.user = await fetchUser(req.session.user.id, false, req.session.user); req.session.user = await fetchUser(req.session.user.id, req.session.user);
res.send(req.session.user); res.send(req.session.user);
return; return;

View File

@ -12,36 +12,16 @@ const schemaExtender = makeExtendSchemaPlugin(_build => ({
} }
extend type Actor { extend type Actor {
isFavorited: Boolean @requires(columns: ["stashesActors"])
isStashed(includeFavorites: Boolean = false): Boolean @requires(columns: ["stashesActors"])
ageFromBirth: Int @requires(columns: ["dateOfBirth"]) ageFromBirth: Int @requires(columns: ["dateOfBirth"])
ageAtDeath: Int @requires(columns: ["dateOfBirth", "dateOfDeath"]) ageAtDeath: Int @requires(columns: ["dateOfBirth", "dateOfDeath"])
height(units: Units): String @requires(columns: ["height"]) height(units:Units): String @requires(columns: ["height"])
weight(units: Units): String @requires(columns: ["weight"]) weight(units:Units): String @requires(columns: ["weight"])
penisLength(units: Units): String @requires(columns: ["penis_length"]) penisLength(units:Units): String @requires(columns: ["penis_length"])
penisGirth(units: Units): String @requires(columns: ["penis_girth"]) penisGirth(units:Units): String @requires(columns: ["penis_girth"])
} }
`, `,
resolvers: { resolvers: {
Actor: { Actor: {
isFavorited(parent) {
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
return null;
}
return parent['@stashes'].some(({ '@stash': stash }) => stash.primary);
},
isStashed(parent, args) {
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
return null;
}
if (args.includeFavorites) {
return parent['@stashes'].length > 0;
}
return parent['@stashes'].some(({ '@stash': stash }) => !stash.primary);
},
ageFromBirth(parent, _args, _context, _info) { ageFromBirth(parent, _args, _context, _info) {
if (!parent.dateOfBirth) return null; if (!parent.dateOfBirth) return null;

View File

@ -5,29 +5,17 @@ const { makeExtendSchemaPlugin, gql } = require('graphile-utils');
const schemaExtender = makeExtendSchemaPlugin(_build => ({ const schemaExtender = makeExtendSchemaPlugin(_build => ({
typeDefs: gql` typeDefs: gql`
extend type Release { extend type Release {
isFavorited: Boolean @requires(columns: ["stashesScenesBySceneId"]) isStashed: Boolean @requires(columns: ["stashesScenesBySceneId"])
isStashed(includeFavorites: Boolean = false): Boolean @requires(columns: ["stashesScenesBySceneId"])
} }
`, `,
resolvers: { resolvers: {
Release: { Release: {
isFavorited(parent) { isStashed(parent) {
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') { if (!parent['@stashes']) {
return null; return null;
} }
return parent['@stashes'].some(({ '@stash': stash }) => stash.primary); return parent['@stashes'].length > 0;
},
isStashed(parent, args) {
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
return null;
}
if (args.includeFavorites) {
return parent['@stashes'].length > 0;
}
return parent['@stashes'].some(({ '@stash': stash }) => !stash.primary);
}, },
}, },
}, },

View File

@ -45,7 +45,6 @@ const {
const { const {
createStash, createStash,
removeStash,
stashActor, stashActor,
stashScene, stashScene,
stashMovie, stashMovie,
@ -88,7 +87,6 @@ async function initServer() {
router.post('/api/stashes', createStash); router.post('/api/stashes', createStash);
router.patch('/api/stashes/:stashId', updateStash); router.patch('/api/stashes/:stashId', updateStash);
router.delete('/api/stashes/:stashId', removeStash);
router.post('/api/stashes/:stashId/actors', stashActor); router.post('/api/stashes/:stashId/actors', stashActor);
router.post('/api/stashes/:stashId/scenes', stashScene); router.post('/api/stashes/:stashId/scenes', stashScene);

View File

@ -2,7 +2,6 @@
const { const {
createStash, createStash,
removeStash,
stashActor, stashActor,
stashScene, stashScene,
stashMovie, stashMovie,
@ -24,51 +23,44 @@ async function updateStashApi(req, res) {
res.send(stash); res.send(stash);
} }
async function removeStashApi(req, res) { async function stashActorApi(req, res) {
await removeStash(req.params.stashId, req.session.user); await stashActor(req.body.actorId, req.params.stashId, req.session.user);
res.status(201).send();
}
async function stashSceneApi(req, res) {
await stashScene(req.body.sceneId, req.params.stashId, req.session.user);
res.status(201).send();
}
async function stashMovieApi(req, res) {
await stashMovie(req.body.movieId, req.params.stashId, req.session.user);
res.status(201).send();
}
async function unstashActorApi(req, res) {
await unstashActor(req.params.actorId, req.params.stashId, req.session.user);
res.status(204).send(); res.status(204).send();
} }
async function stashActorApi(req, res) {
const stashes = await stashActor(req.body.actorId, req.params.stashId, req.session.user);
res.send(stashes);
}
async function stashSceneApi(req, res) {
const stashes = await stashScene(req.body.sceneId, req.params.stashId, req.session.user);
res.send(stashes);
}
async function stashMovieApi(req, res) {
const stashes = await stashMovie(req.body.movieId, req.params.stashId, req.session.user);
res.send(stashes);
}
async function unstashActorApi(req, res) {
const stashes = await unstashActor(req.params.actorId, req.params.stashId, req.session.user);
res.send(stashes);
}
async function unstashSceneApi(req, res) { async function unstashSceneApi(req, res) {
const stashes = await unstashScene(req.params.sceneId, req.params.stashId, req.session.user); await unstashScene(req.params.sceneId, req.params.stashId, req.session.user);
res.send(stashes); res.status(204).send();
} }
async function unstashMovieApi(req, res) { async function unstashMovieApi(req, res) {
const stashes = await unstashMovie(req.params.movieId, req.params.stashId, req.session.user); await unstashMovie(req.params.movieId, req.params.stashId, req.session.user);
res.send(stashes); res.status(204).send();
} }
module.exports = { module.exports = {
createStash: createStashApi, createStash: createStashApi,
removeStash: removeStashApi,
stashActor: stashActorApi, stashActor: stashActorApi,
stashScene: stashSceneApi, stashScene: stashSceneApi,
stashMovie: stashMovieApi, stashMovie: stashMovieApi,