chore: wip
This commit is contained in:
parent
a4f0101956
commit
db2531d2ac
11 changed files with 72 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
FROM --platform=$BUILDPLATFORM node:lts as builder
|
FROM --platform=$BUILDPLATFORM node:lts AS builder
|
||||||
WORKDIR /opt/app
|
WORKDIR /opt/app
|
||||||
|
|
||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
|
@ -11,7 +11,7 @@ ARG CLIENT_BUILD_ARGS=""
|
||||||
RUN BASE_URL="__BASEURL__" node build.js --gzip ${CLIENT_BUILD_ARGS}
|
RUN BASE_URL="__BASEURL__" node build.js --gzip ${CLIENT_BUILD_ARGS}
|
||||||
|
|
||||||
|
|
||||||
FROM --platform=$BUILDPLATFORM scratch as approot
|
FROM --platform=$BUILDPLATFORM scratch AS approot
|
||||||
|
|
||||||
COPY docker-start.sh /
|
COPY docker-start.sh /
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ WORKDIR /var/www
|
||||||
COPY --from=builder /opt/app/public/ .
|
COPY --from=builder /opt/app/public/ .
|
||||||
|
|
||||||
|
|
||||||
FROM nginx:alpine as release
|
FROM nginx:alpine AS release
|
||||||
|
|
||||||
RUN apk --no-cache add dumb-init
|
RUN apk --no-cache add dumb-init
|
||||||
COPY --from=approot / /
|
COPY --from=approot / /
|
||||||
|
|
|
@ -4,6 +4,24 @@
|
||||||
|
|
||||||
<div class='messages'></div>
|
<div class='messages'></div>
|
||||||
|
|
||||||
|
<section class='title'>
|
||||||
|
<%= ctx.makeTextInput({
|
||||||
|
text: 'Title',
|
||||||
|
name: 'title',
|
||||||
|
placeholder: '',
|
||||||
|
value: ctx.post.title,
|
||||||
|
}) %>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class='description'>
|
||||||
|
<%= ctx.makeTextInput({
|
||||||
|
text: 'Description',
|
||||||
|
name: 'description',
|
||||||
|
placeholder: '',
|
||||||
|
value: ctx.post.description,
|
||||||
|
}) %>
|
||||||
|
</section>
|
||||||
|
|
||||||
<% if (ctx.enableSafety && ctx.canEditPostSafety) { %>
|
<% if (ctx.enableSafety && ctx.canEditPostSafety) { %>
|
||||||
<section class='safety'>
|
<section class='safety'>
|
||||||
<label>Safety</label>
|
<label>Safety</label>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<div class='readonly-sidebar'>
|
<div class='readonly-sidebar'>
|
||||||
|
<h1 style='line-height: 1.2em'><%= ctx.post.title %></h1>
|
||||||
<article class='details'>
|
<article class='details'>
|
||||||
<section class='download'>
|
<section class='download'>
|
||||||
<a rel='external' href='<%- ctx.post.contentUrl %>'>
|
<a rel='external' href='<%- ctx.post.contentUrl %>'>
|
||||||
|
|
|
@ -4,9 +4,20 @@
|
||||||
<% for (let post of ctx.response.results) { %>
|
<% for (let post of ctx.response.results) { %>
|
||||||
<li data-post-id='<%= post.id %>'>
|
<li data-post-id='<%= post.id %>'>
|
||||||
<a class='thumbnail-wrapper <%= post.tags.length > 0 ? "tags" : "no-tags" %>'
|
<a class='thumbnail-wrapper <%= post.tags.length > 0 ? "tags" : "no-tags" %>'
|
||||||
title='@<%- post.id %> (<%- post.type %>) Tags: <%- post.tags.map(tag => '#' + tag.names[0]).join(' ') || 'none' %>'
|
title='<%- post.title %> (<%- post.type %>) Tags: <%- post.tags.map(tag => '#' + tag.names[0]).join(' ') || 'none' %>'
|
||||||
href='<%= ctx.canViewPosts ? ctx.getPostUrl(post.id, ctx.parameters) : '' %>'>
|
href='<%= ctx.canViewPosts ? ctx.getPostUrl(post.id, ctx.parameters) : '' %>'>
|
||||||
<%= ctx.makeThumbnail(post.thumbnailUrl) %>
|
<%= ctx.makeThumbnail(post.thumbnailUrl) %>
|
||||||
|
<span class="post-title" style="
|
||||||
|
position: absolute;
|
||||||
|
bottom: 2.3em;
|
||||||
|
left: 0;
|
||||||
|
padding: .33em .5em;
|
||||||
|
color: #fff;
|
||||||
|
line-height: 1.2em;
|
||||||
|
margin: 0.5em;
|
||||||
|
font-size: 12px;
|
||||||
|
background: rgba(0,0,0,0.5);
|
||||||
|
"><%= post.title %></span>
|
||||||
<span class='type' data-type='<%- post.type %>'>
|
<span class='type' data-type='<%- post.type %>'>
|
||||||
<% if (post.type == 'video' || post.type == 'flash' || post.type == 'animation') { %>
|
<% if (post.type == 'video' || post.type == 'flash' || post.type == 'animation') { %>
|
||||||
<span class='icon'><i class='fa fa-film'></i></span>
|
<span class='icon'><i class='fa fa-film'></i></span>
|
||||||
|
|
|
@ -14,6 +14,7 @@ const EmptyView = require("../views/empty_view.js");
|
||||||
const fields = [
|
const fields = [
|
||||||
"id",
|
"id",
|
||||||
"thumbnailUrl",
|
"thumbnailUrl",
|
||||||
|
"title",
|
||||||
"type",
|
"type",
|
||||||
"safety",
|
"safety",
|
||||||
"score",
|
"score",
|
||||||
|
|
|
@ -55,7 +55,7 @@ class PostEditSidebarControl extends events.EventTarget {
|
||||||
"post-info",
|
"post-info",
|
||||||
"Basic info",
|
"Basic info",
|
||||||
this._hostNode.querySelectorAll(
|
this._hostNode.querySelectorAll(
|
||||||
".safety, .relations, .flags, .post-source"
|
".title, .description, .safety, .relations, .flags, .post-source"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
this._tagsExpander = new ExpanderControl(
|
this._tagsExpander = new ExpanderControl(
|
||||||
|
@ -398,6 +398,10 @@ class PostEditSidebarControl extends events.EventTarget {
|
||||||
detail: {
|
detail: {
|
||||||
post: this._post,
|
post: this._post,
|
||||||
|
|
||||||
|
title: this._titleInputNode.value,
|
||||||
|
|
||||||
|
description: this._descriptionInputNode.value,
|
||||||
|
|
||||||
safety: this._safetyButtonNodes.length
|
safety: this._safetyButtonNodes.length
|
||||||
? Array.from(this._safetyButtonNodes)
|
? Array.from(this._safetyButtonNodes)
|
||||||
.filter((node) => node.checked)[0]
|
.filter((node) => node.checked)[0]
|
||||||
|
@ -481,6 +485,14 @@ class PostEditSidebarControl extends events.EventTarget {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get _titleInputNode() {
|
||||||
|
return this._formNode.querySelector(".title input");
|
||||||
|
}
|
||||||
|
|
||||||
|
get _descriptionInputNode() {
|
||||||
|
return this._formNode.querySelector(".description input");
|
||||||
|
}
|
||||||
|
|
||||||
get _relationsInputNode() {
|
get _relationsInputNode() {
|
||||||
return this._formNode.querySelector(".relations input");
|
return this._formNode.querySelector(".relations input");
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,6 +162,14 @@ class Post extends events.EventTarget {
|
||||||
this._flags = value;
|
this._flags = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set title(value) {
|
||||||
|
this._title = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set description(value) {
|
||||||
|
this._description = value;
|
||||||
|
}
|
||||||
|
|
||||||
set safety(value) {
|
set safety(value) {
|
||||||
this._safety = value;
|
this._safety = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,9 @@ services:
|
||||||
- "./server/config.yaml:/opt/app/config.yaml"
|
- "./server/config.yaml:/opt/app/config.yaml"
|
||||||
|
|
||||||
client:
|
client:
|
||||||
image: szurubooru/client:latest
|
# image: szurubooru/client:latest
|
||||||
|
build:
|
||||||
|
context: ./client
|
||||||
depends_on:
|
depends_on:
|
||||||
- server
|
- server
|
||||||
environment:
|
environment:
|
||||||
|
|
3
rebuild-and-run.sh
Executable file
3
rebuild-and-run.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
docker compose down --volumes
|
||||||
|
docker compose build client
|
||||||
|
docker compose up -d
|
2
server/.ash_history
Normal file
2
server/.ash_history
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
id -u
|
||||||
|
ls -ln /
|
|
@ -169,6 +169,8 @@ class PostSerializer(serialization.BaseSerializer):
|
||||||
"version": self.serialize_version,
|
"version": self.serialize_version,
|
||||||
"creationTime": self.serialize_creation_time,
|
"creationTime": self.serialize_creation_time,
|
||||||
"lastEditTime": self.serialize_last_edit_time,
|
"lastEditTime": self.serialize_last_edit_time,
|
||||||
|
"title": self.serialize_title,
|
||||||
|
"description": self.serialize_description,
|
||||||
"safety": self.serialize_safety,
|
"safety": self.serialize_safety,
|
||||||
"source": self.serialize_source,
|
"source": self.serialize_source,
|
||||||
"type": self.serialize_type,
|
"type": self.serialize_type,
|
||||||
|
@ -213,6 +215,12 @@ class PostSerializer(serialization.BaseSerializer):
|
||||||
def serialize_last_edit_time(self) -> Any:
|
def serialize_last_edit_time(self) -> Any:
|
||||||
return self.post.last_edit_time
|
return self.post.last_edit_time
|
||||||
|
|
||||||
|
def serialize_title(self) -> Any:
|
||||||
|
return self.post.title
|
||||||
|
|
||||||
|
def serialize_description(self) -> Any:
|
||||||
|
return self.post.description
|
||||||
|
|
||||||
def serialize_safety(self) -> Any:
|
def serialize_safety(self) -> Any:
|
||||||
return SAFETY_MAP[self.post.safety]
|
return SAFETY_MAP[self.post.safety]
|
||||||
|
|
||||||
|
|
Reference in a new issue