8 Commits

Author SHA1 Message Date
c2afeab96b Merge da17f11e1a into 376f687c38 2025-02-11 12:59:45 -08:00
376f687c38 chore: questionable is not a recognized rating 2025-02-11 21:50:27 +01:00
4fd848abf2 doc: use docker compose instead of docker-compose
The minimum version requirements are rough guesses, in practice any decently modern docker installation should work.
2025-02-11 21:25:10 +01:00
da17f11e1a Fix tag name escaping on upload 2022-12-30 13:49:59 -03:00
0d1fec51c5 Better layout for upload options 2022-12-30 13:47:08 -03:00
28d2de8a54 Remove nullcheck operator 2022-12-30 13:29:33 -03:00
b9ddf08c6c Allow default anonymous uploads 2022-12-30 13:15:25 -03:00
9f569f76b1 Default upload tags 2022-12-30 13:07:34 -03:00
6 changed files with 94 additions and 40 deletions

View File

@ -15,10 +15,13 @@ $cancel-button-color = tomato
&.inactive .skip-duplicates &.inactive .skip-duplicates
&.inactive .always-upload-similar &.inactive .always-upload-similar
&.inactive .pause-remain-on-error &.inactive .pause-remain-on-error
&.inactive .upload-all-anonymous
&.inactive #common-tags,
&.uploading input[type=submit], &.uploading input[type=submit],
&.uploading .skip-duplicates, &.uploading .skip-duplicates,
&.uploading .always-upload-similar &.uploading .always-upload-similar
&.uploading .pause-remain-on-error &.uploading .pause-remain-on-error
&.uploading .upload-all-anonymous
&:not(.uploading) .cancel &:not(.uploading) .cancel
display: none display: none
@ -30,6 +33,9 @@ $cancel-button-color = tomato
small small
font-size: 60% font-size: 60%
label[for=common-tags]
display: none !important
input[type=submit] input[type=submit]
margin-top: 1em margin-top: 1em
@ -49,9 +55,21 @@ $cancel-button-color = tomato
.pause-remain-on-error .pause-remain-on-error
margin-left: 1em margin-left: 1em
.upload-all-anonymous
margin-left: 1em
form>.messages form>.messages
margin-top: 1em margin-top: 1em
.control-strip
display: flex
flex-direction: column
gap: 0.5em
.control-options
display: flex
flex-direction: column
.uploadables-container .uploadables-container
list-style-type: none list-style-type: none
margin: 0 margin: 0

View File

@ -5,29 +5,41 @@
<div class='control-strip'> <div class='control-strip'>
<input type='submit' value='Upload all' class='submit'/> <input type='submit' value='Upload all' class='submit'/>
<span class='skip-duplicates'> <div class='control-options'>
<%= ctx.makeCheckbox({ <span class='skip-duplicates'>
text: 'Skip duplicate', <%= ctx.makeCheckbox({
name: 'skip-duplicates', text: 'Skip duplicate',
checked: false, name: 'skip-duplicates',
}) %> checked: false,
</span> }) %>
</span>
<span class='always-upload-similar'> <span class='always-upload-similar'>
<%= ctx.makeCheckbox({ <%= ctx.makeCheckbox({
text: 'Force upload similar', text: 'Force upload similar',
name: 'always-upload-similar', name: 'always-upload-similar',
checked: false, checked: false,
}) %> }) %>
</span> </span>
<span class='pause-remain-on-error'> <span class='pause-remain-on-error'>
<%= ctx.makeCheckbox({ <%= ctx.makeCheckbox({
text: 'Pause on error', text: 'Pause on error',
name: 'pause-remain-on-error', name: 'pause-remain-on-error',
checked: true, checked: true,
}) %> }) %>
</span> </span>
<span class='upload-all-anonymous'>
<%= ctx.makeCheckbox({
text: 'Upload anonymously',
name: 'upload-all-anonymous',
checked: false,
}) %>
</span>
</div>
<%= ctx.makeTextInput({placeholder: 'Common tags', id: 'common-tags', name: 'common-tags'}) %>
<input type='button' value='Cancel' class='cancel'/> <input type='button' value='Cancel' class='cancel'/>
</div> </div>

View File

