squash
This commit is contained in:
commit
755f0ca387
21
.dockerignore
Normal file
21
.dockerignore
Normal file
|
@ -0,0 +1,21 @@
|
|||
test/
|
||||
storage/
|
||||
dist/
|
||||
client/dev/
|
||||
client/node_modules/
|
||||
__pycache__
|
||||
venv
|
||||
.env
|
||||
.env.*
|
||||
.git
|
||||
.gitignore
|
||||
Dockerfile
|
||||
Dockerfile*
|
||||
docker-compose*
|
||||
.dockerignore
|
||||
*.code-workspace
|
||||
.vscode
|
||||
.idea
|
||||
node_modules
|
||||
npm-debug.log
|
||||
README.md
|
23
.editorconfig
Normal file
23
.editorconfig
Normal file
|
@ -0,0 +1,23 @@
|
|||
https://EditorConfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*.py]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.html]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.svg]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.js]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.scss]
|
||||
indent_style = space
|
||||
indent_size = 2
|
18
.flake8
Normal file
18
.flake8
Normal file
|
@ -0,0 +1,18 @@
|
|||
[flake8]
|
||||
ignore =
|
||||
# Some template strings can easily go over the limit
|
||||
E501
|
||||
# Doesn't work well with __init__.py files
|
||||
F401
|
||||
# flake struggles with endpoints returning tuples on exceptions
|
||||
E722
|
||||
exclude =
|
||||
.git,
|
||||
__pycache__,
|
||||
venv
|
||||
max-complexity = 14
|
||||
|
||||
[pycodestyle]
|
||||
max_line_length = 120
|
||||
ignore =
|
||||
E501
|
166
.gitignore
vendored
Normal file
166
.gitignore
vendored
Normal file
|
@ -0,0 +1,166 @@
|
|||
# Kemono.
|
||||
.DS_Store
|
||||
tusker.toml
|
||||
config.json
|
||||
flask.cfg
|
||||
/config.py
|
||||
redis_map.py
|
||||
|
||||
# Dev only files
|
||||
test/
|
||||
.idea
|
||||
dev_*
|
||||
|
||||
# Webpack dev server temp files
|
||||
client/dev
|
||||
|
||||
# Dev file server
|
||||
storage/
|
||||
|
||||
# Javascript packages
|
||||
node_modules
|
||||
|
||||
# VSCode workspace
|
||||
*.code-workspace
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
|
||||
.env
|
||||
.env.vpn
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
# include client `env` folder
|
||||
!client/src/env
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
16
.pre-commit-config.yaml
Normal file
16
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,16 @@
|
|||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: 38b88246ccc552bffaaf54259d064beeee434539 # frozen: v4.0.1
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
- repo: https://github.com/pycqa/flake8
|
||||
rev: "cbeb4c9c4137cff1568659fcc48e8b85cddd0c8d" # frozen: 4.0.1
|
||||
hooks:
|
||||
- id: flake8
|
||||
- repo: https://github.com/pre-commit/mirrors-autopep8
|
||||
rev: "7d14f78422aef2153a90e33373d2515bcc99038d" # frozen: v1.5.7
|
||||
hooks:
|
||||
- id: autopep8
|
25
Dockerfile
Normal file
25
Dockerfile
Normal file
|
@ -0,0 +1,25 @@
|
|||
FROM nikolaik/python-nodejs:python3.12-nodejs18
|
||||
|
||||
RUN apt-get update && apt-get install -y libpq-dev curl jq
|
||||
|
||||
RUN curl -s -L $(curl https://api.github.com/repos/tus/tusd/releases/latest -s | jq '.assets[] | select(.name=="tusd_linux_amd64.tar.gz") | .browser_download_url' -r) | tar -xzvf - -C /usr/local/bin/ --strip-components=1 tusd_linux_amd64/tusd && chmod +x /usr/local/bin/tusd
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt requirements.txt
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
RUN npm install -g npm
|
||||
|
||||
RUN mkdir client
|
||||
COPY ./client /app/client
|
||||
|
||||
RUN cd client && npm ci --also=dev && cd ..
|
||||
|
||||
COPY . /app
|
||||
|
||||
ENV LANG=C.UTF-8
|
||||
ARG GIT_COMMIT_HASH
|
||||
ENV GIT_COMMIT_HASH=${GIT_COMMIT_HASH:-undefined}
|
||||
|
||||
CMD python -m src daemon
|
661
LICENSE
Normal file
661
LICENSE
Normal file
|
@ -0,0 +1,661 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
9
README.md
Normal file
9
README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
<img src="client/static/kemono-logo.svg" width="120" />
|
||||
|
||||
# Kemono Project
|
||||
|
||||
_Frontend designed for Paysite leaking._
|
||||
|
||||
<img src="docs/resources/Preview.png" width="700" />
|
||||
|
||||
[Website]: https://kemono.su/
|
29
client/.dockerignore
Normal file
29
client/.dockerignore
Normal file
|
@ -0,0 +1,29 @@
|
|||
# webpack output
|
||||
**/dev
|
||||
**/dist
|
||||
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.code-workspace
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
README.md
|
3
client/.vscode/extensions.json
vendored
Normal file
3
client/.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"recommendations": []
|
||||
}
|
31
client/.vscode/settings.json
vendored
Normal file
31
client/.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"files.exclude": {
|
||||
"node_modules": true
|
||||
},
|
||||
// this option does work and is required for emmet in jinja to work
|
||||
"files.associations": {
|
||||
"*.html": "jinja-html"
|
||||
},
|
||||
"emmet.includeLanguages": {
|
||||
"jinja-html": "html"
|
||||
},
|
||||
"search.exclude": {
|
||||
"**/node_modules": true,
|
||||
"**/bower_components": true,
|
||||
"**/*.code-search": true,
|
||||
"**/dev": true,
|
||||
"**/dist": true
|
||||
},
|
||||
"javascript.preferences.importModuleSpecifierEnding": "js",
|
||||
"javascript.preferences.quoteStyle": "double",
|
||||
"javascript.format.semicolons": "insert",
|
||||
"[jinja-html]": {
|
||||
"editor.tabSize": 2
|
||||
},
|
||||
"[javascript]": {
|
||||
"editor.tabSize": 2
|
||||
},
|
||||
"[scss]": {
|
||||
"editor.tabSize": 2
|
||||
}
|
||||
}
|
16
client/Dockerfile
Normal file
16
client/Dockerfile
Normal file
|
@ -0,0 +1,16 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM node:16.14
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ["package.json", "package-lock.json", "/app/"]
|
||||
|
||||
RUN npm install -g npm
|
||||
RUN npm ci --also=dev
|
||||
|
||||
COPY . /app
|
||||
|
||||
CMD [ "npm", "run", "build" ]
|
15
client/Dockerfile.dev
Normal file
15
client/Dockerfile.dev
Normal file
|
@ -0,0 +1,15 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM node:12.22
|
||||
|
||||
ENV NODE_ENV=development
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ["package.json", "package-lock.json*", "./"]
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD ["npm", "run", "dev"]
|
92
client/configs/build-templates.js
Normal file
92
client/configs/build-templates.js
Normal file
|
@ -0,0 +1,92 @@
|
|||
const path = require("path");
|
||||
const fse = require("fs-extra");
|
||||
const HTMLWebpackPlugin = require("html-webpack-plugin");
|
||||
|
||||
/**
|
||||
* @typedef BuildOptions
|
||||
* @property {string} fileExtension
|
||||
* @property {string} outputPrefix
|
||||
* @property {HTMLWebpackPlugin.Options} pluginOptions Webpack plugin options.
|
||||
*/
|
||||
|
||||
/** */
|
||||
class TemplateFile {
|
||||
/**
|
||||
* @param {fse.Dirent} dirent
|
||||
* @param {string} path Absolute path to the file.
|
||||
*/
|
||||
constructor(dirent, path) {
|
||||
this.dirent = dirent;
|
||||
this.path = path;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of HTML webpack plugins from the provided folder.
|
||||
* @param {string} basePath Absolute path to the template folder.
|
||||
* @param {BuildOptions} options Build optons.
|
||||
*/
|
||||
function buildHTMLWebpackPluginsRecursive(basePath, options) {
|
||||
/**
|
||||
* @type {HTMLWebpackPlugin[]}
|
||||
*/
|
||||
const plugins = [];
|
||||
const files = walkFolder(basePath);
|
||||
|
||||
files.forEach((file) => {
|
||||
const isTemplateFile = file.dirent.isFile() && file.path.endsWith(`${options.fileExtension}`);
|
||||
|
||||
if (isTemplateFile) {
|
||||
const outputBase = path.relative(basePath, file.path);
|
||||
const outputPath = path.join(path.basename(basePath), outputBase);
|
||||
|
||||
const webpackPlugin = new HTMLWebpackPlugin({
|
||||
...options.pluginOptions,
|
||||
template: file.path,
|
||||
filename: outputPath,
|
||||
});
|
||||
|
||||
plugins.push(webpackPlugin);
|
||||
}
|
||||
});
|
||||
|
||||
return plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} folderPath Absolute path to the folder.
|
||||
* @param {TemplateFile[]} files
|
||||
*/
|
||||
function walkFolder(folderPath, files = [], currentCount = 0) {
|
||||
const nestedLimit = 1000;
|
||||
const folderContents = fse.readdirSync(folderPath, { withFileTypes: true });
|
||||
|
||||
folderContents.forEach((entry) => {
|
||||
const file = entry.isFile() && entry;
|
||||
const folder = entry.isDirectory() && entry;
|
||||
|
||||
if (file) {
|
||||
const filePath = path.join(folderPath, file.name);
|
||||
files.push(new TemplateFile(file, filePath));
|
||||
return;
|
||||
}
|
||||
|
||||
if (folder) {
|
||||
currentCount++;
|
||||
|
||||
if (currentCount > nestedLimit) {
|
||||
throw new Error(`The folder at "${folderPath}" contains more than ${nestedLimit} folders.`);
|
||||
}
|
||||
|
||||
const newFolderPath = path.join(folderPath, folder.name);
|
||||
|
||||
return walkFolder(newFolderPath, files, currentCount);
|
||||
}
|
||||
});
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
buildHTMLWebpackPluginsRecursive,
|
||||
};
|
5
client/configs/emmet/snippets.json
Normal file
5
client/configs/emmet/snippets.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"html": {
|
||||
"snippets": {}
|
||||
}
|
||||
}
|
21
client/configs/vars.js
Normal file
21
client/configs/vars.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
const path = require("path");
|
||||
|
||||
require("dotenv").config({
|
||||
path: path.resolve(__dirname, "..", ".."),
|
||||
});
|
||||
|
||||
const kemonoSite = process.env.KEMONO_SITE || "http://localhost:5000";
|
||||
const nodeEnv = process.env.NODE_ENV || "production";
|
||||
const iconsPrepend = process.env.ICONS_PREPEND || "";
|
||||
const bannersPrepend = process.env.BANNERS_PREPEND || "";
|
||||
const thumbnailsPrepend = process.env.THUMBNAILS_PREPEND || "";
|
||||
const creatorsLocation = process.env.CREATORS_LOCATION || "";
|
||||
|
||||
module.exports = {
|
||||
kemonoSite,
|
||||
nodeEnv,
|
||||
iconsPrepend,
|
||||
bannersPrepend,
|
||||
thumbnailsPrepend,
|
||||
creatorsLocation,
|
||||
};
|
9
client/jsconfig.json
Normal file
9
client/jsconfig.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"module": "commonJS",
|
||||
"target": "es2015",
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"exclude": ["node_modules", "dist", "dev", "src"]
|
||||
}
|
9299
client/package-lock.json
generated
Normal file
9299
client/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
52
client/package.json
Normal file
52
client/package.json
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": "kemono-2-client",
|
||||
"version": "0.2.1",
|
||||
"description": "frontend for kemono 2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "webpack serve --config webpack.dev.js",
|
||||
"build": "webpack --config webpack.prod.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "BassOfBass",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.22.10",
|
||||
"@uppy/core": "^3.4.0",
|
||||
"@uppy/dashboard": "^3.5.1",
|
||||
"@uppy/form": "^3.0.2",
|
||||
"@uppy/tus": "^3.1.3",
|
||||
"diff": "^5.1.0",
|
||||
"fluid-player": "^3.22.0",
|
||||
"micromodal": "^0.4.10",
|
||||
"purecss": "^3.0.0",
|
||||
"sha256-wasm": "^2.2.2",
|
||||
"whatwg-fetch": "^3.6.17"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.22.10",
|
||||
"@babel/plugin-transform-runtime": "^7.22.10",
|
||||
"@babel/preset-env": "^7.22.10",
|
||||
"babel-loader": "^8.3.0",
|
||||
"buffer": "^6.0.3",
|
||||
"copy-webpack-plugin": "^8.1.1",
|
||||
"css-loader": "^5.2.7",
|
||||
"dotenv": "^8.6.0",
|
||||
"fs-extra": "^10.1.0",
|
||||
"html-webpack-plugin": "^5.5.3",
|
||||
"mini-css-extract-plugin": "^1.6.2",
|
||||
"postcss": "^8.4.28",
|
||||
"postcss-loader": "^7.3.3",
|
||||
"postcss-preset-env": "^9.1.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"sass": "^1.66.0",
|
||||
"sass-loader": "^11.1.1",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"style-loader": "^2.0.0",
|
||||
"webpack": "^5.88.2",
|
||||
"webpack-cli": "^5.1.4",
|
||||
"webpack-dev-server": "^4.15.1",
|
||||
"webpack-manifest-plugin": "^5.0.0",
|
||||
"webpack-merge": "^5.9.0"
|
||||
}
|
||||
}
|
2
client/src/api/_index.js
Normal file
2
client/src/api/_index.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
export { kemonoAPI } from "./kemono/_index";
|
||||
export { paysitesAPI } from "./paysites/_index";
|
14
client/src/api/kemono/_index.js
Normal file
14
client/src/api/kemono/_index.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { favorites } from "./favorites";
|
||||
import { posts } from "./posts";
|
||||
import { api } from "./api";
|
||||
import { dms } from "./dms";
|
||||
|
||||
/**
|
||||
* @type {KemonoAPI}
|
||||
*/
|
||||
export const kemonoAPI = {
|
||||
favorites,
|
||||
posts,
|
||||
api,
|
||||
dms,
|
||||
};
|
100
client/src/api/kemono/api.js
Normal file
100
client/src/api/kemono/api.js
Normal file
|
@ -0,0 +1,100 @@
|
|||
import { KemonoError } from "@wp/utils";
|
||||
import { kemonoFetch } from "./kemono-fetch";
|
||||
import { CREATORS_LOCATION } from "@wp/env/env-vars";
|
||||
|
||||
export const api = {
|
||||
bans,
|
||||
bannedArtist,
|
||||
creators,
|
||||
logs,
|
||||
};
|
||||
|
||||
async function bans() {
|
||||
try {
|
||||
const response = await kemonoFetch("/api/v1/creators/bans", { method: "GET" });
|
||||
|
||||
if (!response || !response.ok) {
|
||||
alert(new KemonoError(6));
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {KemonoAPI.API.BanItem[]}
|
||||
*/
|
||||
const banItems = await response.json();
|
||||
|
||||
return banItems;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} service
|
||||
*/
|
||||
async function bannedArtist(id, service) {
|
||||
const params = new URLSearchParams([["service", service]]).toString();
|
||||
|
||||
try {
|
||||
const response = await kemonoFetch(`/api/v1/lookup/cache/${id}?${params}`);
|
||||
|
||||
if (!response || !response.ok) {
|
||||
alert(new KemonoError(7));
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {KemonoAPI.API.BannedArtist}
|
||||
*/
|
||||
const artist = await response.json();
|
||||
|
||||
return artist;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function creators() {
|
||||
try {
|
||||
const response = await kemonoFetch(CREATORS_LOCATION || "/api/v1/creators", {
|
||||
method: "GET",
|
||||
});
|
||||
|
||||
if (!response || !response.ok) {
|
||||
alert(new KemonoError(8));
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {KemonoAPI.User[]}
|
||||
*/
|
||||
const artists = await response.json();
|
||||
|
||||
return artists;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function logs(importID) {
|
||||
try {
|
||||
const response = await kemonoFetch(`/api/v1/importer/logs/${importID}`, {
|
||||
method: "GET",
|
||||
});
|
||||
|
||||
if (!response || !response.ok) {
|
||||
alert(new KemonoError(9));
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {KemonoAPI.API.LogItem[]}
|
||||
*/
|
||||
const logs = await response.json();
|
||||
|
||||
return logs;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
22
client/src/api/kemono/dms.js
Normal file
22
client/src/api/kemono/dms.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
import { KemonoError } from "@wp/utils";
|
||||
import { kemonoFetch } from "./kemono-fetch";
|
||||
|
||||
/**
|
||||
* @type {KemonoAPI.DMs}
|
||||
*/
|
||||
export const dms = {
|
||||
retrieveHasPendingDMs,
|
||||
};
|
||||
|
||||
async function retrieveHasPendingDMs() {
|
||||
try {
|
||||
const response = await kemonoFetch(`/api/v1/has_pending_dms`);
|
||||
|
||||
if (!response || !response.ok) {
|
||||
throw new Error(`Error ${response.status}: ${response.statusText}`);
|
||||
}
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
142
client/src/api/kemono/favorites.js
Normal file
142
client/src/api/kemono/favorites.js
Normal file
|
@ -0,0 +1,142 @@
|
|||
import { KemonoError } from "@wp/utils";
|
||||
import { kemonoFetch } from "./kemono-fetch";
|
||||
|
||||
/**
|
||||
* @type {KemonoAPI.Favorites}
|
||||
*/
|
||||
export const favorites = {
|
||||
retrieveFavoriteArtists,
|
||||
favoriteArtist,
|
||||
unfavoriteArtist,
|
||||
retrieveFavoritePosts,
|
||||
favoritePost,
|
||||
unfavoritePost,
|
||||
};
|
||||
|
||||
async function retrieveFavoriteArtists() {
|
||||
const params = new URLSearchParams([["type", "artist"]]).toString();
|
||||
|
||||
try {
|
||||
const response = await kemonoFetch(`/api/v1/account/favorites?${params}`);
|
||||
|
||||
if (!response || !response.ok) {
|
||||
throw new Error(`Error ${response.status}: ${response.statusText}`);
|
||||
}
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
const favs = await response.text();
|
||||
return favs;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} service
|
||||
* @param {string} userID
|
||||
*/
|
||||
async function favoriteArtist(service, userID) {
|
||||
try {
|
||||
const response = await kemonoFetch(`/api/v1/favorites/creator/${service}/${userID}`, { method: "POST" });
|
||||
|
||||
if (!response || !response.ok) {
|
||||
alert(new KemonoError(3));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} service
|
||||
* @param {string} userID
|
||||
*/
|
||||
async function unfavoriteArtist(service, userID) {
|
||||
try {
|
||||
const response = await kemonoFetch(`/api/v1/favorites/creator/${service}/${userID}`, { method: "DELETE" });
|
||||
|
||||
if (!response || !response.ok) {
|
||||
alert(new KemonoError(4));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function retrieveFavoritePosts() {
|
||||
const params = new URLSearchParams([["type", "post"]]).toString();
|
||||
|
||||
try {
|
||||
const response = await kemonoFetch(`/api/v1/account/favorites?${params}`);
|
||||
|
||||
if (!response || !response.ok) {
|
||||
throw new Error(`Error ${response.status}: ${response.statusText}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {KemonoAPI.Post[]}
|
||||
*/
|
||||
const favs = await response.json();
|
||||
/**
|
||||
* @type {KemonoAPI.Favorites.Post[]}
|
||||
*/
|
||||
const transformedFavs = favs.map((post) => {
|
||||
return {
|
||||
id: post.id,
|
||||
service: post.service,
|
||||
user: post.user,
|
||||
};
|
||||
});
|
||||
|
||||
return JSON.stringify(transformedFavs);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} service
|
||||
* @param {string} user
|
||||
* @param {string} post_id
|
||||
*/
|
||||
async function favoritePost(service, user, post_id) {
|
||||
try {
|
||||
const response = await kemonoFetch(`/api/v1/favorites/post/${service}/${user}/${post_id}`, { method: "POST" });
|
||||
|
||||
if (!response || !response.ok) {
|
||||
alert(new KemonoError(1));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} service
|
||||
* @param {string} user
|
||||
* @param {string} post_id
|
||||
*/
|
||||
async function unfavoritePost(service, user, post_id) {
|
||||
try {
|
||||
const response = await kemonoFetch(`/api/v1/favorites/post/${service}/${user}/${post_id}`, { method: "DELETE" });
|
||||
|
||||
if (!response || !response.ok) {
|
||||
alert(new KemonoError(2));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
46
client/src/api/kemono/kemono-fetch.js
Normal file
46
client/src/api/kemono/kemono-fetch.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
import { isLoggedIn } from "@wp/js/account";
|
||||
|
||||
/**
|
||||
* Generic request for Kemono API.
|
||||
* @param {RequestInfo} endpoint
|
||||
* @param {RequestInit} options
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
export async function kemonoFetch(endpoint, options) {
|
||||
try {
|
||||
const response = await fetch(endpoint, options);
|
||||
|
||||
// doing this because the server returns `401` before redirecting
|
||||
// in case of favs
|
||||
if (response.status === 401) {
|
||||
// server logged the account out
|
||||
if (isLoggedIn) {
|
||||
localStorage.removeItem("logged_in");
|
||||
localStorage.removeItem("role");
|
||||
localStorage.removeItem("favs");
|
||||
localStorage.removeItem("post_favs");
|
||||
location.href = "/account/logout";
|
||||
return;
|
||||
}
|
||||
const loginURL = new URL("/account/login", location.origin).toString();
|
||||
location = addURLParam(loginURL, "location", location.pathname);
|
||||
return;
|
||||
}
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
console.error(`Kemono request error: ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @param {string} paramName
|
||||
* @param {string} paramValue
|
||||
* @returns {string}
|
||||
*/
|
||||
function addURLParam(url, paramName, paramValue) {
|
||||
var newURL = new URL(url);
|
||||
newURL.searchParams.set(paramName, paramValue);
|
||||
return newURL.toString();
|
||||
}
|
26
client/src/api/kemono/posts.js
Normal file
26
client/src/api/kemono/posts.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { kemonoFetch } from "./kemono-fetch";
|
||||
import { KemonoError } from "@wp/utils";
|
||||
|
||||
export const posts = {
|
||||
attemptFlag,
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} service
|
||||
* @param {string} user
|
||||
* @param {string} post_id
|
||||
*/
|
||||
async function attemptFlag(service, user, post_id) {
|
||||
try {
|
||||
const response = await kemonoFetch(`/api/v1/${service}/user/${user}/post/${post_id}/flag`, { method: "POST" });
|
||||
|
||||
if (!response || !response.ok) {
|
||||
alert(new KemonoError(5));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
1
client/src/api/paysites/_index.js
Normal file
1
client/src/api/paysites/_index.js
Normal file
|
@ -0,0 +1 @@
|
|||
export const paysitesAPI = {};
|
BIN
client/src/assets/loading.gif
Normal file
BIN
client/src/assets/loading.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 673 B |
7
client/src/css/_index.scss
Normal file
7
client/src/css/_index.scss
Normal file
|
@ -0,0 +1,7 @@
|
|||
@use "config/variables";
|
||||
@use "animations";
|
||||
@use "sass-mixins";
|
||||
@use "base";
|
||||
@use "attributes";
|
||||
@use "blocks";
|
||||
@use "legacy";
|
8
client/src/css/animations.scss
Normal file
8
client/src/css/animations.scss
Normal file
|
@ -0,0 +1,8 @@
|
|||
@keyframes fadeInOpacity {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
73
client/src/css/attributes.scss
Normal file
73
client/src/css/attributes.scss
Normal file
|
@ -0,0 +1,73 @@
|
|||
@use "config/variables" as *;
|
||||
/* Attributes */
|
||||
// only selectors by attributes
|
||||
// and their pseudo-classes/elements go there
|
||||
// base tags are for easier grouping/folding
|
||||
|
||||
a {
|
||||
// internal links
|
||||
// &[href^=#{$kemono-site}],
|
||||
&[href^="/"],
|
||||
&[href^="./"],
|
||||
&[href^="../"] {
|
||||
--local-colour1-primary: var(--anchour-internal-colour1-primary);
|
||||
--local-colour1-secondary: var(--anchour-internal-colour1-secondary);
|
||||
--local-colour2-primary: var(--anchour-internal-colour2-primary);
|
||||
--local-colour2-secondary: var(--anchour-internal-colour2-secondary);
|
||||
}
|
||||
|
||||
// local links
|
||||
&[href^="#"] {
|
||||
--local-colour1-primary: var(--anchour-local-colour1-primary);
|
||||
// the same color because visited state is irrelevant
|
||||
--local-colour1-secondary: var(--anchour-local-colour1-primary);
|
||||
--local-colour2-primary: var(--anchour-local-colour2-primary);
|
||||
--local-colour2-secondary: var(--anchour-local-colour2-secondary);
|
||||
}
|
||||
|
||||
// email links
|
||||
&[href^="mailto:"] {
|
||||
// &::before {
|
||||
// content: "\1F4E7"; // email icon
|
||||
// padding-right: $size-little;
|
||||
// }
|
||||
|
||||
//&::after {
|
||||
// content: " (\01f4e8\02197\01f441)"; // mail sent, NE arrow, eye
|
||||
//}
|
||||
}
|
||||
|
||||
// telephone links
|
||||
&[href^="tel:"] {
|
||||
&::before {
|
||||
content: "\260e"; // phone icon
|
||||
padding-right: $size-little;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
input {
|
||||
&[type="submit"] {
|
||||
min-height: 24px;
|
||||
text-align: center;
|
||||
color: var(--colour0-primary);
|
||||
background-image: linear-gradient(hsl(220, 7%, 17%), hsl(0, 0%, 7%));
|
||||
border-radius: 5px;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
&[type="text"],
|
||||
&[type="password"],
|
||||
&[type="number"] {
|
||||
border-radius: 5px;
|
||||
box-shadow: inset 0 1px 3px hsl(228, 7%, 13%);
|
||||
background: hsl(220, 7%, 25%);
|
||||
color: var(--colour0-primary);
|
||||
border: 0;
|
||||
}
|
||||
|
||||
&[type="checkbox"],
|
||||
&[type="radio"] {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
188
client/src/css/base.scss
Normal file
188
client/src/css/base.scss
Normal file
|
@ -0,0 +1,188 @@
|
|||
@use "config/variables" as *;
|
||||
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
font-size: 100%;
|
||||
font-family: Helvetica, sans-serif;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow-wrap: break-word;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: inherit;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
position: relative;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
color: var(--colour0-primary);
|
||||
background-color: var(--colour1-primary);
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
main {
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-transform: capitalize;
|
||||
font-size: 1.7rem;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.6rem;
|
||||
font-weight: normal;
|
||||
line-height: 1.35;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 1.4rem;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 1.3rem;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 1.2rem;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
p,
|
||||
li,
|
||||
dd,
|
||||
dt {
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
p,
|
||||
ul,
|
||||
ol {
|
||||
margin: $size-small 0;
|
||||
}
|
||||
|
||||
ul,
|
||||
ol {
|
||||
padding-left: $size-normal;
|
||||
}
|
||||
|
||||
a {
|
||||
--local-colour1-primary: var(--anchour-colour1-primary);
|
||||
--local-colour1-secondary: var(--anchour-colour1-secondary);
|
||||
--local-colour2-primary: var(--anchour-colour2-primary);
|
||||
--local-colour2-secondary: var(--anchour-colour2-secondary);
|
||||
|
||||
outline: none;
|
||||
text-decoration: none;
|
||||
border-bottom: $size-nano solid transparent;
|
||||
padding: 2px;
|
||||
transition-property: color, border-color, background-color;
|
||||
transition-duration: var(--duration-global);
|
||||
|
||||
&:link {
|
||||
color: var(--local-colour1-primary);
|
||||
}
|
||||
|
||||
&:visited {
|
||||
color: var(--local-colour1-secondary);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
background-color: var(--local-colour2-primary);
|
||||
border-bottom-color: var(--local-colour1-primary);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: var(--local-colour2-secondary);
|
||||
border-bottom-color: var(--local-colour1-primary);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: var(--local-colour1-primary);
|
||||
color: var(--local-colour2-primary);
|
||||
border-bottom-color: var(--local-colour2-primary);
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
button,
|
||||
input,
|
||||
select,
|
||||
textarea,
|
||||
.pure-g [class*="pure-u"] {
|
||||
font-family: Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
label {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
min-height: 3rem;
|
||||
box-shadow: inset 0 1px 3px #1f2024;
|
||||
background: #3a3d43;
|
||||
color: var(--colour0-primary);
|
||||
border: none;
|
||||
}
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap; /* Since CSS 2.1 */
|
||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||
}
|
||||
|
||||
select {
|
||||
color: var(--colour0-primary);
|
||||
background-image: linear-gradient(#282a2e, #111111);
|
||||
border-radius: 5px;
|
||||
border-color: #111;
|
||||
text-align-last: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
select * {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
select::-ms-expand {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
|
||||
// prevents onclick events from firind on children
|
||||
& > * {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
1
client/src/css/blocks/_index.scss
Normal file
1
client/src/css/blocks/_index.scss
Normal file
|
@ -0,0 +1 @@
|
|||
@use "form";
|
145
client/src/css/blocks/form.scss
Normal file
145
client/src/css/blocks/form.scss
Normal file
|
@ -0,0 +1,145 @@
|
|||
@use "../config/variables.scss" as *;
|
||||
|
||||
.form {
|
||||
max-width: $width-mobile;
|
||||
padding: $size-normal;
|
||||
margin: 0 auto;
|
||||
|
||||
&--bigger {
|
||||
max-width: $width-phone;
|
||||
}
|
||||
|
||||
&--wide {
|
||||
max-width: $width-tablet;
|
||||
}
|
||||
|
||||
&--controller {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&__section,
|
||||
&__fieldset {
|
||||
padding-bottom: $size-normal;
|
||||
transition-property: opacity, visibility;
|
||||
transition-duration: var(--duration-global);
|
||||
|
||||
&:last-child {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
&--hidden {
|
||||
max-height: 0;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__section {
|
||||
&--buttons {
|
||||
text-align: center;
|
||||
}
|
||||
&--checkbox {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
gap: $size-normal;
|
||||
|
||||
& .form__input {
|
||||
flex: 0 1;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
&:before {
|
||||
position: absolute;
|
||||
top: 40%;
|
||||
left: 0.7em;
|
||||
content: "X";
|
||||
font-size: 2em;
|
||||
color: hsl(0, 100%, 60%);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
&:checked:before {
|
||||
content: "\2713"; /* checkmark */
|
||||
color: hsl(120, 100%, 50%);
|
||||
}
|
||||
|
||||
&:checked + .form__label {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
& .form__label {
|
||||
flex: 1 1;
|
||||
opacity: 0.5;
|
||||
transition-property: opacity;
|
||||
transition-duration: 250ms;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__input,
|
||||
&__button,
|
||||
&__select {
|
||||
box-sizing: border-box;
|
||||
min-height: $button-min-width;
|
||||
min-width: $button-min-height;
|
||||
width: 100%;
|
||||
font-family: inherit;
|
||||
font-size: 18px;
|
||||
border-radius: 10px;
|
||||
padding: $size-small;
|
||||
}
|
||||
|
||||
&__subtitle {
|
||||
display: block;
|
||||
line-height: normal;
|
||||
color: hsl(0, 0%, 45%);
|
||||
}
|
||||
|
||||
&__input {
|
||||
background: hsl(224, 7%, 32%);
|
||||
color: hsl(0, 0%, 100%);
|
||||
border: 0;
|
||||
}
|
||||
|
||||
&__option {
|
||||
color: hsl(0, 0%, 100%);
|
||||
background-color: hsl(224, 7%, 32%);
|
||||
}
|
||||
|
||||
/* quick hack to overwrite attribute rules */
|
||||
&__input.form__input--text,
|
||||
&__input.form__input--password {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
&__button {
|
||||
cursor: pointer;
|
||||
|
||||
&--submit {
|
||||
max-width: $width-tablet;
|
||||
text-align: center;
|
||||
color: var(--colour0-primary);
|
||||
background-image: linear-gradient(#32373e, #262a31);
|
||||
box-shadow:
|
||||
0 10px 15px -3px rgb(0 0 0 / 0.2),
|
||||
0 4px 6px -4px rgb(0 0 0 / 0.2);
|
||||
border: 0;
|
||||
transition: none;
|
||||
transition-property: box-shadow;
|
||||
transition-duration: var(--duration-global);
|
||||
|
||||
&:hover,
|
||||
&:focus-within {
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
97
client/src/css/config/variables.scss
Normal file
97
client/src/css/config/variables.scss
Normal file
|
@ -0,0 +1,97 @@
|
|||
/* SASS variables */
|
||||
// screen widths
|
||||
$width-feature: 240px;
|
||||
$width-mobile: 360px;
|
||||
$width-phone: 480px;
|
||||
$width-tablet: 720px;
|
||||
$width-laptop: 1280px;
|
||||
$width-desktop: 1920px;
|
||||
|
||||
// sizes for borders/padding/margins/gaps
|
||||
$size-nano: 0.0625em;
|
||||
$size-thin: 0.125em;
|
||||
$size-little: 0.25em;
|
||||
$size-small: 0.5em;
|
||||
$size-normal: 1em;
|
||||
$size-big: 2em;
|
||||
$size-large: 3em;
|
||||
|
||||
// buttons
|
||||
$button-min-width: 44px;
|
||||
$button-min-height: 44px;
|
||||
|
||||
// min sidebar width do not touch
|
||||
$sidebar-min-width: 1020px;
|
||||
|
||||
/* CSS variables */
|
||||
:root {
|
||||
// base colours
|
||||
--colour0-primary: hsl(0, 0%, 95%);
|
||||
--colour0-secondary: hsl(0, 0%, 70%);
|
||||
--colour0-tertirary: hsl(0, 0%, 45%);
|
||||
// colors
|
||||
--colour1-primary: hsl(210, 6%, 12%);
|
||||
--colour1-primary-transparent: hsla(210, 6%, 12%, 0.75);
|
||||
--colour1-secondary: hsl(220, 7%, 25%);
|
||||
--colour1-secondary-transparent: hsla(220, 7%, 25%, 0.5);
|
||||
// kemono colors
|
||||
//--colour1-primary: hsl(210, 6%, 12%);
|
||||
//--colour1-primary-transparent: hsla(210, 6%, 12%, 0.75);
|
||||
//--colour1-secondary: hsl(220, 7%, 25%);
|
||||
//--colour1-secondary-transparent: hsla(220, 7%, 25%, 0.5);
|
||||
// coomer colors
|
||||
//--colour1-primary: hsl(200, 25%, 5%);
|
||||
//--colour1-primary-transparent: hsla(200, 25%, 5%, 0.75);
|
||||
//--colour1-secondary: hsl(208, 22%, 12%);
|
||||
//--colour1-secondary-transparent: hsla(208, 22%, 12%, 0.5);
|
||||
--colour1-tertiary: hsl(210, 15%, 5%);
|
||||
|
||||
/* Buttons */
|
||||
--submit-colour1-primary: hsl(200, 100%, 70%);
|
||||
--submit-colour1-secondary: hsl(240, 100%, 50%);
|
||||
--submit-colour2-primary: hsl(240, 100%, 50%);
|
||||
--submit-colour2-secondary: hsl(240, 100%, 50%);
|
||||
--positive-colour1-primary: hsl(120, 100%, 45%);
|
||||
--positive-colour1-secondary: hsl(120, 100%, 30%);
|
||||
--negative-colour1-primary: hsl(0, 100%, 60%);
|
||||
--favourite-colour1-primary: hsl(51, 100%, 50%);
|
||||
--favourite-colour2-primary: hsl(60, 100%, 30%);
|
||||
/* END Buttons */
|
||||
|
||||
/* Links */
|
||||
// external
|
||||
--anchour-colour1-primary: hsl(200, 100%, 80%);
|
||||
--anchour-colour1-secondary: hsla(210, 70%, 70%);
|
||||
--anchour-colour2-primary: hsl(240, 100%, 40%);
|
||||
--anchour-colour2-secondary: hsla(230, 70%, 40%);
|
||||
// internal
|
||||
--anchour-internal-colour1-primary: hsl(20, 100%, 80%);
|
||||
--anchour-internal-colour1-secondary: hsla(20, 70%, 70%);
|
||||
--anchour-internal-colour2-primary: hsl(30, 100%, 20%);
|
||||
--anchour-internal-colour2-secondary: hsla(30, 80%, 20%);
|
||||
// kemono colors
|
||||
//--anchour-internal-colour1-primary: hsl(20, 100%, 80%);
|
||||
//--anchour-internal-colour1-secondary: hsla(20, 70%, 70%);
|
||||
//--anchour-internal-colour2-primary: hsl(30, 100%, 20%);
|
||||
//--anchour-internal-colour2-secondary: hsla(30, 80%, 20%);
|
||||
// coomer colors
|
||||
//--anchour-internal-colour1-primary: hsl(200, 100%, 80%);
|
||||
//--anchour-internal-colour1-secondary: hsla(210, 70%, 70%);
|
||||
//--anchour-internal-colour2-primary: hsl(240, 100%, 40%);
|
||||
//--anchour-internal-colour2-secondary: hsla(230, 70%, 40%);
|
||||
// local
|
||||
--anchour-local-colour1-primary: hsl(260, 100%, 80%);
|
||||
--anchour-local-colour1-secondary: hsla(260, 70%, 70%);
|
||||
--anchour-local-colour2-primary: hsl(280, 100%, 30%);
|
||||
--anchour-local-colour2-secondary: hsla(280, 70%, 30%);
|
||||
// email
|
||||
// --anchour-email-colour1-primary: hsl(260, 100%, 80%);
|
||||
// --anchour-email-colour1-secondary: hsla(260, 70%, 70%);
|
||||
// --anchour-email-colour2-primary: hsl(280, 100%, 30%);
|
||||
// --anchour-email-colour2-secondary: hsla(280, 70%, 30%);
|
||||
/* END Links */
|
||||
|
||||
// durations
|
||||
--duration-fast: 250ms;
|
||||
--duration-global: var(--duration-fast);
|
||||
}
|
457
client/src/css/legacy.scss
Normal file
457
client/src/css/legacy.scss
Normal file
|
@ -0,0 +1,457 @@
|
|||
/*
|
||||
TODO: Spread the styles around page/component/block files.
|
||||
*/
|
||||
|
||||
.flash_messages {
|
||||
background-color: #3a3d43;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
color: #737373;
|
||||
}
|
||||
|
||||
.no-posts {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.upload-button {
|
||||
padding: 30px;
|
||||
margin-top: 5px;
|
||||
border-radius: 0.25rem;
|
||||
background: #3a3d43;
|
||||
font-size: 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.activity-view {
|
||||
padding: 5px;
|
||||
margin: 0.5rem;
|
||||
border-radius: 0.25rem;
|
||||
background: #3a3d43;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.activity-view-avatar {
|
||||
border-radius: 0.25rem;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.activity-view-p {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.activity-view-name {
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.activity-view-update {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.jumbo {
|
||||
padding: 10px;
|
||||
margin: 0.5rem;
|
||||
border-radius: 0.25rem;
|
||||
background: hsl(220, 7%, 25%);
|
||||
|
||||
& p,
|
||||
& h2 {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.jumbo-user {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.jumbo-user-avatar {
|
||||
margin: 0 auto;
|
||||
border-radius: 0.25rem;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.favorites-opts select {
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
.opts {
|
||||
float: right;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.opts select {
|
||||
position: absolute;
|
||||
top: 0.5rem;
|
||||
right: 0.5rem;
|
||||
}
|
||||
|
||||
.visually-hidden {
|
||||
position: absolute;
|
||||
left: -100vw;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.text-card {
|
||||
height: 500px;
|
||||
background: #3a3d43;
|
||||
border-radius: 2px;
|
||||
margin: 0.5rem;
|
||||
box-shadow:
|
||||
0 2px 2px 0 rgba(0, 0, 0, 0.14),
|
||||
0 1px 5px 0 rgba(0, 0, 0, 0.12),
|
||||
0 3px 1px -2px rgba(0, 0, 0, 0.2);
|
||||
position: relative;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.card-image {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
max-height: 310px;
|
||||
}
|
||||
|
||||
.card-reveal {
|
||||
border-radius: 2px;
|
||||
position: absolute;
|
||||
background-color: #3a3d43;
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.card-reveal-content {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.card-reveal-content img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
overflow: hidden;
|
||||
padding: 20px;
|
||||
border-radius: 0 0 2px 2px;
|
||||
height: 170px;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 24px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.card-action {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border-top: 1px solid rgba(160, 160, 160, 0.2);
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.card-action a {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.card-image img {
|
||||
border-radius: 2px 2px 0 0;
|
||||
position: relative;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* thumbnails */
|
||||
.thumb-standard {
|
||||
border: 1px solid #000;
|
||||
}
|
||||
.thumb-child {
|
||||
border: 1px solid #cc0;
|
||||
}
|
||||
.thumb-parent {
|
||||
border: 1px solid #0f0;
|
||||
}
|
||||
.thumb-shared {
|
||||
border: 1px solid #ff7f00;
|
||||
}
|
||||
|
||||
.thumb-link {
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.thumb {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.thumb:hover .thumb-with-image-overlay {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.thumb-with-image {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-image: url("@wp/assets/loading.gif");
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.thumb-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.thumb-with-image-overlay {
|
||||
display: none;
|
||||
z-index: 9;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
text-align: center;
|
||||
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
|
||||
}
|
||||
|
||||
.thumb-with-text {
|
||||
overflow-y: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.thumb-with-text * {
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.thumb * {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.thumb h3,
|
||||
.thumb p {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* sidebar */
|
||||
|
||||
.sidebar {
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
margin-left: 5px;
|
||||
width: 195px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* search */
|
||||
|
||||
.results li {
|
||||
display: block;
|
||||
list-style-type: none;
|
||||
line-height: 1.8em;
|
||||
}
|
||||
|
||||
.page img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* pagination */
|
||||
.paginator {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.paginator menu {
|
||||
padding: 0;
|
||||
margin: 5px auto;
|
||||
display: table;
|
||||
|
||||
& > li,
|
||||
& > a {
|
||||
border: 1px solid var(--colour0-tertirary);
|
||||
display: table-cell;
|
||||
line-height: 33px;
|
||||
color: var(--colour0-secondary);
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
min-width: 35px;
|
||||
transition-property: color background-color;
|
||||
|
||||
@media (min-width: #{600px + 1}) {
|
||||
&.pagination-mobile:not(:last-child) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.pagination-mobile:last-child {
|
||||
min-width: unset;
|
||||
border-right: none;
|
||||
border-top: none;
|
||||
border-bottom: none;
|
||||
& > * {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
&.pagination-button-optional {
|
||||
display: none;
|
||||
}
|
||||
&.pagination-desktop {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.pagination-button-disabled {
|
||||
color: var(--colour0-tertirary);
|
||||
background-color: unset;
|
||||
cursor: default;
|
||||
}
|
||||
&.pagination-button-current {
|
||||
background-color: var(--anchour-internal-colour2-primary);
|
||||
color: var(--anchour-internal-colour1-secondary);
|
||||
border-color: var(--anchour-internal-colour1-primary);
|
||||
}
|
||||
&.pagination-button-after-current {
|
||||
border-left: 1px solid var(--anchour-internal-colour1-primary);
|
||||
}
|
||||
&:not(.pagination-button-disabled):hover,
|
||||
&:not(.pagination-button-disabled):focus,
|
||||
&:not(.pagination-button-disabled):active {
|
||||
background-color: var(--colour0-tertirary);
|
||||
color: var(--colour0-primary);
|
||||
}
|
||||
& > b {
|
||||
padding: 0 9px;
|
||||
}
|
||||
&:not(:last-child) {
|
||||
border-right: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
menu li {
|
||||
display: inline;
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0 0.2em;
|
||||
}
|
||||
|
||||
/* posts */
|
||||
|
||||
.embed-view {
|
||||
border: 1px solid #111;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
/* media queries */
|
||||
@media only screen and (max-width: 568px) {
|
||||
.thumb {
|
||||
width: 160px;
|
||||
height: 160px;
|
||||
}
|
||||
.sidebar {
|
||||
width: auto;
|
||||
}
|
||||
#paginator-bottom {
|
||||
margin-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
}
|
||||
|
||||
/* search forms */
|
||||
|
||||
.search-form {
|
||||
display: table;
|
||||
padding: 0.5rem;
|
||||
margin-left: 5px;
|
||||
background-color: #282a2e;
|
||||
margin: 0px auto 8px auto;
|
||||
|
||||
&-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
& > div {
|
||||
display: table-row;
|
||||
line-height: 1.5em;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
& small {
|
||||
display: block;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
& label,
|
||||
& input {
|
||||
display: table-cell;
|
||||
padding-right: 1em;
|
||||
white-space: nowrap;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
& label {
|
||||
text-align: right;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
|
||||
/* search results */
|
||||
.search-results tbody td {
|
||||
height: 2.25em;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
thead th {
|
||||
font-weight: 700;
|
||||
text-align: left;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
.user-icon {
|
||||
display: inline-block;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 0.25rem;
|
||||
overflow: hidden;
|
||||
|
||||
// quick hack to apply styles
|
||||
|
||||
& img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.ad-container {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ad-container * {
|
||||
max-width: 100%;
|
||||
}
|
15
client/src/css/sass-mixins.scss
Normal file
15
client/src/css/sass-mixins.scss
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* SASS mixins go there */
|
||||
@use "config/variables" as *;
|
||||
|
||||
@mixin article_card() {
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
border-radius: 10px;
|
||||
background-color: var(--colour1-tertiary);
|
||||
padding: 0;
|
||||
|
||||
& > * {
|
||||
flex: 0 0 auto;
|
||||
padding: $size-small;
|
||||
}
|
||||
}
|
1
client/src/development/entry.js
Normal file
1
client/src/development/entry.js
Normal file
|
@ -0,0 +1 @@
|
|||
import "./entry.scss";
|
3
client/src/development/entry.scss
Normal file
3
client/src/development/entry.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
@use "../css";
|
||||
@use "../pages";
|
||||
@use "../pages/development";
|
4
client/src/env/derived-vars.js
vendored
Normal file
4
client/src/env/derived-vars.js
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
import { KEMONO_SITE, NODE_ENV } from "./env-vars.js";
|
||||
|
||||
export const IS_DEVELOPMENT = NODE_ENV === "development";
|
||||
export const SITE_HOSTNAME = new URL(KEMONO_SITE).hostname;
|
31
client/src/env/env-vars.js
vendored
Normal file
31
client/src/env/env-vars.js
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
https://webpack.js.org/plugins/define-plugin/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
export const KEMONO_SITE = BUNDLER_ENV_KEMONO_SITE;
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
export const NODE_ENV = BUNDLER_ENV_NODE_ENV;
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
export const ICONS_PREPEND = BUNDLER_ENV_ICONS_PREPEND;
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
export const BANNERS_PREPEND = BUNDLER_ENV_BANNERS_PREPEND;
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
export const THUMBNAILS_PREPEND = BUNDLER_ENV_THUMBNAILS_PREPEND;
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
export const CREATORS_LOCATION = BUNDLER_ENV_CREATORS_LOCATION;
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
1
client/src/js/account.js
Normal file
1
client/src/js/account.js
Normal file
|
@ -0,0 +1 @@
|
|||
export const isLoggedIn = localStorage.getItem("logged_in") === "yes";
|
7
client/src/js/admin.js
Normal file
7
client/src/js/admin.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import "./admin.scss";
|
||||
import { fixImageLinks } from "@wp/utils";
|
||||
import { initSections } from "./page-loader";
|
||||
import { adminPageScripts } from "@wp/pages";
|
||||
|
||||
fixImageLinks(document.images);
|
||||
initSections(adminPageScripts);
|
3
client/src/js/admin.scss
Normal file
3
client/src/js/admin.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
@use "../css";
|
||||
@use "../pages/components";
|
||||
@use "../pages/account/administrator";
|
35
client/src/js/component-factory.js
Normal file
35
client/src/js/component-factory.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* @type {Map<string, HTMLElement>}
|
||||
*/
|
||||
const components = new Map();
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} footer
|
||||
*/
|
||||
export function initComponentFactory(footer) {
|
||||
const container = footer.querySelector(".component-container");
|
||||
/**
|
||||
* @type {NodeListOf<HTMLElement}
|
||||
*/
|
||||
const componentElements = container.querySelectorAll(`#${container.id} > *`);
|
||||
|
||||
componentElements.forEach((component) => {
|
||||
components.set(component.className.trim(), component);
|
||||
});
|
||||
container.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} className
|
||||
*/
|
||||
export function createComponent(className) {
|
||||
const componentSkeleton = components.get(className);
|
||||
|
||||
if (!componentSkeleton) {
|
||||
return console.error(`Component "${className}" doesn't exist.`);
|
||||
}
|
||||
|
||||
const newInstance = componentSkeleton.cloneNode(true);
|
||||
|
||||
return newInstance;
|
||||
}
|
207
client/src/js/favorites.js
Normal file
207
client/src/js/favorites.js
Normal file
|
@ -0,0 +1,207 @@
|
|||
import { kemonoAPI } from "@wp/api";
|
||||
|
||||
export async function initFavorites() {
|
||||
let artistFavs = localStorage.getItem("favs");
|
||||
let postFavs = localStorage.getItem("post_favs");
|
||||
|
||||
if (!artistFavs || artistFavs === "undefined") {
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
const favs = await kemonoAPI.favorites.retrieveFavoriteArtists();
|
||||
|
||||
if (favs) {
|
||||
localStorage.setItem("favs", favs);
|
||||
}
|
||||
}
|
||||
|
||||
if (!postFavs || postFavs === "undefined") {
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
const favs = await kemonoAPI.favorites.retrieveFavoritePosts();
|
||||
|
||||
if (favs) {
|
||||
localStorage.setItem("post_favs", favs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function saveFavouriteArtists() {
|
||||
try {
|
||||
const favs = await kemonoAPI.favorites.retrieveFavoriteArtists();
|
||||
|
||||
if (!favs) {
|
||||
alert("Could not retrieve favorite artists");
|
||||
return false;
|
||||
}
|
||||
|
||||
localStorage.setItem("favs", favs);
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function saveFavouritePosts() {
|
||||
try {
|
||||
const favs = await kemonoAPI.favorites.retrieveFavoritePosts();
|
||||
|
||||
if (!favs) {
|
||||
alert("Could not retrieve favorite posts");
|
||||
return false;
|
||||
}
|
||||
|
||||
localStorage.setItem("post_favs", favs);
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} service
|
||||
* @returns {Promise<KemonoAPI.Favorites.User> | undefined}
|
||||
*/
|
||||
export async function findFavouriteArtist(id, service) {
|
||||
/**
|
||||
* @type {KemonoAPI.Favorites.User[]}
|
||||
*/
|
||||
let favList;
|
||||
|
||||
try {
|
||||
favList = JSON.parse(localStorage.getItem("favs"));
|
||||
} catch (error) {
|
||||
// corrupted entry
|
||||
if (error instanceof SyntaxError) {
|
||||
const isSaved = await saveFavouriteArtists();
|
||||
|
||||
if (!isSaved) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return await findFavouriteArtist(id, service);
|
||||
}
|
||||
}
|
||||
|
||||
if (!favList) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const favArtist = favList.find((favItem) => {
|
||||
return favItem.id === id && favItem.service === service;
|
||||
});
|
||||
|
||||
return favArtist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} service
|
||||
* @param {string} user
|
||||
* @param {string} postID
|
||||
* @returns {Promise<KemonoAPI.Favorites.Post> | undefined}
|
||||
*/
|
||||
export async function findFavouritePost(service, user, postID) {
|
||||
/**
|
||||
* @type {KemonoAPI.Favorites.Post[]}
|
||||
*/
|
||||
let favList;
|
||||
|
||||
try {
|
||||
favList = JSON.parse(localStorage.getItem("post_favs"));
|
||||
|
||||
if (!favList) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const favPost = favList.find((favItem) => {
|
||||
const isMatch = favItem.id === postID && favItem.service === service && favItem.user === user;
|
||||
return isMatch;
|
||||
});
|
||||
|
||||
return favPost;
|
||||
} catch (error) {
|
||||
// corrupted entry
|
||||
if (error instanceof SyntaxError) {
|
||||
const isSaved = await saveFavouritePosts();
|
||||
|
||||
if (!isSaved) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return await findFavouritePost(service, user, postID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} service
|
||||
*/
|
||||
export async function addFavouriteArtist(id, service) {
|
||||
const isFavorited = await kemonoAPI.favorites.favoriteArtist(service, id);
|
||||
|
||||
if (!isFavorited) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const newFavs = await kemonoAPI.favorites.retrieveFavoriteArtists();
|
||||
localStorage.setItem("favs", newFavs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} id
|
||||
* @param {string} service
|
||||
*/
|
||||
export async function removeFavouriteArtist(id, service) {
|
||||
const isUnfavorited = await kemonoAPI.favorites.unfavoriteArtist(service, id);
|
||||
|
||||
if (!isUnfavorited) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const favItems = await kemonoAPI.favorites.retrieveFavoriteArtists();
|
||||
localStorage.setItem("favs", favItems);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} service
|
||||
* @param {string} user
|
||||
* @param {string} postID
|
||||
*/
|
||||
export async function addFavouritePost(service, user, postID) {
|
||||
const isFavorited = await kemonoAPI.favorites.favoritePost(service, user, postID);
|
||||
|
||||
if (!isFavorited) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const newFavs = await kemonoAPI.favorites.retrieveFavoritePosts();
|
||||
localStorage.setItem("post_favs", newFavs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} service
|
||||
* @param {string} user
|
||||
* @param {string} postID
|
||||
* @returns
|
||||
*/
|
||||
export async function removeFavouritePost(service, user, postID) {
|
||||
const isUnfavorited = await kemonoAPI.favorites.unfavoritePost(service, user, postID);
|
||||
|
||||
if (!isUnfavorited) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const favItems = await kemonoAPI.favorites.retrieveFavoritePosts();
|
||||
localStorage.setItem("post_favs", favItems);
|
||||
|
||||
return true;
|
||||
}
|
13
client/src/js/feature-detect.js
Normal file
13
client/src/js/feature-detect.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
export const features = {
|
||||
localStorage: isLocalStorageAvailable(),
|
||||
};
|
||||
|
||||
function isLocalStorageAvailable() {
|
||||
try {
|
||||
localStorage.setItem("__storage_test__", "__storage_test__");
|
||||
localStorage.removeItem("__storage_test__");
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
18
client/src/js/global.js
Normal file
18
client/src/js/global.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
import "./global.scss";
|
||||
import "purecss/build/base-min.css";
|
||||
import "purecss/build/grids-min.css";
|
||||
import "purecss/build/grids-responsive-min.css";
|
||||
import 'whatwg-fetch'; /* fetch polyfill */
|
||||
import { isLoggedIn } from "@wp/js/account";
|
||||
import { initFavorites } from "@wp/js/favorites";
|
||||
import { fixImageLinks } from "@wp/utils";
|
||||
import { globalPageScripts } from "@wp/pages";
|
||||
import { initSections } from "./page-loader";
|
||||
import { initPendingReviewDms } from "@wp/js/pending-review-dms";
|
||||
|
||||
if (isLoggedIn) {
|
||||
initFavorites();
|
||||
initPendingReviewDms();
|
||||
}
|
||||
fixImageLinks(document.images);
|
||||
initSections(globalPageScripts);
|
2
client/src/js/global.scss
Normal file
2
client/src/js/global.scss
Normal file
|
@ -0,0 +1,2 @@
|
|||
@use "../css";
|
||||
@use "../pages";
|
7
client/src/js/moderator.js
Normal file
7
client/src/js/moderator.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import "./moderator.scss";
|
||||
import { fixImageLinks } from "@wp/utils";
|
||||
import { initSections } from "./page-loader";
|
||||
import { moderatorPageScripts } from "@wp/pages";
|
||||
|
||||
fixImageLinks(document.images);
|
||||
initSections(moderatorPageScripts);
|
1
client/src/js/moderator.scss
Normal file
1
client/src/js/moderator.scss
Normal file
|
@ -0,0 +1 @@
|
|||
@use "../pages/moderator";
|
37
client/src/js/page-loader.js
Normal file
37
client/src/js/page-loader.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { initShell } from "@wp/components";
|
||||
import { initComponentFactory } from "./component-factory";
|
||||
|
||||
/**
|
||||
* Initialises the scripts on the page.
|
||||
* @param {Map<string, (section: HTMLElement) => void>} pages The map of page names and their callbacks.
|
||||
*/
|
||||
export function initSections(pages) {
|
||||
const sidebar = document.querySelector(".global-sidebar");
|
||||
const main = document.querySelector("main");
|
||||
/**
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
const footer = document.querySelector(".global-footer");
|
||||
/**
|
||||
* @type {NodeListOf<HTMLElement>}
|
||||
*/
|
||||
const sections = main.querySelectorAll("main > .site-section");
|
||||
|
||||
initComponentFactory(footer);
|
||||
initShell(sidebar);
|
||||
sections.forEach((section) => {
|
||||
const sectionNames = section.className.match(/site-section--([a-z\-]+)/ig);
|
||||
|
||||
if (sectionNames && sectionNames.length > 0) {
|
||||
sectionNames.forEach((sectionName) => {
|
||||
sectionName = sectionName.replace('site-section--', '');
|
||||
if (pages.has(sectionName)) {
|
||||
const sectionCallbacks = pages.get(sectionName);
|
||||
sectionCallbacks.forEach((sectionCallback) => {
|
||||
sectionCallback(section);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
19
client/src/js/pending-review-dms.js
Normal file
19
client/src/js/pending-review-dms.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
import { kemonoAPI } from "@wp/api";
|
||||
|
||||
export async function initPendingReviewDms(forceReload= false, minutesForRecheck = 30) {
|
||||
let HasPendingReviewDms = localStorage.getItem("has_pending_review_dms") === "true";
|
||||
let LastCheckedHasPendingReviewDms = parseInt(localStorage.getItem("last_checked_has_pending_review_dms"));
|
||||
|
||||
if (forceReload || !LastCheckedHasPendingReviewDms || (LastCheckedHasPendingReviewDms < Date.now() - minutesForRecheck * 60 * 1000)) {
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
HasPendingReviewDms = await kemonoAPI.dms.retrieveHasPendingDMs();
|
||||
localStorage.setItem("has_pending_review_dms", HasPendingReviewDms.toString());
|
||||
localStorage.setItem("last_checked_has_pending_review_dms", Date.now().toString());
|
||||
}
|
||||
if (HasPendingReviewDms)
|
||||
document.querySelector(".review_dms > img").src = "/static/menu/red_dm.svg";
|
||||
else
|
||||
document.querySelector(".review_dms > img").src = "/static/menu/dm.svg";
|
||||
}
|
1242
client/src/js/resumable.js
Normal file
1242
client/src/js/resumable.js
Normal file
File diff suppressed because it is too large
Load Diff
21
client/src/jsconfig.json
Normal file
21
client/src/jsconfig.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@wp/pages": ["./pages/_index.js"],
|
||||
"@wp/components": ["./pages/components/_index.js"],
|
||||
"@wp/env/*": ["./env/*"],
|
||||
"@wp/lib/*": ["./lib/*"],
|
||||
"@wp/js/*": ["./js/*"],
|
||||
"@wp/css/*": ["./css/*"],
|
||||
"@wp/assets/*": ["./assets/*"],
|
||||
"@wp/api": ["./api/_index.js"],
|
||||
"@wp/utils": ["./utils/_index.js"]
|
||||
},
|
||||
"target": "es6",
|
||||
"module": "es6",
|
||||
"lib": ["dom", "dom.iterable"],
|
||||
"moduleResolution": "node",
|
||||
"allowSyntheticDefaultImports": true
|
||||
}
|
||||
}
|
1
client/src/lib/_index.js
Normal file
1
client/src/lib/_index.js
Normal file
|
@ -0,0 +1 @@
|
|||
export { validateImportKey } from "./imports/_index.js";
|
148
client/src/lib/imports/lib.js
Normal file
148
client/src/lib/imports/lib.js
Normal file
|
@ -0,0 +1,148 @@
|
|||
import { isLowerCase } from "@wp/utils";
|
||||
|
||||
/**
|
||||
* @typedef ValidationResult
|
||||
* @property {boolean} isValid
|
||||
* @property {string[]} [errors]
|
||||
* @property {any} [result] A modified result, if any.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback KeyValidator
|
||||
* @param {string} key
|
||||
* @param {string[]} errors
|
||||
* @returns {string[]} An array of error messages, if any.
|
||||
*/
|
||||
|
||||
const maxLength = 1024;
|
||||
|
||||
/**
|
||||
* @type {Record<string, KeyValidator>}
|
||||
*/
|
||||
const serviceConstraints = {
|
||||
patreon: patreonKey,
|
||||
fanbox: fanboxKey,
|
||||
gumroad: gumroadKey,
|
||||
subscribestar: subscribestarKey,
|
||||
dlsite: dlsiteKey,
|
||||
discord: discordKey,
|
||||
fantia: fantiaKey,
|
||||
};
|
||||
|
||||
/**
|
||||
* Validates the key according to these rules:
|
||||
* - Trim spaces from both sides.
|
||||
* @param {string} key
|
||||
* @param {string} service
|
||||
* @returns {ValidationResult}
|
||||
*/
|
||||
export function validateImportKey(key, service) {
|
||||
const formattedKey = key.trim();
|
||||
const errors = serviceConstraints[service](key, []);
|
||||
|
||||
return {
|
||||
isValid: !errors.length,
|
||||
errors,
|
||||
result: formattedKey,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @type KeyValidator
|
||||
*/
|
||||
function patreonKey(key, errors) {
|
||||
const reqLength = 43;
|
||||
if (key.length !== reqLength) {
|
||||
errors.push(`The key length of "${key.length}" is not a valid Patreon key. Required length: "${reqLength}".`);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type KeyValidator
|
||||
*/
|
||||
function fanboxKey(key, errors) {
|
||||
const pattern = /^\d+_\w+$/i;
|
||||
|
||||
if (key.length > maxLength) {
|
||||
errors.push(`The key length of "${key.length}" is over the maximum of "${maxLength}".`);
|
||||
}
|
||||
|
||||
if (!key.match(pattern)) {
|
||||
errors.push(`The key doesn't match the required pattern of "${String(pattern)}"`);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type KeyValidator
|
||||
*/
|
||||
function fantiaKey(key, errors) {
|
||||
const reqLengths = [32, 64];
|
||||
|
||||
if (reqLengths.map((reqLength) => key.length !== reqLength).every((v) => v === false)) {
|
||||
errors.push(
|
||||
`The key length of "${key.length}" is not a valid Fantia key. ` + `Accepted lengths: ${reqLengths.join(", ")}.`,
|
||||
);
|
||||
}
|
||||
|
||||
if (!isLowerCase(key)) {
|
||||
errors.push(`The key is not in lower case.`);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type KeyValidator
|
||||
*/
|
||||
function gumroadKey(key, errors) {
|
||||
const minLength = 200;
|
||||
|
||||
if (key.length < minLength) {
|
||||
errors.push(`The key length of "${key.length}" is less than minimum required "${minLength}".`);
|
||||
}
|
||||
|
||||
if (key.length > maxLength) {
|
||||
errors.push(`The key length of "${key.length}" is over the maximum of "${maxLength}".`);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type KeyValidator
|
||||
*/
|
||||
function subscribestarKey(key, errors) {
|
||||
if (key.length > maxLength) {
|
||||
errors.push(`The key length of "${key.length}" is over the maximum of "${maxLength}".`);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type KeyValidator
|
||||
*/
|
||||
function dlsiteKey(key, errors) {
|
||||
if (key.length > maxLength) {
|
||||
errors.push(`The key length of "${key.length}" is over the maximum of "${maxLength}".`);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type KeyValidator
|
||||
*/
|
||||
function discordKey(key, errors) {
|
||||
const pattern = /(mfa.[a-z0-9_-]{20,})|([a-z0-9_-]{23,28}.[a-z0-9_-]{6,7}.[a-z0-9_-]{27})/i;
|
||||
|
||||
if (!key.match(pattern)) {
|
||||
errors.push(`The key doesn't match the required pattern of "${String(pattern)}".`);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
43
client/src/pages/_index.js
Normal file
43
client/src/pages/_index.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { userPage } from "./user";
|
||||
import { viewLinkedAccountsPage } from "./artist/linked_accounts.js";
|
||||
import { newLinkedAccountPage } from "./artist/new_linked_account.js";
|
||||
import { changePasswordPage, registerPage } from "./account/_index.js";
|
||||
import { postPage } from "./post";
|
||||
import { importerPage } from "./importer_list";
|
||||
import { importerStatusPage } from "./importer_status";
|
||||
import { postsPage } from "./posts";
|
||||
import { artistsPage } from "./artists";
|
||||
import { updatedPage } from "./updated";
|
||||
import { uploadPage } from "./upload";
|
||||
import { searchHashPage } from "./search_hash";
|
||||
import { registerPaginatorKeybinds } from "@wp/components";
|
||||
import { reviewDMsPage } from "./review_dms/dms";
|
||||
import { creatorLinksPage } from "./account/moderator/creator_links";
|
||||
|
||||
export { adminPageScripts } from "./account/administrator/_index.js";
|
||||
export { moderatorPageScripts } from "./account/moderator/_index.js";
|
||||
/**
|
||||
* The map of page names and their callbacks.
|
||||
*/
|
||||
export const globalPageScripts = new Map([
|
||||
["user", [userPage]],
|
||||
["register", [registerPage]],
|
||||
["change-password", [changePasswordPage]],
|
||||
["linked-account", [viewLinkedAccountsPage]],
|
||||
["new-linked-account", [newLinkedAccountPage]],
|
||||
["post", [postPage]],
|
||||
["importer", [importerPage]],
|
||||
["importer-status", [importerStatusPage]],
|
||||
["posts", [postsPage]],
|
||||
["popular-posts", [postsPage]],
|
||||
["artists", [artistsPage]],
|
||||
["updated", [updatedPage]],
|
||||
["upload", [uploadPage]],
|
||||
["all-dms", [registerPaginatorKeybinds]],
|
||||
["favorites", [registerPaginatorKeybinds]],
|
||||
["file-hash-search", [searchHashPage]],
|
||||
["review-dms", [reviewDMsPage]],
|
||||
// trying to load moderator scripts by initSections(moderatorPageScripts) breaks this pile of junk
|
||||
// so it's going here instead
|
||||
["moderator-creator-links", [creatorLinksPage]],
|
||||
]);
|
12
client/src/pages/_index.scss
Normal file
12
client/src/pages/_index.scss
Normal file
|
@ -0,0 +1,12 @@
|
|||
@use "components";
|
||||
@use "home";
|
||||
@use "post";
|
||||
@use "artist";
|
||||
@use "user";
|
||||
@use "review_dms";
|
||||
@use "importer_status";
|
||||
@use "posts";
|
||||
@use "favorites";
|
||||
@use "account";
|
||||
@use "upload";
|
||||
@use "tags";
|
2
client/src/pages/account/_index.js
Normal file
2
client/src/pages/account/_index.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
export { registerPage } from "./register.js";
|
||||
export { changePasswordPage } from "./change_password.js";
|
5
client/src/pages/account/_index.scss
Normal file
5
client/src/pages/account/_index.scss
Normal file
|
@ -0,0 +1,5 @@
|
|||
@use "home";
|
||||
@use "components";
|
||||
@use "notifications";
|
||||
@use "keys";
|
||||
@use "moderator";
|
4
client/src/pages/account/administrator/_index.js
Normal file
4
client/src/pages/account/administrator/_index.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* @type {Map<string, (section: HTMLElement) => void>}
|
||||
*/
|
||||
export const adminPageScripts = new Map();
|
2
client/src/pages/account/administrator/_index.scss
Normal file
2
client/src/pages/account/administrator/_index.scss
Normal file
|
@ -0,0 +1,2 @@
|
|||
@use "accounts";
|
||||
@use "shell";
|
20
client/src/pages/account/administrator/account_files.html
Normal file
20
client/src/pages/account/administrator/account_files.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{% extends 'account/administrator/shell.html' %}
|
||||
|
||||
{% block content %}
|
||||
<section class="site-section site-section--admin-account-files">
|
||||
<header class="site-section__header">
|
||||
<h1 class="site-section__heading">
|
||||
Files information for {{ props.account.username }} ({{ props.account.id }})
|
||||
</h1>
|
||||
</header>
|
||||
<ul>
|
||||
{% for file in props.files %}
|
||||
<li>
|
||||
File info
|
||||
</li>
|
||||
{% else %}
|
||||
<li>No files for this account</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</section>
|
||||
{% endblock content %}
|
21
client/src/pages/account/administrator/account_info.html
Normal file
21
client/src/pages/account/administrator/account_info.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% extends 'account/administrator/shell.html' %}
|
||||
|
||||
{% from 'components/timestamp.html' import timestamp %}
|
||||
|
||||
{% block content %}
|
||||
<section class="site-section site-section--admin-account-info">
|
||||
<header class="site-section__header">
|
||||
<h1 class="site-section__heading">
|
||||
Account information for {{ props.account.username }} ({{ props.account.id }})
|
||||
</h1>
|
||||
</header>
|
||||
<dl>
|
||||
<div>
|
||||
<dt>Created:</dt>
|
||||
<dd>
|
||||
{{ timestamp(props.account.created_at) }}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</section>
|
||||
{% endblock content %}
|
141
client/src/pages/account/administrator/accounts.html
Normal file
141
client/src/pages/account/administrator/accounts.html
Normal file
|
@ -0,0 +1,141 @@
|
|||
{% extends 'account/administrator/shell.html' %}
|
||||
|
||||
{% from 'components/card_list.html' import card_list %}
|
||||
{% from 'components/cards/account.html' import account_card %}
|
||||
{% from 'components/paginator_new.html' import paginator, paginator_controller %}
|
||||
|
||||
{% block content %}
|
||||
<section class="site-section site-section--admin-accounts">
|
||||
<header class="site-section__header">
|
||||
<h1 class="site-section__heading">
|
||||
Accounts
|
||||
</h1>
|
||||
</header>
|
||||
<form
|
||||
id="accounts-filter"
|
||||
class="form"
|
||||
method="GET"
|
||||
>
|
||||
<div class="form__section">
|
||||
<label for="search-name" class="form__label">Name:</label>
|
||||
<input
|
||||
id="search-name"
|
||||
class="form__input"
|
||||
type="text"
|
||||
name="name"
|
||||
{% if request.args.get('name') %}
|
||||
value="{{ request.args.get('name') }}"
|
||||
{% endif %}
|
||||
>
|
||||
</div>
|
||||
<div class="form__section">
|
||||
<label
|
||||
for="accounts-filter__roles" class="form__label"
|
||||
>
|
||||
Roles:
|
||||
</label>
|
||||
<select
|
||||
id="accounts-filter__roles"
|
||||
class="form__select"
|
||||
name="role"
|
||||
>
|
||||
<option
|
||||
class="form__option"
|
||||
value="all"
|
||||
{% if request.args.get('role') == 'all' %}
|
||||
selected
|
||||
{% endif %}
|
||||
>
|
||||
All
|
||||
</option>
|
||||
{% for role in props.role_list %}
|
||||
<option
|
||||
class="form__option"
|
||||
value="{{ role }}"
|
||||
{% if request.args.get('role') == role %}
|
||||
selected
|
||||
{% endif %}
|
||||
>
|
||||
{{ role | capitalize }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form__section">
|
||||
<button
|
||||
class="form__button form__button--submit"
|
||||
type="submit"
|
||||
>
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form
|
||||
id="account-list"
|
||||
method="POST"
|
||||
>
|
||||
{{ paginator('account-pages', request, props.pagination) }}
|
||||
{% call card_list('legacy') %}
|
||||
{% for account in props.accounts %}
|
||||
{% if account.role == 'moderator' %}
|
||||
<div class="form__section account__view account__view--demote">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="consumer"
|
||||
id="account-{{ account.id }}"
|
||||
class="form__input account__role-check"
|
||||
value="{{ account.id }}"
|
||||
>
|
||||
<div class="account__info">
|
||||
{{ account_card(account) }}
|
||||
<label
|
||||
for="account-{{ account.id }}"
|
||||
class="form__label account__label"
|
||||
>Demote</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% elif account.role == 'consumer'%}
|
||||
<div class="form__section account__view account__view--promote">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="moderator"
|
||||
id="account-{{ account.id }}"
|
||||
class="form__input account__role-check"
|
||||
value="{{ account.id }}"
|
||||
>
|
||||
<div class="account__info">
|
||||
{{ account_card(account) }}
|
||||
<label
|
||||
for="account-{{ account.id }}"
|
||||
class="form__label account__label"
|
||||
>Promote</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% else %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<p>No accounts found.</p>
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
{# {{ paginator('account-pages', request, props.pagination) }} #}
|
||||
{% if props.accounts | length %}
|
||||
<div class="form__section form__section--buttons">
|
||||
<button
|
||||
class="form__button form__button--submit"
|
||||
type="submit"
|
||||
>
|
||||
Submit
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</form>
|
||||
{{ paginator_controller(
|
||||
'account-pages',
|
||||
request,
|
||||
props.pagination
|
||||
) }}
|
||||
</section>
|
||||
{% endblock content %}
|
76
client/src/pages/account/administrator/accounts.scss
Normal file
76
client/src/pages/account/administrator/accounts.scss
Normal file
|
@ -0,0 +1,76 @@
|
|||
@use "../../../css/config/variables" as *;
|
||||
|
||||
.site-section--admin-accounts {
|
||||
.account {
|
||||
&__view {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
margin-bottom: 3em;
|
||||
|
||||
&--promote {
|
||||
& .account__info {
|
||||
border-radius: 10px 10px 0 10px;
|
||||
}
|
||||
|
||||
& .account__label {
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&--demote {
|
||||
& .account__info {
|
||||
border-radius: 10px 10px 10px 0;
|
||||
}
|
||||
|
||||
& .account__label {
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__role-check {
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
max-width: 1px;
|
||||
|
||||
&:checked + .account__info {
|
||||
--local-colour1: var(--colour1-tertiary);
|
||||
--local-background-colour1: var(--submit-colour1-primary);
|
||||
--local-border-colour1: var(--submit-colour1-primary);
|
||||
}
|
||||
}
|
||||
|
||||
&__info {
|
||||
--local-colour1: var(--colour0-primary);
|
||||
--local-background-colour1: var(--colour1-tertiary);
|
||||
--local-border-colour1: var(--colour1-tertiary);
|
||||
|
||||
max-width: var(--card-size);
|
||||
height: 100%;
|
||||
border-radius: 10px;
|
||||
border: $size-thin solid var(--local-border-colour1);
|
||||
overflow: hidden;
|
||||
transition-duration: var(--duration-global);
|
||||
transition-property: border-color;
|
||||
|
||||
& .account-card {
|
||||
height: 100%;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__label {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
color: var(--local-colour1);
|
||||
background-color: var(--local-background-colour1);
|
||||
border-radius: 0 0 10px 10px;
|
||||
border: $size-thin solid var(--local-border-colour1);
|
||||
border-top: none;
|
||||
padding: $size-small;
|
||||
transition-duration: var(--duration-global);
|
||||
transition-property: color, background-color, border-color;
|
||||
}
|
||||
}
|
||||
}
|
18
client/src/pages/account/administrator/dashboard.html
Normal file
18
client/src/pages/account/administrator/dashboard.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
{% extends 'account/administrator/shell.html' %}
|
||||
|
||||
{% block content %}
|
||||
<section class="site-section site-section--admin-dashboard">
|
||||
<header class="site-section__header">
|
||||
<h1 class="site-section__heading">
|
||||
Admin dashboard
|
||||
</h1>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/account/administrator/accounts">Accounts</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</section>
|
||||
{% endblock content %}
|
18
client/src/pages/account/administrator/mods_actions.html
Normal file
18
client/src/pages/account/administrator/mods_actions.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
{% extends 'account/administrator/shell.html' %}
|
||||
|
||||
{% block content %}
|
||||
<section class="site-section site-section--admin-mods-actions">
|
||||
<header class="site-section__header">
|
||||
<h1 class="site-section__heading">
|
||||
Moderator actions
|
||||
</h1>
|
||||
</header>
|
||||
<ul>
|
||||
{% for action in props.actions %}
|
||||
<li>action</li>
|
||||
{% else %}
|
||||
<li>No actions found</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</section>
|
||||
{% endblock content %}
|
18
client/src/pages/account/administrator/shell.html
Normal file
18
client/src/pages/account/administrator/shell.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
{% extends 'components/shell.html' %}
|
||||
|
||||
{# TODO: filter only admin entry #}
|
||||
{% block bundler_output %}
|
||||
<% for (const css in htmlWebpackPlugin.files.css) { %>
|
||||
<% if (htmlWebpackPlugin.files.css[css].startsWith("/static/bundle/css/admin")) { %>
|
||||
<link rel="stylesheet" href="<%= htmlWebpackPlugin.files.css[css] %>">
|
||||
<% } %>
|
||||
<% } %>
|
||||
<% for (const chunk in htmlWebpackPlugin.files.chunks) { %>
|
||||
<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>" defer></script>
|
||||
<% } %>
|
||||
<% for (const scriptPath in htmlWebpackPlugin.files.js) { %>
|
||||
<% if (htmlWebpackPlugin.files.js[scriptPath].startsWith("/static/bundle/js/admin") || htmlWebpackPlugin.files.js[scriptPath].startsWith("/static/bundle/js/runtime") || htmlWebpackPlugin.files.js[scriptPath].startsWith("/static/bundle/js/vendors")) { %>
|
||||
<script src="<%= htmlWebpackPlugin.files.js[scriptPath] %>" defer></script>
|
||||
<% } %>
|
||||
<% } %>
|
||||
{% endblock bundler_output %}
|
1
client/src/pages/account/administrator/shell.scss
Normal file
1
client/src/pages/account/administrator/shell.scss
Normal file
|
@ -0,0 +1 @@
|
|||
@use "../../components/shell";
|
44
client/src/pages/account/change_password.html
Normal file
44
client/src/pages/account/change_password.html
Normal file
|
@ -0,0 +1,44 @@
|
|||
{% extends "components/shell.html" %}
|
||||
|
||||
{% block content %}
|
||||
<section class="login-container site-section site-section--change-password">
|
||||
<h1 class="site-section__heading">Change Password</h1>
|
||||
|
||||
<form
|
||||
id="change_password_form"
|
||||
class="form"
|
||||
method="POST"
|
||||
action="{{ url_for('account.change_password') }}"
|
||||
>
|
||||
<div class="form__section">
|
||||
<label class="form__label" for="current-password">Current password:</label>
|
||||
<input id="current-password" class="form__input form__input--password" type="password" name="current-password" autocomplete="current-password">
|
||||
<ul>
|
||||
<li id="password-char-count" class="form__hint">5+ characters</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="form__section">
|
||||
<label class="form__label" for="new-password">New password:</label>
|
||||
<input id="new-password" class="form__input form__input--password" type="password" name="new-password" autocomplete="new-password">
|
||||
<ul>
|
||||
<li id="new-password-char-count" class="form__hint">5+ characters</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="form__section">
|
||||
<label class="form__label" for="new-password-confirmation">Confirm new password:</label>
|
||||
<input id="new-password-confirmation" class="form__input form__input--password" type="password" name="new-password-confirmation" autocomplete="new-password">
|
||||
<ul>
|
||||
<li id="password-confirm-matches" class="form__hint">Matches password</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="form__section">
|
||||
<button id="submit" class="form__button form__button--submit" type="submit" disabled>
|
||||
Change password
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
{% endblock %}
|
45
client/src/pages/account/change_password.js
Normal file
45
client/src/pages/account/change_password.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
export function changePasswordPage() {
|
||||
let passwordInput = () => document.getElementById("current-password");
|
||||
let newPasswordInput = () => document.getElementById("new-password");
|
||||
let newPasswordConfirmationInput = () => document.getElementById("new-password-confirmation");
|
||||
let submitButton = () => document.getElementById("submit");
|
||||
|
||||
let passCharCount = () => document.getElementById("password-char-count");
|
||||
let newPassCharCount = () => document.getElementById("new-password-char-count");
|
||||
let passMatches = () => document.getElementById("password-confirm-matches");
|
||||
|
||||
function doValidate(e) {
|
||||
let password = passwordInput().value;
|
||||
let newPassword = newPasswordInput().value;
|
||||
let newPasswordConfirmation = newPasswordConfirmationInput().value;
|
||||
let errors = false;
|
||||
|
||||
if (password.length < 5) {
|
||||
errors = true;
|
||||
passCharCount().classList.add("invalid");
|
||||
} else {
|
||||
passCharCount().classList.remove("invalid");
|
||||
}
|
||||
|
||||
if (newPassword.length < 5) {
|
||||
errors = true;
|
||||
newPassCharCount().classList.add("invalid");
|
||||
} else {
|
||||
newPassCharCount().classList.remove("invalid");
|
||||
}
|
||||
|
||||
if (newPassword != newPasswordConfirmation || newPassword.length < 5) {
|
||||
errors = true;
|
||||
passMatches().classList.add("invalid");
|
||||
} else {
|
||||
passMatches().classList.remove("invalid");
|
||||
}
|
||||
|
||||
submitButton().disabled = errors;
|
||||
}
|
||||
|
||||
doValidate();
|
||||
passwordInput().addEventListener("input", doValidate);
|
||||
newPasswordInput().addEventListener("input", doValidate);
|
||||
newPasswordConfirmationInput().addEventListener("input", doValidate);
|
||||
}
|
2
client/src/pages/account/components/_index.scss
Normal file
2
client/src/pages/account/components/_index.scss
Normal file
|
@ -0,0 +1,2 @@
|
|||
@use "notification";
|
||||
@use "service_key";
|
20
client/src/pages/account/components/notification.html
Normal file
20
client/src/pages/account/components/notification.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{% from 'components/timestamp.html' import timestamp %}
|
||||
|
||||
{% macro ACCOUNT_ROLE_CHANGE(extra_info) %}
|
||||
Your role was changed from {{ extra_info.old_role }} to {{ extra_info.new_role }}.
|
||||
{% endmacro %}
|
||||
|
||||
{% set notification_types = {
|
||||
1: ACCOUNT_ROLE_CHANGE
|
||||
} %}
|
||||
|
||||
{% macro notification_item(notification) %}
|
||||
<li class="notifications__item {{ 'notifications__item--seen' if notification.is_seen }}">
|
||||
<span class="notifications__date">
|
||||
{{ timestamp(notification.created_at) }}
|
||||
</span>
|
||||
<span class="notifications__message">
|
||||
{{ notification_types[notification.type](notification.extra_info) }}
|
||||
</span>
|
||||
</li>
|
||||
{% endmacro %}
|
7
client/src/pages/account/components/notification.scss
Normal file
7
client/src/pages/account/components/notification.scss
Normal file
|
@ -0,0 +1,7 @@
|
|||
.notifications {
|
||||
&__item {
|
||||
&--seen {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
}
|
50
client/src/pages/account/components/service_key.html
Normal file
50
client/src/pages/account/components/service_key.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
{% from 'components/cards/base.html' import card, card_header, card_body, card_footer %}
|
||||
{% from 'components/timestamp.html' import timestamp %}
|
||||
|
||||
{% macro service_key_card(service_key, import_ids, class_name= none) %}
|
||||
{% set paysite = g.paysites[service_key.service] %}
|
||||
|
||||
{% call card(class_name= class_name) %}
|
||||
{% call card_header() %}
|
||||
<h2>
|
||||
{{ paysite.title }}
|
||||
</h2>
|
||||
{% endcall %}
|
||||
|
||||
{% call card_body() %}
|
||||
<dl class="service-key__stats">
|
||||
<div class="service-key__stat">
|
||||
<dt>Status:</dt>
|
||||
{% if not service_key.dead %}
|
||||
<dd class="service-key__status">
|
||||
Alive
|
||||
</dd>
|
||||
{% else %}
|
||||
<dd class="service-key__status service-key__status--dead">
|
||||
Dead
|
||||
</dd>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="service-key__stat">
|
||||
{% if import_ids %}
|
||||
<dt>Logs</dt>
|
||||
<ul>
|
||||
{% for log in import_ids %}
|
||||
<li><a href="/importer/status/{{ log['import_id'] }}">{{ log['import_id'] }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</dl>
|
||||
{% endcall %}
|
||||
|
||||
{% call card_footer() %}
|
||||
<dl class="service-key__stats">
|
||||
<div class="service-key__stat">
|
||||
<dd>Added:</dd>
|
||||
<dt>{{ timestamp(service_key.added) }}</dt>
|
||||
</div>
|
||||
</dl>
|
||||
{% endcall %}
|
||||
{% endcall %}
|
||||
{% endmacro %}
|
18
client/src/pages/account/components/service_key.scss
Normal file
18
client/src/pages/account/components/service_key.scss
Normal file
|
@ -0,0 +1,18 @@
|
|||
.service-key {
|
||||
&__stats {
|
||||
}
|
||||
|
||||
&__stat {
|
||||
& > * {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
|
||||
&__status {
|
||||
color: var(--positive-colour1-primary);
|
||||
|
||||
&--dead {
|
||||
color: var(--negative-colour1-primary);
|
||||
}
|
||||
}
|
||||
}
|
80
client/src/pages/account/home.html
Normal file
80
client/src/pages/account/home.html
Normal file
|
@ -0,0 +1,80 @@
|
|||
{% extends 'components/shell.html' %}
|
||||
|
||||
{% from 'components/image_link.html' import image_link %}
|
||||
|
||||
{% from 'components/timestamp.html' import timestamp %}
|
||||
{% from 'components/links.html' import kemono_link %}
|
||||
|
||||
{% set role_links = {
|
||||
"consumer": "/account",
|
||||
"moderator": "/account/moderator",
|
||||
"administrator": "/account/administrator"
|
||||
} %}
|
||||
|
||||
{% block title %}
|
||||
<title>{{ props.title }}</title>
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<section class="site-section site-section--account">
|
||||
<div class="account-view">
|
||||
<div class="account-view__header">
|
||||
{# Finishing icons later... #}
|
||||
{# <div class="account-view__icon">
|
||||
{{ image_link(
|
||||
src='/static/user-placeholder.jpg',
|
||||
class_name=''
|
||||
) }}
|
||||
</div> #}
|
||||
<span class="account-view__greeting">
|
||||
Hello,
|
||||
<span class="account-view__identity">
|
||||
{{ props.account.username }}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<div class="account-view__info">
|
||||
Joined {{ props.account.created_at|relative_date }} |
|
||||
<span class="account-view__role">
|
||||
{{ kemono_link(
|
||||
url=role_links[props.account.role],
|
||||
text=props.account.role,
|
||||
is_noop=false
|
||||
) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="def-list__section">
|
||||
Notifications:
|
||||
<span>
|
||||
{{ kemono_link(
|
||||
url="/account/notifications",
|
||||
text=props.notifications_count,
|
||||
is_noop=false
|
||||
) }}
|
||||
</span>
|
||||
</p>
|
||||
<p class="def-list__section">
|
||||
{{ kemono_link(
|
||||
url="/account/keys",
|
||||
text="Keys",
|
||||
is_noop=false
|
||||
) }}
|
||||
</p>
|
||||
<p class="def-list__section">
|
||||
{{ kemono_link(
|
||||
url="/account/review_dms",
|
||||
text="Review DMs",
|
||||
is_noop=false
|
||||
) }}
|
||||
</p>
|
||||
<p class="def-list__section">
|
||||
{{ kemono_link(
|
||||
url=url_for("account.change_password"),
|
||||
text="Change password",
|
||||
is_noop=false
|
||||
) }}
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock content %}
|
35
client/src/pages/account/home.scss
Normal file
35
client/src/pages/account/home.scss
Normal file
|
@ -0,0 +1,35 @@
|
|||
.site-section--account {
|
||||
max-width: 480px;
|
||||
background-color: #282a2e;
|
||||
box-shadow: 1px 2px 5px 4px rgb(0 0 0 / 0.2);
|
||||
border-radius: 4px;
|
||||
// border: 0.5px solid rgba(17, 17, 17, 1);
|
||||
& .account-view {
|
||||
margin: 0 auto;
|
||||
padding: 8px;
|
||||
|
||||
&__header {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&__greeting {
|
||||
color: hsl(0, 0%, 45%);
|
||||
font-weight: 300;
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
&__identity {
|
||||
color: #fff;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
&__info {
|
||||
font-size: 12px;
|
||||
color: hsl(0, 0%, 45%);
|
||||
}
|
||||
|
||||
&__role {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
}
|
||||
}
|
53
client/src/pages/account/keys.html
Normal file
53
client/src/pages/account/keys.html
Normal file
|
@ -0,0 +1,53 @@
|
|||
{% extends 'components/shell.html' %}
|
||||
|
||||
{% import 'components/site.html' as site %}
|
||||
{% from 'components/forms/base.html' import form %}
|
||||
{% from 'components/forms/submit_button.html' import submit_button %}
|
||||
{% from 'components/card_list.html' import card_list %}
|
||||
{% from 'components/cards/no_results.html' import no_results %}
|
||||
{% from 'account/components/service_key.html' import service_key_card %}
|
||||
|
||||
{% set page_title = 'Manage saved keys | ' ~ g.site_name %}
|
||||
|
||||
{% block title %}
|
||||
<title>
|
||||
{{ page_title }}
|
||||
</title>
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
{% call site.section('account-keys', 'Stored service keys') %}
|
||||
{% call card_list() %}
|
||||
{% for key in props.service_keys %}
|
||||
<div class="form__section key__view">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="revoke"
|
||||
id="key-{{ key.id }}"
|
||||
class="form__input key__revoke-check"
|
||||
value="{{ key.id }}"
|
||||
form="revoke-service-keys"
|
||||
>
|
||||
<div class="key__info">
|
||||
{{ service_key_card(key, import_ids[loop.index0], class_name="key__card") }}
|
||||
<label
|
||||
for="key-{{ key.id }}"
|
||||
class="form__label key__label"
|
||||
>Revoke</label>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
{{ no_results() }}
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
{% if props.service_keys %}
|
||||
{% call form(
|
||||
id= 'revoke-service-keys',
|
||||
action = '/account/keys',
|
||||
method= 'POST'
|
||||
) %}
|
||||
{{ submit_button('Revoke selected keys') }}
|
||||
{% endcall %}
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{% endblock content %}
|
58
client/src/pages/account/keys.scss
Normal file
58
client/src/pages/account/keys.scss
Normal file
|
@ -0,0 +1,58 @@
|
|||
@use "../../css/config/variables" as *;
|
||||
|
||||
.site-section--account-keys {
|
||||
.key {
|
||||
&__view {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
margin-bottom: 3em;
|
||||
}
|
||||
|
||||
&__revoke-check {
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
max-width: 1px;
|
||||
|
||||
&:checked + .key__info {
|
||||
--local-colour1: var(--colour1-tertiary);
|
||||
--local-background-colour1: var(--negative-colour1-primary);
|
||||
--local-border-colour1: var(--negative-colour1-primary);
|
||||
}
|
||||
}
|
||||
|
||||
&__info {
|
||||
--local-colour1: var(--colour0-primary);
|
||||
--local-background-colour1: var(--colour1-tertiary);
|
||||
--local-border-colour1: var(--colour1-tertiary);
|
||||
|
||||
max-width: var(--card-size);
|
||||
height: 100%;
|
||||
border-radius: 10px 10px 0 10px;
|
||||
border: $size-thin solid var(--local-border-colour1);
|
||||
overflow: hidden;
|
||||
transition-duration: var(--duration-global);
|
||||
transition-property: border-color;
|
||||
|
||||
& .key__card {
|
||||
height: 100%;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// &__card {}
|
||||
&__label {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
right: 0;
|
||||
color: var(--local-colour1);
|
||||
background-color: var(--local-background-colour1);
|
||||
border-radius: 0 0 10px 10px;
|
||||
border: $size-thin solid var(--local-border-colour1);
|
||||
border-top: none;
|
||||
padding: $size-small;
|
||||
transition-duration: var(--duration-global);
|
||||
transition-property: color, background-color, border-color;
|
||||
}
|
||||
}
|
||||
}
|
50
client/src/pages/account/login.html
Normal file
50
client/src/pages/account/login.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
{% extends 'components/shell.html' %}
|
||||
{% block content %}
|
||||
<section class="site-section site-section--login">
|
||||
<h1 class="site-section__heading">Login</h1>
|
||||
<p class="site-section__register-cta">
|
||||
Don't have an account? <a href="{{ url_for('account.get_register', location=location) }}">Register!</a> Your favorites will automatically be saved.
|
||||
</p>
|
||||
<form
|
||||
id="login_form"
|
||||
class="form"
|
||||
method="POST"
|
||||
action="{{ url_for('account.post_login') }}"
|
||||
>
|
||||
<input type="hidden" name="location" value="{{location}}" />
|
||||
|
||||
<div class="form__section">
|
||||
<label class="form__label" for="old-username">
|
||||
Username:
|
||||
</label>
|
||||
<input
|
||||
id="old-username"
|
||||
class="form__input"
|
||||
type="text"
|
||||
name="username"/>
|
||||
</div>
|
||||
|
||||
<div class="form__section">
|
||||
<label class="form__label" for="old-password">
|
||||
Password:
|
||||
</label>
|
||||
<input
|
||||
id="old-password"
|
||||
class="form__input"
|
||||
type="password"
|
||||
name="password"
|
||||
autocomplete="current-password"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="form__section">
|
||||
<button
|
||||
class="form__button form__button--submit"
|
||||
type="submit"
|
||||
>
|
||||
Login
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
{% endblock %}
|
4
client/src/pages/account/moderator/_index.js
Normal file
4
client/src/pages/account/moderator/_index.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* @type {Map<string, (section: HTMLElement) => void}
|
||||
*/
|
||||
export const moderatorPageScripts = new Map();
|
48
client/src/pages/account/moderator/_index.scss
Normal file
48
client/src/pages/account/moderator/_index.scss
Normal file
|
@ -0,0 +1,48 @@
|
|||
@use "../../../css/config/variables" as *;
|
||||
|
||||
.site-section--moderator-dashboard {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 960px;
|
||||
}
|
||||
|
||||
section#card-list {
|
||||
max-width: 960px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
|
||||
gap: 10px;
|
||||
|
||||
article.link-request-card {
|
||||
width: 310px;
|
||||
background-color: #282a2e;
|
||||
padding: 0.5em;
|
||||
border-radius: 5px;
|
||||
|
||||
h6 {
|
||||
color: var(--colour0-secondary);
|
||||
}
|
||||
|
||||
.control {
|
||||
text-align: center;
|
||||
padding-top: 0.5em;
|
||||
|
||||
button {
|
||||
border: none;
|
||||
background-color: var(--colour1-primary);
|
||||
font-size: 150%;
|
||||
width: calc((310px - 2em) / 2);
|
||||
height: 36px;
|
||||
|
||||
&.approve {
|
||||
color: green;
|
||||
}
|
||||
|
||||
&.reject {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
55
client/src/pages/account/moderator/creator_links.html
Normal file
55
client/src/pages/account/moderator/creator_links.html
Normal file
|
@ -0,0 +1,55 @@
|
|||
{% extends "components/shell.html" %}
|
||||
|
||||
{% block content %}
|
||||
<section class="site-section site-section--moderator-creator-links">
|
||||
<header class="site-section__header">
|
||||
<h1 class="site-section__heading">
|
||||
Creator links review
|
||||
</h1>
|
||||
</header>
|
||||
|
||||
<section id="card-list">
|
||||
{% for link in links %}
|
||||
<article id="link-request-{{ link.id }}" class="link-request-card" data-id="{{ link.id }}">
|
||||
<section class="from">
|
||||
<h6>{{ g.artists_or_creators }}:</h6>
|
||||
<span>
|
||||
<span>{{ g.paysites[link.from_creator.service].title }}</span>: <span>{{ link.from_creator.name }}</span>
|
||||
<a href="/{{ link.from_creator.service }}/user/{{ link.from_creator.id }}">»</a>
|
||||
</span>
|
||||
</section>
|
||||
<section class="to">
|
||||
<span>
|
||||
<span>{{ g.paysites[link.to_creator.service].title }}</span>: <span>{{ link.to_creator.name }}</span>
|
||||
<a href="/{{ link.to_creator.service }}/user/{{ link.to_creator.id }}">»</a>
|
||||
</span>
|
||||
</section>
|
||||
<section class="reason">
|
||||
<h6>Reason:</h6>
|
||||
{% if link.reason %}
|
||||
<span class="reason">{{ link.reason }}</span>
|
||||
{% else %}
|
||||
<span class="reason"><i>not provided</i></span>
|
||||
{% endif %}
|
||||
</section>
|
||||
<section class="user">
|
||||
<h6>User:</h6>
|
||||
<div>
|
||||
<span>{{ link.requester.username }}</span>
|
||||
(<span>{{ link.requester.role }}</span>)
|
||||
{# nowhere to link I guess #}
|
||||
{# <a href="#">»</a> #}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="control">
|
||||
<button class="approve">✓</button>
|
||||
<button class="reject">✗</button>
|
||||
</section>
|
||||
</article>
|
||||
{% else %}
|
||||
<p>No pending requests. Yay!</p>
|
||||
{% endfor %}
|
||||
</section>
|
||||
</section>
|
||||
{% endblock content %}
|
22
client/src/pages/account/moderator/creator_links.js
Normal file
22
client/src/pages/account/moderator/creator_links.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
export function creatorLinksPage() {
|
||||
Array.from(document.querySelectorAll(".link-request-card")).forEach(card => {
|
||||
card.querySelector(".control > .approve").addEventListener("click", async (_e) => {
|
||||
await approveLinkRequest(card.dataset["id"]);
|
||||
card.remove();
|
||||
});
|
||||
card.querySelector(".control > .reject").addEventListener("click", async (_e) => {
|
||||
await rejectLinkRequest(card.dataset["id"]);
|
||||
card.remove();
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
async function approveLinkRequest(requestId) {
|
||||
let resp = await fetch(`/creator_link_requests/${requestId}/approve`, { method: "POST" });
|
||||
let json = await resp.json();
|
||||
}
|
||||
|
||||
async function rejectLinkRequest(requestId) {
|
||||
let resp = await fetch(`/creator_link_requests/${requestId}/reject`, { method: "POST" });
|
||||
let json = await resp.json();
|
||||
}
|
18
client/src/pages/account/moderator/dashboard.html
Normal file
18
client/src/pages/account/moderator/dashboard.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
{% extends 'components/shell.html' %}
|
||||
|
||||
{% block content %}
|
||||
<section class="site-section site-section--moderator-dashboard">
|
||||
<header class="site-section__header">
|
||||
<h1 class="site-section__heading">
|
||||
Moderator room
|
||||
</h1>
|
||||
</header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/account/moderator/tasks/creator_links">Creator link requests</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</section>
|
||||
{% endblock content %}
|
11
client/src/pages/account/moderator/files.html
Normal file
11
client/src/pages/account/moderator/files.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
{% extends 'components/shell.html' %}
|
||||
|
||||
{% block content %}
|
||||
<section class="site-section site-section--moderator-dashboard">
|
||||
<header class="site-section__header">
|
||||
<h1 class="site-section__heading">
|
||||
Files for review
|
||||
</h1>
|
||||
</header>
|
||||
</section>
|
||||
{% endblock content %}
|
27
client/src/pages/account/notifications.html
Normal file
27
client/src/pages/account/notifications.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
{% extends 'components/shell.html' %}
|
||||
|
||||
{% from 'components/timestamp.html' import timestamp %}
|
||||
{% from 'account/components/notification.html' import notification_item %}
|
||||
|
||||
{% block title %}
|
||||
<title>Account notificatons</title>
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<section class="site-section site-section--account-notifications">
|
||||
<header class="site-section__header">
|
||||
<h1 class="site-section__heading">
|
||||
Notifications
|
||||
</h1>
|
||||
</header>
|
||||
<ul class="notifications__list">
|
||||
{% for notification in props.notifications %}
|
||||
{{ notification_item(notification) }}
|
||||
{% else %}
|
||||
<li class="notifications__item">
|
||||
There are no notifications.
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</section>
|
||||
{% endblock content %}
|
19
client/src/pages/account/notifications.scss
Normal file
19
client/src/pages/account/notifications.scss
Normal file
|
@ -0,0 +1,19 @@
|
|||
@use "../../css/config/variables" as *;
|
||||
|
||||
.site-section--account-notifications {
|
||||
.notifications {
|
||||
&__list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
&__item {
|
||||
}
|
||||
|
||||
&__date {
|
||||
}
|
||||
|
||||
&__message {
|
||||
}
|
||||
}
|
||||
}
|
73
client/src/pages/account/register.html
Normal file
73
client/src/pages/account/register.html
Normal file
|
@ -0,0 +1,73 @@
|
|||
{% extends 'components/shell.html' %}
|
||||
{% block content %}
|
||||
<section class="login-container site-section site-section--register">
|
||||
<h1 class="site-section__heading">Register</h1>
|
||||
<div class="site-section__register-cta">
|
||||
Already have an account? <a href="{{ url_for('account.get_login', location=location) }}">Log in!</a>
|
||||
</div>
|
||||
<form
|
||||
id="register_form"
|
||||
class="form"
|
||||
method="POST"
|
||||
action="{{ url_for('account.post_register') }}"
|
||||
data-pattern="{{ props.username_regex }}"
|
||||
>
|
||||
<input
|
||||
type="hidden"
|
||||
id="serialized-favorites"
|
||||
name="favorites"
|
||||
/>
|
||||
<input type="hidden" name="location" value="{{location}}" />
|
||||
<div class="form__section">
|
||||
<label class="form__label" for="new-username">Username:</label>
|
||||
<input
|
||||
id="new-username"
|
||||
class="left-align-text form__input form__input--text"
|
||||
type="text"
|
||||
name="username"
|
||||
value="{{ request.form['username'] }}"
|
||||
/>
|
||||
<ul>
|
||||
<li id="username-char-count" class="form__hint">3-15 characters</li>
|
||||
<li id="username-allowed-characters" class="form__hint">Contains only letters, numbers, or @+.-</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="form__section">
|
||||
<label class="form__label" for="new-password">Password:</label>
|
||||
<input
|
||||
id="new-password"
|
||||
class="left-align-text form__input form__input--password"
|
||||
type="password"
|
||||
name="password"
|
||||
autocomplete="new-password"
|
||||
>
|
||||
<ul>
|
||||
<li id="password-char-count" class="form__hint">5+ characters</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form__section">
|
||||
<label class="form__label" for="password-confirm">Confirm Password:</label>
|
||||
<input
|
||||
id="password-confirm"
|
||||
class="left-align-text form__input form__input--password"
|
||||
type="password"
|
||||
name="confirm_password"
|
||||
autocomplete="new-password"
|
||||
>
|
||||
<ul>
|
||||
<li id="password-confirm-matches" class="form__hint">Matches password</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form__section">
|
||||
<button
|
||||
id="submit"
|
||||
class="form__button form__button--submit"
|
||||
type="submit"
|
||||
disabled
|
||||
>Register</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
96
client/src/pages/account/register.js
Normal file
96
client/src/pages/account/register.js
Normal file
|
@ -0,0 +1,96 @@
|
|||
import "./register.scss";
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} section
|
||||
*/
|
||||
export function registerPage(section) {
|
||||
populate_favorites();
|
||||
input_validation();
|
||||
}
|
||||
|
||||
function populate_favorites() {
|
||||
var input = document.getElementById("serialized-favorites");
|
||||
var favorites = localStorage.getItem("favorites");
|
||||
var to_serialize = [];
|
||||
if (input && favorites) {
|
||||
var artists = favorites.split(",");
|
||||
artists.forEach(function (artist) {
|
||||
var split = artist.split(":");
|
||||
if (split.length != 2) {
|
||||
return;
|
||||
}
|
||||
var elem = {
|
||||
service: split[0],
|
||||
artist_id: split[1],
|
||||
};
|
||||
to_serialize.push(elem);
|
||||
});
|
||||
var serialized = JSON.stringify(to_serialize);
|
||||
input.value = serialized;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function input_validation() {
|
||||
const USERNAME_INPUT = () => document.getElementById("new-username");
|
||||
const PASSWORD_INPUT = () => document.getElementById("new-password");
|
||||
const PASSWORD_CONFIRM_INPUT = () => document.getElementById("password-confirm");
|
||||
const SUBMIT_BUTTON = () => document.getElementById("submit");
|
||||
|
||||
const USER_CHAR_COUNT = () => document.getElementById("username-char-count");
|
||||
const ALLOWED_CHARS = () => document.getElementById("username-allowed-characters");
|
||||
const PASS_CHAR_COUNT = () => document.getElementById("password-char-count");
|
||||
const PASSWORD_CONFIRM = () => document.getElementById("password-confirm-matches");
|
||||
|
||||
const USERNAME_PAT = new RegExp("^" + document.getElementById("register_form").dataset["pattern"] + "$");
|
||||
const NOT_ALLOWED_CHARS_PAT = new RegExp(`[^a-z0-9_@+.\-]`, 'g');
|
||||
|
||||
function validateInputs(e) {
|
||||
let errors = false;
|
||||
let username = USERNAME_INPUT().value;
|
||||
let password = PASSWORD_INPUT().value;
|
||||
let passwordConfirmation = PASSWORD_CONFIRM_INPUT().value;
|
||||
|
||||
if (username.length < 3 || username.length > 15) {
|
||||
errors = true;
|
||||
USER_CHAR_COUNT().classList.add("invalid");
|
||||
} else {
|
||||
USER_CHAR_COUNT().classList.remove("invalid");
|
||||
}
|
||||
|
||||
if (!username.match(USERNAME_PAT)) {
|
||||
errors = true;
|
||||
ALLOWED_CHARS().classList.add("invalid");
|
||||
} else {
|
||||
ALLOWED_CHARS().classList.remove("invalid");
|
||||
}
|
||||
|
||||
if (password.length < 5) {
|
||||
errors = true;
|
||||
PASS_CHAR_COUNT().classList.add("invalid");
|
||||
} else {
|
||||
PASS_CHAR_COUNT().classList.remove("invalid");
|
||||
}
|
||||
|
||||
if (passwordConfirmation !== password || passwordConfirmation === "") {
|
||||
errors = true;
|
||||
PASSWORD_CONFIRM().classList.add("invalid");
|
||||
} else {
|
||||
PASSWORD_CONFIRM().classList.remove("invalid");
|
||||
}
|
||||
|
||||
SUBMIT_BUTTON().disabled = errors;
|
||||
}
|
||||
|
||||
window.addEventListener("load", (_event) => {
|
||||
USERNAME_INPUT().textContent = USERNAME_INPUT().textContent.toLowerCase().replace(NOT_ALLOWED_CHARS_PAT, "");
|
||||
validateInputs();
|
||||
USERNAME_INPUT().addEventListener("input", validateInputs);
|
||||
USERNAME_INPUT().addEventListener("input", (input) => {
|
||||
input.target.value = input.target.value.toLowerCase().replace(NOT_ALLOWED_CHARS_PAT, "");
|
||||
});
|
||||
PASSWORD_INPUT().addEventListener("input", validateInputs);
|
||||
PASSWORD_CONFIRM_INPUT().addEventListener("input", validateInputs);
|
||||
});
|
||||
|
||||
}
|
13
client/src/pages/account/register.scss
Normal file
13
client/src/pages/account/register.scss
Normal file
|
@ -0,0 +1,13 @@
|
|||
.form__hint.invalid {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.form__hint {
|
||||
color: green;
|
||||
}
|
||||
|
||||
button:disabled{
|
||||
color: hsl(0deg 0% 40%);
|
||||
background-image: linear-gradient(#4a5059, #4a5059);
|
||||
cursor: not-allowed;
|
||||
}
|
50
client/src/pages/all_dms.html
Normal file
50
client/src/pages/all_dms.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
{% extends 'components/shell.html' %}
|
||||
|
||||
{% import 'components/site.html' as site %}
|
||||
{% from 'components/card_list.html' import card_list %}
|
||||
{% from 'components/cards/dm.html' import dm_card %}
|
||||
{% from 'components/ads.html' import slider_ad, header_ad %}
|
||||
|
||||
{% block content %}
|
||||
{% call site.section("all-dms", title="DMs") %}
|
||||
{{ slider_ad() }}
|
||||
{{ header_ad() }}
|
||||
<div class="paginator" id="paginator-top">
|
||||
{% include 'components/paginator.html' %}
|
||||
<form
|
||||
action="/dms"
|
||||
method="GET"
|
||||
enctype="application/x-www-form-urlencoded"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
name="q"
|
||||
id="q"
|
||||
autocomplete="off"
|
||||
value="{{ request.args.get('q') if request.args.get('q') }}"
|
||||
minlength="3"
|
||||
class="search-input"
|
||||
placeholder="search for dms..."
|
||||
>
|
||||
<input type="submit" style="display: none">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% call card_list("phone") %}
|
||||
{% for dm in props.dms %}
|
||||
{{ dm_card(dm, artist=dm|attr("artist") or {}, is_global=True) }}
|
||||
{% else %}
|
||||
<div class="no-results">
|
||||
<h2 class="site-section__subheading">Nobody here but us chickens!</h2>
|
||||
<p class="subtitle">
|
||||
There are no DMs.
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
|
||||
<div class="paginator" id="paginator-bottom">
|
||||
{% include 'components/paginator.html' %}
|
||||
</div>
|
||||
{% endcall %}
|
||||
{% endblock %}
|
9
client/src/pages/all_dms.scss
Normal file
9
client/src/pages/all_dms.scss
Normal file
|
@ -0,0 +1,9 @@
|
|||
@use "../css/config/variables" as *;
|
||||
|
||||
.site-section--all-dms {
|
||||
.no-results {
|
||||
--card-size: $width-phone;
|
||||
padding: $size-small 0;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
3
client/src/pages/artist/_index.scss
Normal file
3
client/src/pages/artist/_index.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
@use "dms";
|
||||
@use "fancards";
|
||||
@use "linked_accounts";
|
77
client/src/pages/artist/announcements.html
Normal file
77
client/src/pages/artist/announcements.html
Normal file
|
@ -0,0 +1,77 @@
|
|||
{% extends "components/shell.html" %}
|
||||
|
||||
{% from "components/headers.html" import user_header %}
|
||||
{% from "components/card_list.html" import card_list %}
|
||||
{% from "components/cards/dm.html" import dm_card %}
|
||||
|
||||
{% set paysite = g.paysites[props.service] %}
|
||||
{% set page_title = "Announcements of " ~ props.artist.name ~ " from " ~ paysite.title ~ " | " ~ g.site_name %}
|
||||
|
||||
{% block title %}
|
||||
<title>{{ page_title }}</title>
|
||||
{% endblock %}
|
||||
|
||||
{% block meta %}
|
||||
<meta name="id" content="{{ props.id }}">
|
||||
<meta name="service" content="{{ props.service }}">
|
||||
<meta name="artist_name" content="{{ props.artist.name }}">
|
||||
<link rel="canonical" href="{{ g.canonical_url }}">
|
||||
{% endblock meta %}
|
||||
|
||||
{% block opengraph %}
|
||||
<meta property="og:title" content="{{ page_title }}">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:site_name" content="{{ g.site_name }}">
|
||||
<meta property="og:image" content="{{ g.icons_prepend | default(g.origin) }}/icons/{{ props.service }}/{{ props.id }}">
|
||||
<meta property="og:url" content="{{ g.canonical_url }}">
|
||||
{% endblock opengraph %}
|
||||
|
||||
{% block content %}
|
||||
<section class="site-section site-section--user">
|
||||
{{ user_header(request, props) }}
|
||||
<div class="paginator" id="paginator-top">
|
||||
{% include "components/tabs.html" %}
|
||||
</div>
|
||||
{# <div class="paginator" id="paginator-top">#}
|
||||
{# {% include "components/tabs.html" %}#}
|
||||
{# {% include "components/paginator.html" %}#}
|
||||
{##}
|
||||
{# <form>#}
|
||||
{# <input#}
|
||||
{# type="text"#}
|
||||
{# name="q"#}
|
||||
{# id="q"#}
|
||||
{# autocomplete="off"#}
|
||||
{# value="{{ request.args.get('q', '') }}"#}
|
||||
{# minlength="2" class="search-input"#}
|
||||
{# placeholder="search for announcements…"#}
|
||||
{# >#}
|
||||
{# </form>#}
|
||||
{# </div>#}
|
||||
|
||||
{% call card_list("phone") %}
|
||||
{% for announcement in props.announcements %}
|
||||
{{ dm_card(announcement) }}
|
||||
{% else %}
|
||||
<div class="no-results">
|
||||
<h2 class="site-section__subheading">Nobody here but us chickens!</h2>
|
||||
<p class="subtitle">
|
||||
There are no Announcements for your query.
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
|
||||
{# <div class="paginator" id="paginator-bottom">#}
|
||||
{# {% include "components/paginator.html" %}#}
|
||||
{# </div>#}
|
||||
</section>
|
||||
{% endblock content %}
|
||||
|
||||
{% block components %}
|
||||
<button class="user-header__favourite" type="button">
|
||||
<span class="user-header__fav-icon">☆</span>
|
||||
<span class="user-header__fav-text">Favorite</span>
|
||||
</button>
|
||||
{{ loading_icon() }}
|
||||
{% endblock components %}
|
56
client/src/pages/artist/dms.html
Normal file
56
client/src/pages/artist/dms.html
Normal file
|
@ -0,0 +1,56 @@
|
|||
{% extends 'components/shell.html' %}
|
||||
|
||||
{% from 'components/cards/dm.html' import dm_card %}
|
||||
{% from 'components/headers.html' import user_header %}
|
||||
{% from 'components/card_list.html' import card_list %}
|
||||
|
||||
{% set paysite = g.paysites[props.service] %}
|
||||
{% set page_title = 'DMs of ' ~ props.artist.name ~ ' from ' ~ paysite.title ~ ' | ' ~ g.site_name %}
|
||||
|
||||
{% block title %}
|
||||
<title>{{ page_title }}</title>
|
||||
{% endblock title %}
|
||||
|
||||
{% block meta %}
|
||||
<meta name="id" content="{{ props.id }}">
|
||||
<meta name="service" content="{{ props.service }}">
|
||||
<meta name="artist_name" content="{{ props.artist.name }}">
|
||||
<link rel="canonical" href="{{ g.canonical_url }}">
|
||||
{% endblock meta %}
|
||||
|
||||
{% block opengraph %}
|
||||
<meta property="og:title" content="{{ page_title }}">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:site_name" content="{{ g.site_name }}">
|
||||
<meta property="og:image" content="{{ g.icons_prepend | default(g.origin) }}/icons/{{ props.service }}/{{ props.id }}">
|
||||
<meta property="og:url" content="{{ g.canonical_url }}">
|
||||
{% endblock opengraph %}
|
||||
|
||||
{% block content %}
|
||||
<section class="site-section site-section--user">
|
||||
{{ user_header(request, props) }}
|
||||
<div class="paginator" id="paginator-top">
|
||||
{% include "components/tabs.html" %}
|
||||
</div>
|
||||
{% call card_list("phone") %}
|
||||
{% for dm in props.dms %}
|
||||
{{ dm_card(dm, artist=dm|attr("artist") or {}) }}
|
||||
{% else %}
|
||||
<div class="no-results">
|
||||
<h2 class="site-section__subheading">Nobody here but us chickens!</h2>
|
||||
<p class="subtitle">
|
||||
There are no DMs for your query.
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
</section>
|
||||
{% endblock content %}
|
||||
|
||||
{% block components %}
|
||||
<button class="user-header__favourite" type="button">
|
||||
<span class="user-header__fav-icon">☆</span>
|
||||
<span class="user-header__fav-text">Favorite</span>
|
||||
</button>
|
||||
{{ loading_icon() }}
|
||||
{% endblock components %}
|
9
client/src/pages/artist/dms.scss
Normal file
9
client/src/pages/artist/dms.scss
Normal file
|
@ -0,0 +1,9 @@
|
|||
@use "../../css/config/variables" as *;
|
||||
|
||||
.site-section--dms {
|
||||
.no-results {
|
||||
--card-size: $width-phone;
|
||||
padding: $size-small 0;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user