@ -8,6 +8,10 @@ const FileDropperControl = require("../controls/file_dropper_control.js");
const template = views.getTemplate("post-upload"); const template = views.getTemplate("post-upload");
const rowTemplate = views.getTemplate("post-upload-row"); const rowTemplate = views.getTemplate("post-upload-row");
const misc = require('../util/misc.js');
const TagAutoCompleteControl =
require('../controls/tag_auto_complete_control.js');
function _mimeTypeToPostType(mimeType) { function _mimeTypeToPostType(mimeType) {
return ( return (
{ {
@ -185,6 +189,16 @@ class PostUploadView extends events.EventTarget {
this._evtFormSubmit(e) this._evtFormSubmit(e)
); );
this._formNode.classList.add("inactive"); this._formNode.classList.add("inactive");
if (this._commonTagsInputNode) {
this._autoCompleteControl = new TagAutoCompleteControl(
this._commonTagsInputNode,
{
confirm: tag =>
this._autoCompleteControl.replaceSelectedText(
misc.escapeSearchTerm(tag.names[0]), true),
});
}
} }
enableForm() { enableForm() {
@ -299,14 +313,18 @@ class PostUploadView extends events.EventTarget {
uploadable.safety = safetyNode.value; uploadable.safety = safetyNode.value;
} }
const anonymousNode = rowNode.querySelector( let anonymous = this._uploadAllAnonymous.checked;
".anonymous input:checked" if (!anonymous) {
); anonymous = rowNode.querySelector(".anonymous input:checked");
if (anonymousNode) {
uploadable.anonymous = true;
} }
uploadable.anonymous = anonymous;
uploadable.tags = []; uploadable.tags = [];
if (this._commonTagsInputNode) {
var tags = this._commonTagsInputNode.value.split(' ');
tags = tags.filter(t => t != "").map(t => t.replace('\\', ''));
uploadable.tags = uploadable.tags.concat(tags);
}
uploadable.relations = []; uploadable.relations = [];
for (let [i, lookalike] of uploadable.lookalikes.entries()) { for (let [i, lookalike] of uploadable.lookalikes.entries()) {
let lookalikeNode = rowNode.querySelector( let lookalikeNode = rowNode.querySelector(
@ -441,6 +459,10 @@ class PostUploadView extends events.EventTarget {
); );
} }
get _uploadAllAnonymous() {
return this._hostNode.querySelector("form [name=upload-all-anonymous]");
}
get _submitButtonNode() { get _submitButtonNode() {
return this._hostNode.querySelector("form [type=submit]"); return this._hostNode.querySelector("form [type=submit]");
} }
@ -452,6 +474,10 @@ class PostUploadView extends events.EventTarget {
get _contentInputNode() { get _contentInputNode() {
return this._formNode.querySelector(".dropper-container"); return this._formNode.querySelector(".dropper-container");
} }
get _commonTagsInputNode() {
return this._formNode.querySelector('form [name=common-tags]');
}
} }
module.exports = PostUploadView; module.exports = PostUploadView;

View File

@ -789,7 +789,7 @@ data.
| `fav-time` | alias of `fav-date` | | `fav-time` | alias of `fav-date` |
| `feature-date` | featured at given date | | `feature-date` | featured at given date |
| `feature-time` | alias of `feature-time` | | `feature-time` | alias of `feature-time` |
| `safety` | having given safety. `<value>` can be either `safe`, `sketchy` (or `questionable`) or `unsafe`. | | `safety` | having given safety. `<value>` can be either `safe`, `sketchy` or `unsafe`. |
| `rating` | alias of `safety` | | `rating` | alias of `safety` |
**Sort style tokens** **Sort style tokens**

View File

@ -1,5 +1,5 @@
This assumes that you have Docker (version 17.05 or greater) This assumes that you have Docker (version 19.03 or greater)
and Docker Compose (version 1.6.0 or greater) already installed. and the Docker Compose CLI (version 1.27.0 or greater) already installed.
### Prepare things ### Prepare things
@ -38,7 +38,7 @@ and Docker Compose (version 1.6.0 or greater) already installed.
This pulls the latest containers from docker.io: This pulls the latest containers from docker.io:
```console ```console
user@host:szuru$ docker-compose pull user@host:szuru$ docker compose pull
``` ```
If you have modified the application's source and would like to manually If you have modified the application's source and would like to manually
@ -49,17 +49,17 @@ and Docker Compose (version 1.6.0 or greater) already installed.
For first run, it is recommended to start the database separately: For first run, it is recommended to start the database separately:
```console ```console
user@host:szuru$ docker-compose up -d sql user@host:szuru$ docker compose up -d sql
``` ```
To start all containers: To start all containers:
```console ```console
user@host:szuru$ docker-compose up -d user@host:szuru$ docker compose up -d
``` ```
To view/monitor the application logs: To view/monitor the application logs:
```console ```console
user@host:szuru$ docker-compose logs -f user@host:szuru$ docker compose logs -f
# (CTRL+C to exit) # (CTRL+C to exit)
``` ```
@ -84,13 +84,13 @@ and Docker Compose (version 1.6.0 or greater) already installed.
2. Build the containers: 2. Build the containers:
```console ```console
user@host:szuru$ docker-compose build user@host:szuru$ docker compose build
``` ```
That will attempt to build both containers, but you can specify `client` That will attempt to build both containers, but you can specify `client`
or `server` to make it build only one. or `server` to make it build only one.
If `docker-compose build` spits out: If `docker compose build` spits out:
``` ```
ERROR: Service 'server' failed to build: failed to parse platform : "" is an invalid component of "": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument ERROR: Service 'server' failed to build: failed to parse platform : "" is an invalid component of "": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument
@ -102,7 +102,7 @@ and Docker Compose (version 1.6.0 or greater) already installed.
user@host:szuru$ export DOCKER_BUILDKIT=1; export COMPOSE_DOCKER_CLI_BUILD=1 user@host:szuru$ export DOCKER_BUILDKIT=1; export COMPOSE_DOCKER_CLI_BUILD=1
``` ```
...and run `docker-compose build` again. ...and run `docker compose build` again.
*Note: If your changes are not taking effect in your builds, consider building *Note: If your changes are not taking effect in your builds, consider building
with `--no-cache`.* with `--no-cache`.*
@ -117,7 +117,7 @@ with `--no-cache`.*
run from docker: run from docker:
```console ```console
user@host:szuru$ docker-compose run server ./szuru-admin --help user@host:szuru$ docker compose run server ./szuru-admin --help
``` ```
will give you a breakdown on all available commands. will give you a breakdown on all available commands.

View File

@ -1,9 +1,7 @@
## Example Docker Compose configuration ## Example Docker Compose configuration
## ##
## Use this as a template to set up docker-compose, or as guide to set up other ## Use this as a template to set up docker compose, or as guide to set up other
## orchestration services ## orchestration services
version: '2'
services: services:
server: server: