1
0
Fork 0
mirror of https://github.com/heyarne/airsonic-ui.git synced 2026-05-07 02:33:39 +02:00

Compare commits

...

No commits in common. "master" and "v0.2" have entirely different histories.

100 changed files with 2022 additions and 15797 deletions

View file

@ -1,102 +0,0 @@
# Deployment is configured following these instructions:
# https://circleci.com/blog/deploying-documentation-to-github-pages-with-continuous-integration/
version: 2
jobs:
test:
working_directory: ~/repo
docker:
- image: circleci/openjdk:11-jdk-stretch-node-browsers
environment:
- CHROME_BIN: "/usr/bin/google-chrome"
steps:
- checkout
- restore_cache:
keys:
- build_cache-{{ checksum "package.json" }}-{{ checksum "shadow-cljs.edn" }}
- run:
name: Install dependencies
command: npm install
- run:
name: Test
command: npm test
- save_cache:
paths:
- node_modules
- .shadow-cljs
- ~/.m2
- ~/.npm
key: build_cache-{{ checksum "package.json" }}-{{ checksum "shadow-cljs.edn" }}
build:
working_directory: ~/repo
docker:
- image: circleci/openjdk:11-jdk-stretch-node-browsers
steps:
- checkout
- restore_cache:
keys:
- build_cache-{{ checksum "package.json" }}-{{ checksum "shadow-cljs.edn" }}
- run:
name: Install dependencies
command: npm install
- run:
name: Build SPA
command: npm run build
- save_cache:
paths:
- node_modules
- .shadow-cljs
- ~/.m2
- ~/.npm
key: build_cache-{{ checksum "package.json" }}-{{ checksum "shadow-cljs.edn" }}
- persist_to_workspace:
root: /home/circleci/repo/public
paths:
- "*"
deploy:
working_directory: ~/repo
docker:
- image: circleci/openjdk:11-jdk-stretch-node-browsers
steps:
- add_ssh_keys:
fingerprints:
- "85:2f:28:0f:b9:45:b8:f1:0f:c2:0a:1c:5e:4d:a2:06"
- checkout
- attach_workspace:
at: /home/circleci/repo/public
- restore_cache:
keys:
- build_cache-{{ checksum "package.json" }}-{{ checksum "shadow-cljs.edn" }}
- run:
name: Install dependencies
command: npm install
- run:
name: Deploy to gh-pages branch
command: |
git config user.email "build@circleci.com"
git config user.name "ci-build"
npm run deploy
workflows:
version: 2
test-build-deploy:
jobs:
- test:
filters:
branches:
ignore:
- gh-pages
- build:
requires:
- test
filters:
branches:
ignore:
- gh-pages
- deploy:
requires:
- build
filters:
branches:
only: master

76
.gitignore vendored
View file

@ -1,76 +0,0 @@
.nrepl-port
.rebel_readline_history
.shadow-cljs/
node_modules/
public/*
# Created by https://www.gitignore.io/api/emacs
### Emacs ###
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
projectile-bookmarks.eld
# directory configuration
.dir-locals.el
# saveplace
places
# url cache
url/cache/
# cedet
ede-projects.el
# smex
smex-items
# company-statistics
company-statistics-cache.el
# anaconda-mode
anaconda-mode/
# End of https://www.gitignore.io/api/emacs

2
.joker
View file

@ -1,2 +0,0 @@
{:known-macros [cljs.test/deftest]
:known-namespaces [cljs.core]}

View file

@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is 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. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
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.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
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 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. Use with the GNU Affero General Public License.
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 Affero 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 special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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 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 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 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 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
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 GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View file

@ -1,79 +0,0 @@
# Airsonic Web Client [![CircleCI](https://circleci.com/gh/heyarne/airsonic-ui.svg?style=svg)](https://circleci.com/gh/heyarne/airsonic-ui) [![Greenkeeper badge](https://badges.greenkeeper.io/heyarne/airsonic-ui.svg)](https://greenkeeper.io/)
This repository contains an alternative web frontend for [airsonic](https://github.com/airsonic/airsonic). The goal is to eventually be able to fully replace the current web interface.
## Implemented So Far
* Login with persisting credentials
* Browse your library by newest / most recently played / starred
* Browse artists alphabetically
* A currently playing queue with next, previous, repeat and shuffle
* Information about the current track with the ability to seek
## How Do I Host This Myself?
There are two options:
- You build it yourself by cloning the repository and running `npm run build`
- You grab a pre-built version from the [gh-pages branch](https://github.com/heyarne/airsonic-ui/tree/gh-pages) (just click the download button)
The files you receive either way should be identical. There's [an article about setting up nginx](https://github.com/heyarne/airsonic-ui/wiki/Self%E2%80%93hosting) in the repository wiki.
If you have any questions please ask them in the [airsonic matrix channel](https://riot.im/app/#/room/#airsonic:matrix.org).
## Development
The project is written in [ClojureScript](https://clojurescript.org/) and uses [re-frame](https://github.com/Day8/re-frame) for structure and peace of mind. The build tool is [shadow-cljs](https://shadow-cljs.github.io/docs/UsersGuide.html), which offers nice editor integration and interoparibility with the whole JavaScript ecosystem.
If you haven't worked with re-frame: I highly recommend it. Good resources are the project's [docs](https://github.com/Day8/re-frame/tree/master/docs) and a [post about its building blocks](https://purelyfunctional.tv/guide/re-frame-building-blocks/).
To build the project make sure you have Node.js (v22.0.0), npm, [entr](https://github.com/eradman/entr) and Java 8 installed in your system.
```
# after cloning the project, first install all dependencies
$ npm install
# start a continuous build with hot-code-reloading and continuous testing
# first build takes a while. open http://localhost:8080
$ npm run dev
```
All other build tasks are defined in the `package.json` (more below).
### Editor Integration
Integrating shadow-cljs with your editor helps tremendously with development. After having run `npm run dev` as described above you can connect to the REPL and get features like in-editor code execution and code completion / documentation lookup. For further information see [this part of the shadow-cljs user guide](https://shadow-cljs.github.io/docs/UsersGuide.html#_editor_integration). Recommended editors and plugins are Calva for VSCode and CIDER for Emacs (comes with Spacemacs). Make sure to open `localhost:8080` in the browser after starting the `dev:cljs` task to execute ClojureScript code in a live REPL.
### re-frame-10x
re-frame-10x is a debugger that is bundled with the app in development mode. Once you have the build running, hit `Ctrl + h` and the re-frame-10x window will show up:
![re-frame-10x in action](./docs/re-frame-10x.png)
It provides you with tools to inspect the state of the application, undo and replay events, debug performance issues and more.
## Tests
This project uses [karma](https://karma-runner.github.io/) for tests. There is a check inside `karma.conf.js` to see whether Firefox is installed (via `which firefox` which probably breaks on Windows 🤷); if that command doesn't fail it will be used as the test runner. Otherwise Chrome will be used. If you have Chromium installed, make sure to set the `CHROME_BIN` environment variable to point to Chromium.
```
# run tests once
$ npm test
```
**Note:** If you want nice console output in your tests, make sure to `(enable-console-print!)`. You can call `println` afterwards like you're used to.
## Deployment
```
# build and optimize the code once for production
$ npm run build
# publishes everything via gh-pages
$ npm run deploy
```
There is continuous deployment set up on [circleci](https://circleci.com/gh/heyarne/airsonic-ui) that builds and deploys to `gh-pages` after a commit to the `master` branch.
**Note:** If you have a continuous build running and run `npm run build` or `npm run deploy`, it will delete the compiled tests, causing the continuous tests to not run anymore. This can be fixed by running `npm test` again.
All build artifacts land in `/public`. Don't change anything in there as changes will be overwritten.

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Before After
Before After

1476
app/js/main.js Normal file

File diff suppressed because it is too large Load diff

1
app/js/manifest.edn Normal file

File diff suppressed because one or more lines are too long

1
app/style.css Normal file

File diff suppressed because one or more lines are too long

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 866 B

After

Width:  |  Height:  |  Size: 866 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before After
Before After

BIN
fonts/open-iconic.eot Normal file

Binary file not shown.

BIN
fonts/open-iconic.otf Normal file

Binary file not shown.

543
fonts/open-iconic.svg Normal file
View file

@ -0,0 +1,543 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!--
2014-7-1: Created.
-->
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
Created by FontForge 20120731 at Tue Jul 1 20:39:22 2014
By P.J. Onori
Created by P.J. Onori with FontForge 2.0 (http://fontforge.sf.net)
</metadata>
<defs>
<font id="open-iconic" horiz-adv-x="800" >
<font-face
font-family="Icons"
font-weight="400"
font-stretch="normal"
units-per-em="800"
panose-1="2 0 5 3 0 0 0 0 0 0"
ascent="800"
descent="0"
bbox="-0.5 -101 802 800.126"
underline-thickness="50"
underline-position="-100"
unicode-range="U+E000-E0DE"
/>
<missing-glyph />
<glyph glyph-name="" unicode="&#xe000;"
d="M300 700h500v-700h-500v100h400v500h-400v100zM400 500l200 -150l-200 -150v100h-400v100h400v100z" />
<glyph glyph-name="1" unicode="&#xe001;"
d="M300 700h500v-700h-500v100h400v500h-400v100zM200 500v-100h400v-100h-400v-100l-200 150z" />
<glyph glyph-name="2" unicode="&#xe002;"
d="M350 700c193 0 350 -157 350 -350v-50h100l-200 -200l-200 200h100v50c0 138 -112 250 -250 250s-250 -112 -250 -250c0 193 157 350 350 350z" />
<glyph glyph-name="3" unicode="&#xe003;"
d="M450 700c193 0 350 -157 350 -350c0 138 -112 250 -250 250s-250 -112 -250 -250v-50h100l-200 -200l-200 200h100v50c0 193 157 350 350 350z" />
<glyph glyph-name="4" unicode="&#xe004;"
d="M0 700h800v-100h-800v100zM100 500h600v-100h-600v100zM0 300h800v-100h-800v100zM100 100h600v-100h-600v100z" />
<glyph glyph-name="5" unicode="&#xe005;"
d="M0 700h800v-100h-800v100zM0 500h600v-100h-600v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100z" />
<glyph glyph-name="6" unicode="&#xe006;"
d="M0 700h800v-100h-800v100zM200 500h600v-100h-600v100zM0 300h800v-100h-800v100zM200 100h600v-100h-600v100z" />
<glyph glyph-name="7" unicode="&#xe007;"
d="M400 700c75 0 146 -23 206 -59l-75 -225l-322 234c57 31 122 50 191 50zM125 588l191 -138l-310 -222c-4 24 -6 47 -6 72c0 114 49 215 125 288zM688 575c69 -72 112 -168 112 -275c0 -35 -8 -68 -16 -100h-218zM216 253l112 -347c-128 23 -232 109 -287 222zM372 100
h372c-64 -109 -177 -185 -310 -197z" />
<glyph glyph-name="8" unicode="&#xe008;" horiz-adv-x="600"
d="M200 800h100v-500h200l-247 -300l-253 300h200v500z" />
<glyph glyph-name="9" unicode="&#xe009;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM300 700v-300h-200l300 -300l300 300h-200v300h-200z" />
<glyph glyph-name="a" unicode="&#xe00a;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700l-300 -300l300 -300v200h300v200h-300v200z" />
<glyph glyph-name="b" unicode="&#xe00b;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700v-200h-300v-200h300v-200l300 300z" />
<glyph glyph-name="c" unicode="&#xe00c;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700l-300 -300h200v-300h200v300h200z" />
<glyph glyph-name="d" unicode="&#xe00d;"
d="M300 600v-200h500v-100h-500v-200l-300 247z" />
<glyph glyph-name="e" unicode="&#xe00e;"
d="M500 600l300 -247l-300 -253v200h-500v100h500v200z" />
<glyph glyph-name="f" unicode="&#xe00f;" horiz-adv-x="600"
d="M200 800h200v-500h200l-297 -300l-303 300h200v500z" />
<glyph glyph-name="10" unicode="&#xe010;"
d="M300 700v-200h500v-200h-500v-200l-300 297z" />
<glyph glyph-name="11" unicode="&#xe011;"
d="M500 700l300 -297l-300 -303v200h-500v200h500v200z" />
<glyph glyph-name="12" unicode="&#xe012;" horiz-adv-x="600"
d="M297 800l303 -300h-200v-500h-200v500h-200z" />
<glyph glyph-name="13" unicode="&#xe013;" horiz-adv-x="600"
d="M247 800l253 -300h-200v-500h-100v500h-200z" />
<glyph glyph-name="14" unicode="&#xe014;"
d="M400 800h100v-800h-100v800zM200 700h100v-600h-100v600zM600 600h100v-400h-100v400zM0 500h100v-200h-100v200z" />
<glyph glyph-name="15" unicode="&#xe015;"
d="M116 600l72 -72c-54 -54 -88 -126 -88 -209s34 -159 88 -213l-72 -72c-72 72 -116 175 -116 285s44 209 116 281zM684 600c72 -72 116 -171 116 -281s-44 -213 -116 -285l-72 72c54 54 88 130 88 213s-34 155 -88 209zM259 460l69 -72c-18 -18 -28 -41 -28 -69
s10 -54 28 -72l-69 -72c-36 36 -59 89 -59 144s23 105 59 141zM541 459c36 -36 59 -85 59 -140s-23 -108 -59 -144l-69 72c18 18 28 44 28 72s-10 51 -28 69z" />
<glyph glyph-name="16" unicode="&#xe016;" horiz-adv-x="400"
d="M200 800c110 0 200 -90 200 -200s-90 -200 -200 -200s-200 90 -200 200s90 200 200 200zM100 319c31 -11 65 -19 100 -19s68 8 100 19v-319l-100 100l-100 -100v319z" />
<glyph glyph-name="17" unicode="&#xe017;"
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300c0 -66 21 -126 56 -175l419 419c-49 35 -109 56 -175 56zM644 575l-419 -419c49 -35 109 -56 175 -56c166 0 300 134 300 300
c0 66 -21 126 -56 175z" />
<glyph glyph-name="18" unicode="&#xe018;"
d="M0 700h100v-600h700v-100h-800v700zM500 700h200v-500h-200v500zM200 500h200v-300h-200v300z" />
<glyph glyph-name="19" unicode="&#xe019;"
d="M397 800c13 1 23 -4 34 -13c2 -2 214 -254 241 -287h128v-100h-100v-366c0 -18 -16 -34 -34 -34h-532c-18 0 -34 16 -34 34v366h-100v100h128l234 281c9 11 22 18 35 19zM400 672l-144 -172h288zM250 300c-28 0 -50 -22 -50 -50v-100c0 -28 22 -50 50 -50s50 22 50 50
v100c0 28 -22 50 -50 50zM550 300c-28 0 -50 -22 -50 -50v-100c0 -28 22 -50 50 -50s50 22 50 50v100c0 28 -22 50 -50 50z" />
<glyph glyph-name="1a" unicode="&#xe01a;"
d="M9 700h682c6 0 9 -4 9 -10v-190h100v-200h-100v-191c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v582c0 6 3 9 9 9zM100 600v-400h500v400h-500z" />
<glyph glyph-name="1b" unicode="&#xe01b;"
d="M9 700h682c6 0 9 -4 9 -10v-190h100v-200h-100v-191c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v582c0 6 3 9 9 9z" />
<glyph glyph-name="1c" unicode="&#xe01c;"
d="M92 650c0 23 19 50 45 50h3h5h5h500c28 0 50 -22 50 -50s-22 -50 -50 -50h-50v-141c9 -17 120 -231 166 -309c16 -26 34 -61 34 -106c0 -39 -15 -77 -41 -103h-3c-26 -25 -62 -41 -100 -41h-512c-39 0 -77 15 -103 41s-41 64 -41 103c0 46 18 80 34 106
c46 78 157 292 166 309v141h-50c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51zM500 600h-200v-162l-6 -10s-63 -123 -119 -228h450c-56 105 -119 228 -119 228l-6 10v162z" />
<glyph glyph-name="1d" unicode="&#xe01d;"
d="M400 800c110 0 200 -90 200 -200c0 -104 52 -198 134 -266c41 -34 66 -82 66 -134h-800c0 52 25 100 66 134c82 68 134 162 134 266c0 110 90 200 200 200zM300 100h200c0 -55 -45 -100 -100 -100s-100 45 -100 100z" />
<glyph glyph-name="1e" unicode="&#xe01e;" horiz-adv-x="600"
d="M150 800h50l350 -250l-225 -147l225 -153l-350 -250h-50v250l-75 -75l-75 75l150 150l-150 150l75 75l75 -75v250zM250 650v-200l150 100zM250 350v-200l150 100z" />
<glyph glyph-name="1f" unicode="&#xe01f;"
d="M0 800h500c110 0 200 -90 200 -200c0 -47 -17 -91 -44 -125c85 -40 144 -125 144 -225c0 -138 -112 -250 -250 -250h-550v100c55 0 100 45 100 100v400c0 55 -45 100 -100 100v100zM300 700v-200h100c55 0 100 45 100 100s-45 100 -100 100h-100zM300 400v-300h150
c83 0 150 67 150 150s-67 150 -150 150h-150z" />
<glyph glyph-name="20" unicode="&#xe020;" horiz-adv-x="600"
d="M300 800v-300h200l-300 -500v300h-200z" />
<glyph glyph-name="21" unicode="&#xe021;"
d="M100 800h300v-300l100 100l100 -100v300h50c28 0 50 -22 50 -50v-550h-550c-28 0 -50 -22 -50 -50s22 -50 50 -50h550v-100h-550c-83 0 -150 67 -150 150v550l3 19c8 39 39 70 78 78z" />
<glyph glyph-name="22" unicode="&#xe022;" horiz-adv-x="400"
d="M0 800h400v-800l-200 200l-200 -200v800z" />
<glyph glyph-name="23" unicode="&#xe023;"
d="M0 800h800v-100h-800v100zM0 600h300v-103h203v103h297v-591c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v591z" />
<glyph glyph-name="24" unicode="&#xe024;"
d="M300 800h200c55 0 100 -45 100 -100v-100h191c6 0 9 -3 9 -9v-241c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v241c0 6 3 9 9 9h191v100c0 55 45 100 100 100zM300 700v-100h200v100h-200zM0 209c16 -6 32 -9 50 -9h700c18 0 34 3 50 9v-200c0 -6 -3 -9 -9 -9h-782
c-6 0 -9 3 -9 9v200z" />
<glyph glyph-name="25" unicode="&#xe025;" horiz-adv-x="600"
d="M300 800c58 0 110 -16 147 -53s53 -89 53 -147h-100c0 39 -11 61 -25 75s-36 25 -75 25c-35 0 -55 -10 -72 -31s-28 -55 -28 -94c0 -51 20 -107 28 -175h172v-100h-178c-14 -60 -49 -127 -113 -200h491v-100h-600v122l16 12c69 69 95 121 106 166h-122v100h125
c-8 50 -25 106 -25 175c0 58 16 114 50 156c34 43 88 69 150 69z" />
<glyph glyph-name="26" unicode="&#xe026;"
d="M34 700h4h3h4h5h700c28 0 50 -22 50 -50v-700c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v700v2c0 20 15 42 34 48zM150 600c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50zM350 600c-28 0 -50 -22 -50 -50s22 -50 50 -50h300c28 0 50 22 50 50
s-22 50 -50 50h-300zM100 400v-400h600v400h-600z" />
<glyph glyph-name="27" unicode="&#xe027;"
d="M744 797l6 -3l44 -44c4 -4 3 -8 0 -12l-266 -375l-15 -13l-25 -12c-23 72 -78 127 -150 150l12 25l13 15l375 266zM266 400c74 0 134 -60 134 -134c0 -147 -119 -266 -266 -266c-48 0 -95 12 -134 34c80 46 134 133 134 232c0 74 58 134 132 134z" />
<glyph glyph-name="28" unicode="&#xe028;"
d="M9 451c0 23 19 50 46 50c8 0 19 -3 26 -7l131 -66l29 22c-79 81 -1 250 118 250s197 -167 119 -250l28 -22l131 66c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-115 -56c9 -16 19 -33 25 -50h68c28 0 50 -22 50 -50s-22 -50 -50 -50h-50
c0 -23 -2 -45 -6 -66l78 -40c21 -5 37 -28 37 -49c0 -28 -22 -50 -50 -50c-10 0 -23 5 -31 11l-65 35c-24 -46 -62 -86 -103 -110c-35 19 -60 45 -60 72v135v4v5v6v5v5v87c0 28 -22 50 -50 50c-24 0 -45 -17 -50 -40c1 -3 1 -8 1 -11s0 -8 -1 -11v-82v-4v-5v-144
c0 -28 -24 -53 -59 -72c-41 25 -79 64 -103 110l-66 -35c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50c0 21 16 44 37 49l78 40c-4 21 -6 43 -6 66h-50h-5c-28 0 -50 22 -50 50c0 26 22 50 50 50h5h69c6 17 16 34 25 50l-116 56c-16 7 -28 27 -28 45z" />
<glyph glyph-name="29" unicode="&#xe029;"
d="M600 700h91c6 0 9 -3 9 -9v-582c0 -6 -3 -9 -9 -9h-91v600zM210 503l290 147v-500l-250 125v-3c-15 0 -25 -8 -28 -22l75 -178c11 -25 0 -58 -25 -69s-58 0 -69 25l-103 272h-91c-6 0 -9 3 -9 9v182c0 6 3 9 9 9h182z" />
<glyph glyph-name="2a" unicode="&#xe02a;"
d="M9 800h682c6 0 9 -3 9 -9v-782c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v782c0 6 3 9 9 9zM100 700v-200h500v200h-500zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400v-300h100v300h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100z" />
<glyph glyph-name="2b" unicode="&#xe02b;"
d="M0 800h700v-200h-700v200zM0 500h700v-491c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v491zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400v-100h100v100h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100z" />
<glyph glyph-name="2c" unicode="&#xe02c;"
d="M409 800h182c6 0 10 -4 12 -9l94 -182c2 -5 6 -9 12 -9h82c6 0 9 -3 9 -9v-582c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v441c0 83 67 150 150 150h141c6 0 10 4 12 9l94 182c2 5 6 9 12 9zM150 500c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z
M500 500c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200zM500 400c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
<glyph glyph-name="2d" unicode="&#xe02d;"
d="M0 600h800l-400 -400z" />
<glyph glyph-name="2e" unicode="&#xe02e;" horiz-adv-x="400"
d="M400 800v-800l-400 400z" />
<glyph glyph-name="2f" unicode="&#xe02f;" horiz-adv-x="400"
d="M0 800l400 -400l-400 -400v800z" />
<glyph glyph-name="30" unicode="&#xe030;"
d="M400 600l400 -400h-800z" />
<glyph glyph-name="31" unicode="&#xe031;"
d="M0 550c0 23 20 50 46 50h3h5h4h200c17 0 37 -13 44 -28l38 -72h444c14 0 19 -12 15 -25l-81 -250c-4 -13 -21 -25 -35 -25h-350c-14 0 -30 12 -34 25c-27 83 -54 167 -81 250l-10 25h-150c-2 0 -5 -1 -7 -1c-28 0 -51 23 -51 51zM358 100c28 0 50 -22 50 -50
s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM658 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
<glyph glyph-name="32" unicode="&#xe032;"
d="M0 700h500v-100h-300v-300h-100l-100 -100v500zM300 500h500v-500l-100 100h-400v400z" />
<glyph glyph-name="33" unicode="&#xe033;"
d="M641 700l143 -141l-493 -493c-71 76 -146 148 -219 222l-72 71l141 141c50 -51 101 -101 153 -150c116 117 234 231 347 350z" />
<glyph glyph-name="34" unicode="&#xe034;"
d="M150 600l250 -250l250 250l150 -150l-400 -400l-400 400z" />
<glyph glyph-name="35" unicode="&#xe035;" horiz-adv-x="600"
d="M400 800l150 -150l-250 -250l250 -250l-150 -150l-400 400z" />
<glyph glyph-name="36" unicode="&#xe036;" horiz-adv-x="600"
d="M150 800l400 -400l-400 -400l-150 150l250 250l-250 250z" />
<glyph glyph-name="37" unicode="&#xe037;"
d="M400 600l400 -400l-150 -150l-250 250l-250 -250l-150 150z" />
<glyph glyph-name="38" unicode="&#xe038;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM600 622l-250 -250l-100 100l-72 -72l172 -172l322 322z" />
<glyph glyph-name="39" unicode="&#xe039;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM250 622l-72 -72l150 -150l-150 -150l72 -72l150 150l150 -150l72 72l-150 150l150 150l-72 72l-150 -150z" />
<glyph glyph-name="3a" unicode="&#xe03a;"
d="M350 800c28 0 50 -22 50 -50v-50h75c14 0 25 -11 25 -25v-75h-300v75c0 14 11 25 25 25h75v50c0 28 22 50 50 50zM25 700h75v-200h500v200h75c14 0 25 -11 25 -25v-650c0 -14 -11 -25 -25 -25h-650c-14 0 -25 11 -25 25v650c0 14 11 25 25 25z" />
<glyph glyph-name="3b" unicode="&#xe03b;"
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM350 600h100v-181c23 -24 47 -47 72 -69l-72 -72c-27 30 -55 59 -84 88l-16 12
v222z" />
<glyph glyph-name="3c" unicode="&#xe03c;"
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -18 -3 -34 -9 -50h-191v50c0 83 -67 150 -150 150s-150 -67 -150 -150v-50h-272c-17 30 -28 63 -28 100c0 110 90 200 200 200c23 114 129 200 250 200zM434 400h3h4c3 0 6 1 9 1c28 0 50 -22 50 -50v-1
v-150h150l-200 -200l-200 200h150v150v2c0 20 15 42 34 48z" />
<glyph glyph-name="3d" unicode="&#xe03d;"
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -18 -3 -34 -9 -50h-141l-200 200l-200 -200h-222c-17 30 -28 63 -28 100c0 110 90 200 200 200c23 114 129 200 250 200zM450 350l250 -250h-200v-50c0 -28 -22 -50 -50 -50s-50 22 -50 50v50h-200z" />
<glyph glyph-name="3e" unicode="&#xe03e;"
d="M450 700c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -83 -67 -150 -150 -150h-450c-110 0 -200 90 -200 200s90 200 200 200c23 114 129 200 250 200z" />
<glyph glyph-name="3f" unicode="&#xe03f;"
d="M250 800c82 0 154 -40 200 -100c-143 0 -270 -85 -325 -209c-36 -10 -70 -25 -100 -47c-16 33 -25 67 -25 106c0 138 112 250 250 250zM450 600c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -83 -67 -150 -150 -150h-450c-110 0 -200 90 -200 200
s90 200 200 200c23 114 129 200 250 200z" />
<glyph glyph-name="40" unicode="&#xe040;"
d="M500 700h100l-300 -600h-100zM100 600h100l-100 -200l100 -200h-100l-100 200zM600 600h100l100 -200l-100 -200h-100l100 200z" />
<glyph glyph-name="41" unicode="&#xe041;"
d="M350 800h100l50 -119l28 -12l119 50l72 -72l-50 -119l12 -28l119 -50v-100l-119 -50l-12 -28l50 -119l-72 -72l-119 50l-28 -12l-50 -119h-100l-50 119l-28 12l-119 -50l-72 72l50 119l-12 28l-119 50v100l119 50l12 28l-50 119l72 72l119 -50l28 12zM400 550
c-83 0 -150 -67 -150 -150s67 -150 150 -150s150 67 150 150s-67 150 -150 150z" />
<glyph glyph-name="42" unicode="&#xe042;"
d="M0 800h800v-200h-800v200zM200 500h400l-200 -200zM0 100h800v-100h-800v100z" />
<glyph glyph-name="43" unicode="&#xe043;"
d="M0 800h100v-800h-100v800zM600 800h200v-800h-200v800zM500 600v-400l-200 200z" />
<glyph glyph-name="44" unicode="&#xe044;"
d="M0 800h200v-800h-200v800zM700 800h100v-800h-100v800zM300 600l200 -200l-200 -200v400z" />
<glyph glyph-name="45" unicode="&#xe045;"
d="M0 800h800v-100h-800v100zM400 500l200 -200h-400zM0 200h800v-200h-800v200z" />
<glyph glyph-name="46" unicode="&#xe046;"
d="M150 700c83 0 150 -67 150 -150v-50h100v50c0 83 67 150 150 150s150 -67 150 -150s-67 -150 -150 -150h-50v-100h50c83 0 150 -67 150 -150s-67 -150 -150 -150s-150 67 -150 150v50h-100v-50c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150h50v100h-50
c-83 0 -150 67 -150 150s67 150 150 150zM150 600c-28 0 -50 -22 -50 -50s22 -50 50 -50h50v50c0 28 -22 50 -50 50zM550 600c-28 0 -50 -22 -50 -50v-50h50c28 0 50 22 50 50s-22 50 -50 50zM300 400v-100h100v100h-100zM150 200c-28 0 -50 -22 -50 -50s22 -50 50 -50
s50 22 50 50v50h-50zM500 200v-50c0 -28 22 -50 50 -50s50 22 50 50s-22 50 -50 50h-50z" />
<glyph glyph-name="47" unicode="&#xe047;"
d="M0 791c0 5 4 9 9 9h782c6 0 9 -4 9 -10v-790l-200 200h-591c-6 0 -9 3 -9 9v582z" />
<glyph glyph-name="48" unicode="&#xe048;"
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM600 600l-100 -300l-300 -100l100 300zM400 450c-28 0 -50 -22 -50 -50
s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
<glyph glyph-name="49" unicode="&#xe049;"
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700v-600c166 0 300 134 300 300s-134 300 -300 300z" />
<glyph glyph-name="4a" unicode="&#xe04a;"
d="M0 800h800v-100h-800v100zM0 600h500v-100h-500v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100zM750 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
<glyph glyph-name="4b" unicode="&#xe04b;"
d="M25 700h750c14 0 25 -11 25 -25v-75h-800v75c0 14 11 25 25 25zM0 500h800v-375c0 -14 -11 -25 -25 -25h-750c-14 0 -25 11 -25 25v375zM100 300v-100h100v100h-100zM300 300v-100h100v100h-100z" />
<glyph glyph-name="4c" unicode="&#xe04c;"
d="M100 800h100v-100h450l100 100l50 -50l-100 -100v-450h100v-100h-100v-100h-100v100h-500v500h-100v100h100v100zM200 600v-350l350 350h-350zM600 550l-350 -350h350v350z" />
<glyph glyph-name="4d" unicode="&#xe04d;"
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM400 600c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z
M200 452c0 20 15 42 34 48h3h3h8c12 0 28 -7 36 -16l91 -90l25 6c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100l6 25l-90 91c-9 8 -16 24 -16 36zM550 500c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
<glyph glyph-name="4e" unicode="&#xe04e;"
d="M300 800h200v-300h200l-300 -300l-300 300h200v300zM0 100h800v-100h-800v100z" />
<glyph glyph-name="4f" unicode="&#xe04f;"
d="M0 800h800v-100h-800v100zM400 600l300 -300h-200v-300h-200v300h-200z" />
<glyph glyph-name="50" unicode="&#xe050;"
d="M200 700h600v-600h-600l-200 300zM350 622l-72 -72l150 -150l-150 -150l72 -72l150 150l150 -150l72 72l-150 150l150 150l-72 72l-150 -150z" />
<glyph glyph-name="51" unicode="&#xe051;"
d="M400 700c220 0 400 -180 400 -400h-100c0 166 -134 300 -300 300s-300 -134 -300 -300h-100c0 220 180 400 400 400zM341 491l59 -88l59 88c81 -25 141 -101 141 -191c0 -110 -90 -200 -200 -200s-200 90 -200 200c0 90 60 166 141 191z" />
<glyph glyph-name="52" unicode="&#xe052;"
d="M0 800h300v-400h400v-400h-700v800zM400 800l300 -300h-300v300zM100 600v-100h100v100h-100zM100 400v-100h100v100h-100zM100 200v-100h400v100h-400z" />
<glyph glyph-name="53" unicode="&#xe053;" horiz-adv-x="600"
d="M200 700h100v-100h75c30 0 58 -6 81 -22s44 -44 44 -78v-100h-100v94c-4 3 -13 6 -25 6h-250c-14 0 -25 -11 -25 -25v-50c0 -15 20 -40 34 -44l257 -65c66 -16 109 -73 109 -141v-50c0 -68 -57 -125 -125 -125h-75v-100h-100v100h-75c-30 0 -58 6 -81 22s-44 44 -44 78
v100h100v-94c4 -3 13 -6 25 -6h250c14 0 25 11 25 25v50c0 15 -20 40 -34 44l-257 65c-66 16 -109 73 -109 141v50c0 68 57 125 125 125h75v100z" />
<glyph glyph-name="54" unicode="&#xe054;"
d="M0 700h300v-300l-300 -300v600zM500 700h300v-300l-300 -300v600z" />
<glyph glyph-name="55" unicode="&#xe055;"
d="M300 700v-600h-300v300zM800 700v-600h-300v300z" />
<glyph glyph-name="56" unicode="&#xe056;"
d="M300 700v-100c-111 0 -200 -89 -200 -200h200v-300h-300v300c0 165 135 300 300 300zM800 700v-100c-111 0 -200 -89 -200 -200h200v-300h-300v300c0 165 135 300 300 300z" />
<glyph glyph-name="57" unicode="&#xe057;"
d="M0 700h300v-300c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-200v300zM500 700h300v-300c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-200v300z" />
<glyph glyph-name="58" unicode="&#xe058;" horiz-adv-x="600"
d="M300 800l34 -34c11 -11 266 -270 266 -488c0 -165 -135 -300 -300 -300s-300 135 -300 300c0 218 255 477 266 488zM150 328c-28 0 -50 -22 -50 -50c0 -110 90 -200 200 -200c28 0 50 22 50 50s-22 50 -50 50c-55 0 -100 45 -100 100c0 28 -22 50 -50 50z" />
<glyph glyph-name="59" unicode="&#xe059;"
d="M400 800l400 -500h-800zM0 200h800v-200h-800v200z" />
<glyph glyph-name="5a" unicode="&#xe05a;" horiz-adv-x="600"
d="M300 800l300 -300h-600zM0 300h600l-300 -300z" />
<glyph glyph-name="5b" unicode="&#xe05b;"
d="M0 500h200v-200h-200v200zM300 500h200v-200h-200v200zM600 500h200v-200h-200v200z" />
<glyph glyph-name="5c" unicode="&#xe05c;"
d="M0 700h800v-100l-400 -200l-400 200v100zM0 500l400 -200l400 200v-400h-800v400z" />
<glyph glyph-name="5d" unicode="&#xe05d;"
d="M400 800l400 -200v-600h-800v600zM400 688l-300 -150v-188l300 -150l300 150v188zM200 500h400v-100l-200 -100l-200 100v100z" />
<glyph glyph-name="5e" unicode="&#xe05e;"
d="M600 700c69 0 134 -19 191 -50l-16 -106c-49 35 -109 56 -175 56c-131 0 -240 -84 -281 -200h331l-16 -100h-334c0 -36 8 -68 19 -100h297l-16 -100h-222c55 -61 133 -100 222 -100c78 0 147 30 200 78v-122c-59 -35 -127 -56 -200 -56c-147 0 -274 82 -344 200h-256
l19 100h197c-8 32 -16 66 -16 100h-200l25 100h191c45 172 198 300 384 300z" />
<glyph glyph-name="5f" unicode="&#xe05f;"
d="M0 700h700v-100h-700v100zM0 500h500v-100h-500v100zM0 300h800v-100h-800v100zM0 100h100v-100h-100v100zM200 100h100v-100h-100v100zM400 100h100v-100h-100v100z" />
<glyph glyph-name="60" unicode="&#xe060;"
d="M0 800h800v-100h-800v100zM200 600h400l-200 -200zM0 200h800v-200h-800v200z" />
<glyph glyph-name="61" unicode="&#xe061;"
d="M0 800h100v-800h-100v800zM600 800h200v-800h-200v800zM200 600l200 -200l-200 -200v400z" />
<glyph glyph-name="62" unicode="&#xe062;"
d="M0 800h200v-800h-200v800zM700 800h100v-800h-100v800zM600 600v-400l-200 200z" />
<glyph glyph-name="63" unicode="&#xe063;"
d="M0 800h800v-200h-800v200zM400 400l200 -200h-400zM0 100h800v-100h-800v100z" />
<glyph glyph-name="64" unicode="&#xe064;"
d="M0 800h200v-100h-100v-600h600v100h100v-200h-800v800zM400 800h400v-400l-150 150l-250 -250l-100 100l250 250z" />
<glyph glyph-name="65" unicode="&#xe065;"
d="M403 700c247 0 397 -300 397 -300s-150 -300 -397 -300c-253 0 -403 300 -403 300s150 300 403 300zM400 600c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200zM400 500c10 0 19 -3 28 -6c-16 -8 -28 -24 -28 -44c0 -28 22 -50 50 -50
c20 0 36 12 44 28c3 -9 6 -18 6 -28c0 -55 -45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
<glyph glyph-name="66" unicode="&#xe066;" horiz-adv-x="900"
d="M331 700h3h3c3 1 7 1 10 1c12 0 29 -8 37 -17l94 -93l66 65c57 57 155 57 212 0c58 -58 58 -154 0 -212l-65 -66l93 -94c10 -8 18 -25 18 -38c0 -28 -22 -50 -50 -50c-13 0 -32 9 -40 20l-62 65l-381 -381h-269v272l375 381l-63 63c-9 8 -16 24 -16 36c0 20 16 42 35 48z
M447 481l-313 -315l128 -132l316 316z" />
<glyph glyph-name="67" unicode="&#xe067;"
d="M0 800h300v-400h400v-400h-700v800zM400 800l300 -300h-300v300z" />
<glyph glyph-name="68" unicode="&#xe068;"
d="M200 800c0 0 200 -100 200 -300s-298 -302 -200 -500c0 0 -200 100 -200 300s300 300 200 500zM500 500c0 0 200 -100 200 -300c0 -150 -60 -200 -100 -200h-300c0 200 300 300 200 500z" />
<glyph glyph-name="69" unicode="&#xe069;"
d="M0 800h100v-800h-100v800zM200 800h300v-100h300l-200 -203l200 -197h-400v100h-200v400z" />
<glyph glyph-name="6a" unicode="&#xe06a;" horiz-adv-x="400"
d="M150 800h150l-100 -200h200l-150 -300h150l-300 -300l-100 300h134l66 200h-200z" />
<glyph glyph-name="6b" unicode="&#xe06b;"
d="M0 800h300v-100h500v-100h-800v200zM0 500h800v-450c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v450z" />
<glyph glyph-name="6c" unicode="&#xe06c;"
d="M150 800c83 0 150 -67 150 -150c0 -66 -41 -121 -100 -141v-118c15 5 33 9 50 9h200c28 0 50 22 50 50v59c-59 20 -100 75 -100 141c0 83 67 150 150 150s150 -67 150 -150c0 -66 -41 -121 -100 -141v-59c0 -82 -68 -150 -150 -150h-200c-14 0 -25 -7 -34 -16
c50 -24 84 -74 84 -134c0 -83 -67 -150 -150 -150s-150 67 -150 150c0 66 41 121 100 141v218c-59 20 -100 75 -100 141c0 83 67 150 150 150z" />
<glyph glyph-name="6d" unicode="&#xe06d;"
d="M0 800h400l-150 -150l150 -150l-100 -100l-150 150l-150 -150v400zM500 400l150 -150l150 150v-400h-400l150 150l-150 150z" />
<glyph glyph-name="6e" unicode="&#xe06e;"
d="M100 800l150 -150l150 150v-400h-400l150 150l-150 150zM400 400h400l-150 -150l150 -150l-100 -100l-150 150l-150 -150v400z" />
<glyph glyph-name="6f" unicode="&#xe06f;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700c-56 0 -108 -17 -153 -44l22 -19c33 -18 13 -48 -13 -59c-30 -13 -77 10 -65 -41c13 -55 -27 -3 -47 -15c-42 -26 49 -152 31 -156l-59 34c-8 0 -13 -5 -16 -10
c1 -30 10 -57 19 -84c28 -11 77 -2 100 -25c47 -28 97 -115 75 -159c34 -13 68 -22 106 -22c101 0 193 48 247 125c3 24 -8 44 -50 44c-69 0 -156 13 -153 97c2 46 101 108 66 143c-30 30 12 39 12 66c0 37 -65 32 -69 50s20 36 41 56c-30 10 -60 19 -94 19zM631 591
c-38 -11 -94 -35 -87 -53c6 -15 52 -1 65 -13c11 -10 16 -59 44 -31l22 22v3c-11 26 -26 50 -44 72z" />
<glyph glyph-name="70" unicode="&#xe070;"
d="M703 800l97 -100l-400 -400l-100 100l-200 -203l-100 100l300 303l100 -100zM0 100h800v-100h-800v100z" />
<glyph glyph-name="71" unicode="&#xe071;"
d="M0 700h100v-100h-100v100zM200 700h100v-100h-100v100zM400 700h100v-100h-100v100zM600 700h100v-100h-100v100zM0 500h100v-100h-100v100zM200 500h100v-100h-100v100zM400 500h100v-100h-100v100zM600 500h100v-100h-100v100zM0 300h100v-100h-100v100zM200 300h100
v-100h-100v100zM400 300h100v-100h-100v100zM600 300h100v-100h-100v100zM0 100h100v-100h-100v100zM200 100h100v-100h-100v100zM400 100h100v-100h-100v100zM600 100h100v-100h-100v100z" />
<glyph glyph-name="72" unicode="&#xe072;"
d="M0 800h200v-200h-200v200zM300 800h200v-200h-200v200zM600 800h200v-200h-200v200zM0 500h200v-200h-200v200zM300 500h200v-200h-200v200zM600 500h200v-200h-200v200zM0 200h200v-200h-200v200zM300 200h200v-200h-200v200zM600 200h200v-200h-200v200z" />
<glyph glyph-name="73" unicode="&#xe073;"
d="M0 800h300v-300h-300v300zM500 800h300v-300h-300v300zM0 300h300v-300h-300v300zM500 300h300v-300h-300v300z" />
<glyph glyph-name="74" unicode="&#xe074;"
d="M19 800h662c11 0 19 -8 19 -19v-331c0 -28 -22 -50 -50 -50h-600c-28 0 -50 22 -50 50v331c0 11 8 19 19 19zM0 309c16 -6 32 -9 50 -9h600c18 0 34 3 50 9v-290c0 -11 -8 -19 -19 -19h-662c-11 0 -19 8 -19 19v290zM550 200c-28 0 -50 -22 -50 -50s22 -50 50 -50
s50 22 50 50s-22 50 -50 50z" />
<glyph glyph-name="75" unicode="&#xe075;"
d="M0 700h300v-100h-50c-28 0 -50 -22 -50 -50v-150h300v150c0 28 -22 50 -50 50h-50v100h300v-100h-50c-28 0 -50 -22 -50 -50v-400c0 -28 22 -50 50 -50h50v-100h-300v100h50c28 0 50 22 50 50v150h-300v-150c0 -28 22 -50 50 -50h50v-100h-300v100h50c28 0 50 22 50 50
v400c0 28 -22 50 -50 50h-50v100z" />
<glyph glyph-name="76" unicode="&#xe076;"
d="M400 700c165 0 300 -135 300 -300v-100h50c28 0 50 -22 50 -50v-200c0 -28 -22 -50 -50 -50h-100c-28 0 -50 22 -50 50v350c0 111 -89 200 -200 200s-200 -89 -200 -200v-350c0 -28 -22 -50 -50 -50h-100c-28 0 -50 22 -50 50v200c0 28 22 50 50 50h50v100
c0 165 135 300 300 300z" />
<glyph glyph-name="77" unicode="&#xe077;"
d="M0 500c0 109 91 200 200 200s200 -91 200 -200c0 109 91 200 200 200s200 -91 200 -200c0 -55 -23 -105 -59 -141l-341 -340l-341 340c-36 36 -59 86 -59 141z" />
<glyph glyph-name="78" unicode="&#xe078;"
d="M400 700l400 -300l-100 3v-403h-200v200h-200v-200h-200v400h-100z" />
<glyph glyph-name="79" unicode="&#xe079;"
d="M0 800h800v-800h-800v800zM100 700v-300l100 100l400 -400h100v100l-200 200l100 100l100 -100v300h-600z" />
<glyph glyph-name="7a" unicode="&#xe07a;"
d="M19 800h762c11 0 19 -8 19 -19v-762c0 -11 -8 -19 -19 -19h-762c-11 0 -19 8 -19 19v762c0 11 8 19 19 19zM100 600v-300h100l100 -100h200l100 100h100v300h-600z" />
<glyph glyph-name="7b" unicode="&#xe07b;"
d="M200 600c80 0 142 -56 200 -122c58 66 119 122 200 122c131 0 200 -101 200 -200s-69 -200 -200 -200c-81 0 -142 56 -200 122c-58 -66 -121 -122 -200 -122c-131 0 -200 101 -200 200s69 200 200 200zM200 500c-74 0 -100 -54 -100 -100s26 -100 100 -100
c42 0 88 47 134 100c-46 53 -92 100 -134 100zM600 500c-43 0 -88 -47 -134 -100c46 -53 91 -100 134 -100c74 0 100 54 100 100s-26 100 -100 100z" />
<glyph glyph-name="7c" unicode="&#xe07c;" horiz-adv-x="400"
d="M300 800c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100zM150 550c83 0 150 -69 150 -150c0 -66 -100 -214 -100 -250c0 -28 22 -50 50 -50s50 22 50 50h100c0 -83 -67 -150 -150 -150s-150 64 -150 150s100 222 100 250s-22 50 -50 50
s-50 -22 -50 -50h-100c0 83 67 150 150 150z" />
<glyph glyph-name="7d" unicode="&#xe07d;"
d="M200 800h500v-100h-122c-77 -197 -156 -392 -234 -588l-6 -12h162v-100h-500v100h122c77 197 156 392 234 588l7 12h-163v100z" />
<glyph glyph-name="7e" unicode="&#xe07e;"
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM100 100h600v-100h-600v100z" />
<glyph glyph-name="7f" unicode="&#xe07f;"
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100z" />
<glyph glyph-name="80" unicode="&#xe080;"
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM200 100h600v-100h-600v100z" />
<glyph glyph-name="81" unicode="&#xe081;"
d="M550 800c138 0 250 -112 250 -250s-112 -250 -250 -250c-16 0 -32 0 -47 3l-3 -3v-100h-200v-200h-300v200l303 303c-3 15 -3 31 -3 47c0 138 112 250 250 250zM600 700c-55 0 -100 -45 -100 -100s45 -100 100 -100s100 45 100 100s-45 100 -100 100z" />
<glyph glyph-name="82" unicode="&#xe082;"
d="M134 600h3h4h4h5h500c28 0 50 -22 50 -50v-350h100v-150c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v150h100v350v2c0 20 15 42 34 48zM200 500v-300h100v-100h200v100h100v300h-400z" />
<glyph glyph-name="83" unicode="&#xe083;"
d="M0 800h400v-400h-400v400zM500 600h100v-400h-400v100h300v300zM700 400h100v-400h-400v100h300v300z" />
<glyph glyph-name="84" unicode="&#xe084;" horiz-adv-x="600"
d="M337 694c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-300 -150c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50c0 21 16 44 37 49zM437 544c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-400 -200c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50
c0 21 16 44 37 49zM437 344c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-106 -56c24 -4 43 -26 43 -50c0 -28 -23 -51 -51 -51c-2 0 -6 1 -8 1h-200c-26 1 -48 24 -48 50c0 16 12 36 26 44zM151 -50c0 23 20 50 46 50h3h4h5h100c28 0 50 -22 50 -50
s-22 -50 -50 -50h-100c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51z" />
<glyph glyph-name="85" unicode="&#xe085;"
d="M199 800h100v-200h-200v100h100v100zM586 797h1c18 1 38 1 56 -3c36 -8 69 -26 97 -54c78 -78 78 -203 0 -281l-150 -150c-8 -13 -28 -24 -43 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43l150 150c40 40 39 105 0 144c-41 41 -110 34 -144 0l-44 -44
c-8 -13 -27 -24 -42 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43l43 44c32 33 72 53 128 56zM208 490c4 5 14 16 22 16h3c2 0 6 1 8 1c28 0 50 -22 50 -50c0 -11 -6 -27 -14 -35l-150 -150c-40 -40 -39 -105 0 -144c41 -41 110 -34 144 0l44 44c8 13 27 24 42 24
c28 0 50 -22 50 -50c0 -15 -11 -35 -24 -43l-43 -44c-22 -22 -48 -37 -75 -47c-70 -25 -151 -9 -207 47c-78 78 -78 203 0 281zM499 200h200v-100h-100v-100h-100v200z" />
<glyph glyph-name="86" unicode="&#xe086;"
d="M586 797c18 1 39 1 57 -3c36 -8 69 -26 97 -54c78 -78 78 -203 0 -281l-150 -150c-62 -62 -132 -81 -182 -78s-69 17 -84 25s-26 27 -26 44c0 28 22 51 50 51c8 0 19 -3 26 -7c0 0 15 -11 41 -13s62 3 106 47l150 150c40 40 39 105 0 144c-41 41 -110 34 -144 0
c-8 -13 -28 -24 -43 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43c32 33 72 53 128 56zM386 566c50 -2 64 -17 85 -22s37 -28 37 -49c0 -28 -22 -50 -50 -50c-10 0 -23 5 -31 11c0 0 -19 9 -47 10s-63 -4 -103 -44l-150 -150c-40 -40 -39 -105 0 -144c41 -41 110 -34 144 0
c8 13 27 24 42 24c28 0 50 -22 50 -50c0 -15 -10 -35 -23 -43c-22 -22 -48 -37 -75 -47c-70 -25 -151 -9 -207 47c-78 78 -78 203 0 281l150 150c60 60 128 78 178 76z" />
<glyph glyph-name="87" unicode="&#xe087;"
d="M0 700h300v-300h-300v300zM400 700h400v-100h-400v100zM400 500h300v-100h-300v100zM0 300h300v-300h-300v300zM400 300h400v-100h-400v100zM400 100h300v-100h-300v100z" />
<glyph glyph-name="88" unicode="&#xe088;"
d="M50 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 700h600v-100h-600v100zM50 500c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 500h600v-100h-600v100zM50 300c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50
s22 50 50 50zM200 300h600v-100h-600v100zM50 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 100h600v-100h-600v100z" />
<glyph glyph-name="89" unicode="&#xe089;"
d="M800 800l-400 -800l-100 300l-300 100z" />
<glyph glyph-name="8a" unicode="&#xe08a;" horiz-adv-x="600"
d="M300 700c110 0 200 -90 200 -200v-100h100v-400h-600v400h100v100c0 110 90 200 200 200zM300 600c-56 0 -100 -44 -100 -100v-100h200v100c0 56 -44 100 -100 100z" />
<glyph glyph-name="8b" unicode="&#xe08b;" horiz-adv-x="600"
d="M300 800c110 0 200 -90 200 -200v-200h100v-400h-600v400h400v200c0 56 -44 100 -100 100s-100 -44 -100 -100h-100c0 110 90 200 200 200z" />
<glyph glyph-name="8c" unicode="&#xe08c;"
d="M400 700v-100c-111 0 -200 -89 -200 -200h100l-150 -200l-150 200h100c0 165 135 300 300 300zM650 600l150 -200h-100c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-100z" />
<glyph glyph-name="8d" unicode="&#xe08d;"
d="M100 800h600v-300h100l-150 -250l-150 250h100v200h-400v-100h-100v200zM150 550l150 -250h-100v-200h400v100h100v-200h-600v300h-100z" />
<glyph glyph-name="8e" unicode="&#xe08e;"
d="M600 700l200 -150l-200 -150v100h-500v-100h-100v100c0 55 45 100 100 100h500v100zM200 300v-100h500v100h100v-100c0 -55 -45 -100 -100 -100h-500v-100l-200 150z" />
<glyph glyph-name="8f" unicode="&#xe08f;" horiz-adv-x="900"
d="M350 800c193 0 350 -157 350 -350c0 -60 -17 -117 -44 -166c5 -3 12 -8 16 -12l100 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 100c-4 3 -9 9 -12 13c-49 -26 -107 -41 -166 -41c-193 0 -350 157 -350 350s157 350 350 350zM350 200
c142 0 250 108 250 250c0 139 -111 250 -250 250s-250 -111 -250 -250s111 -250 250 -250z" />
<glyph glyph-name="90" unicode="&#xe090;" horiz-adv-x="600"
d="M300 800c166 0 300 -134 300 -300c0 -200 -300 -500 -300 -500s-300 300 -300 500c0 166 134 300 300 300zM300 700c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200z" />
<glyph glyph-name="91" unicode="&#xe091;" horiz-adv-x="900"
d="M0 800h800v-541c1 -3 1 -8 1 -11s0 -7 -1 -10v-238h-800v800zM495 250c0 26 22 50 50 50h5h150v400h-600v-600h600v100h-150h-5c-28 0 -50 22 -50 50zM350 600c83 0 150 -67 150 -150c0 -100 -150 -250 -150 -250s-150 150 -150 250c0 83 67 150 150 150zM350 500
c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
<glyph glyph-name="92" unicode="&#xe092;" horiz-adv-x="600"
d="M0 700h200v-600h-200v600zM400 700h200v-600h-200v600z" />
<glyph glyph-name="93" unicode="&#xe093;" horiz-adv-x="600"
d="M0 700l600 -300l-600 -300v600z" />
<glyph glyph-name="94" unicode="&#xe094;" horiz-adv-x="600"
d="M300 700c166 0 300 -134 300 -300s-134 -300 -300 -300s-300 134 -300 300s134 300 300 300z" />
<glyph glyph-name="95" unicode="&#xe095;"
d="M400 700v-600l-400 300zM400 400l400 300v-600z" />
<glyph glyph-name="96" unicode="&#xe096;"
d="M0 700l400 -300l-400 -300v600zM400 100v600l400 -300z" />
<glyph glyph-name="97" unicode="&#xe097;"
d="M0 700h200v-600h-200v600zM200 400l500 300v-600z" />
<glyph glyph-name="98" unicode="&#xe098;"
d="M0 700l500 -300l-500 -300v600zM500 100v600h200v-600h-200z" />
<glyph glyph-name="99" unicode="&#xe099;" horiz-adv-x="600"
d="M0 700h600v-600h-600v600z" />
<glyph glyph-name="9a" unicode="&#xe09a;"
d="M200 800h400v-200h200v-400h-200v-200h-400v200h-200v400h200v200z" />
<glyph glyph-name="9b" unicode="&#xe09b;"
d="M0 700h800v-100h-800v100zM0 403h800v-100h-800v100zM0 103h800v-100h-800v100z" />
<glyph glyph-name="9c" unicode="&#xe09c;" horiz-adv-x="600"
d="M278 700c7 2 13 4 22 4c55 0 100 -45 100 -100v-4v-200c0 -55 -45 -100 -100 -100s-100 45 -100 100v200v2c0 44 35 88 78 98zM34 500h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-50c0 -111 89 -200 200 -200s200 89 200 200v50c0 28 22 50 50 50s50 -22 50 -50v-50
c0 -148 -109 -270 -250 -294v-106h50c55 0 100 -45 100 -100h-400c0 55 45 100 100 100h50v106c-141 24 -250 146 -250 294v50v2c0 20 15 42 34 48z" />
<glyph glyph-name="9d" unicode="&#xe09d;"
d="M0 500h800v-200h-800v200z" />
<glyph glyph-name="9e" unicode="&#xe09e;"
d="M34 700h4h3h4h5h700c28 0 50 -22 50 -50v-500c0 -28 -22 -50 -50 -50h-250v-100h100c55 0 100 -45 100 -100h-600c0 55 45 100 100 100h100v100h-250c-28 0 -50 22 -50 50v500v2c0 20 15 42 34 48zM100 600v-400h600v400h-600z" />
<glyph glyph-name="9f" unicode="&#xe09f;"
d="M272 700c-14 -40 -22 -83 -22 -128c0 -221 179 -400 400 -400c45 0 88 8 128 22c-53 -158 -202 -272 -378 -272c-221 0 -400 179 -400 400c0 176 114 325 272 378z" />
<glyph glyph-name="a0" unicode="&#xe0a0;"
d="M350 700l150 -150h-100v-150h150v100l150 -150l-150 -150v100h-150v-150h100l-150 -150l-150 150h100v150h-150v-100l-150 150l150 150v-100h150v150h-100z" />
<glyph glyph-name="a1" unicode="&#xe0a1;"
d="M800 800v-550c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150c17 0 35 -4 50 -9v206c-201 -6 -327 -27 -400 -50v-397c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150c17 0 35 -4 50 -9v409s100 100 600 100z" />
<glyph glyph-name="a2" unicode="&#xe0a2;" horiz-adv-x="700"
d="M499 700c51 0 102 -20 141 -59c78 -78 78 -203 0 -281l-250 -244c-48 -48 -127 -48 -175 0s-48 127 0 175l96 97l69 -69l-90 -94l-7 -3c-10 -10 -10 -28 0 -38s28 -10 38 0l250 247c37 40 39 102 0 141s-104 40 -144 0l-278 -275c-66 -69 -68 -179 0 -247
c69 -69 181 -69 250 0l9 12l116 113l69 -69l-125 -125c-107 -107 -281 -107 -388 0s-107 281 0 388l278 272c39 39 90 59 141 59z" />
<glyph glyph-name="a3" unicode="&#xe0a3;"
d="M600 800l200 -200l-100 -100l-200 200zM400 600l200 -200l-400 -400h-200v200z" />
<glyph glyph-name="a4" unicode="&#xe0a4;"
d="M550 800c83 0 150 -90 150 -200s-67 -200 -150 -200c-22 0 -40 8 -59 19c6 26 9 52 9 81c0 84 -27 158 -72 212c27 52 71 88 122 88zM250 700c83 0 150 -90 150 -200s-67 -200 -150 -200s-150 90 -150 200s67 200 150 200zM725 384c44 -22 75 -66 75 -118v-166h-200v66
c0 50 -17 96 -44 134c66 2 126 33 169 84zM75 284c45 -53 106 -84 175 -84s130 31 175 84c44 -22 75 -66 75 -118v-166h-500v166c0 52 31 96 75 118z" />
<glyph glyph-name="a5" unicode="&#xe0a5;"
d="M400 800c110 0 200 -112 200 -250s-90 -250 -200 -250s-200 112 -200 250s90 250 200 250zM191 300c54 -61 128 -100 209 -100s155 39 209 100c106 -5 191 -92 191 -200v-100h-800v100c0 108 85 195 191 200z" />
<glyph glyph-name="a6" unicode="&#xe0a6;" horiz-adv-x="600"
d="M19 800h462c11 0 19 -8 19 -19v-762c0 -11 -8 -19 -19 -19h-462c-11 0 -19 8 -19 19v762c0 11 8 19 19 19zM100 700v-500h300v500h-300zM250 150c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
<glyph glyph-name="a7" unicode="&#xe0a7;"
d="M350 800c17 0 34 -1 50 -3v-397l-297 297c63 64 150 103 247 103zM500 694c169 -25 300 -168 300 -344c0 -193 -157 -350 -350 -350c-85 0 -161 31 -222 81l272 272v341zM91 562l237 -234l-212 -212c-70 55 -116 138 -116 234c0 84 35 158 91 212z" />
<glyph glyph-name="a8" unicode="&#xe0a8;"
d="M92 650c0 23 20 50 46 50h3h4h5h400c28 0 50 -22 50 -50s-22 -50 -50 -50h-50v-200h100c55 0 100 -45 100 -100h-300v-300l-56 -100l-44 100v300h-300c0 55 45 100 100 100h100v200h-50c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51z" />
<glyph glyph-name="a9" unicode="&#xe0a9;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM300 600v-400l300 200z" />
<glyph glyph-name="aa" unicode="&#xe0aa;"
d="M300 800h200v-300h300v-200h-300v-300h-200v300h-300v200h300v300z" />
<glyph glyph-name="ab" unicode="&#xe0ab;"
d="M300 800h100v-400h-100v400zM172 656l62 -78l-40 -31c-58 -46 -94 -117 -94 -197c0 -139 111 -250 250 -250s250 111 250 250c0 80 -39 151 -97 197l-37 31l62 78l38 -31c82 -64 134 -164 134 -275c0 -193 -157 -350 -350 -350s-350 157 -350 350c0 111 53 211 134 275z
" />
<glyph glyph-name="ac" unicode="&#xe0ac;"
d="M200 800h400v-200h-400v200zM9 500h782c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-91v200h-600v-200h-91c-6 0 -9 3 -9 9v282c0 6 3 9 9 9zM200 300h400v-300h-400v300z" />
<glyph glyph-name="ad" unicode="&#xe0ad;"
d="M0 700h100v-700h-100v700zM700 700h100v-700h-100v700zM200 600h200v-100h-200v100zM300 400h200v-100h-200v100zM400 200h200v-100h-200v100z" />
<glyph glyph-name="ae" unicode="&#xe0ae;"
d="M325 700c42 -141 87 -280 131 -419c29 74 59 148 88 222c30 -57 58 -114 87 -172h169v-100h-231l-13 28c-37 -92 -74 -184 -112 -275c-38 129 -79 257 -119 385c-42 -133 -83 -267 -125 -400c-28 88 -56 175 -84 262h-116v100h188l9 -34l3 -6c42 137 83 273 125 409z" />
<glyph glyph-name="af" unicode="&#xe0af;"
d="M200 600c0 57 43 100 100 100s100 -43 100 -100c0 -28 -18 -48 -28 -72c-3 -6 -3 -16 -3 -28h231v-231c12 0 22 0 28 3c24 10 44 28 72 28c57 0 100 -43 100 -100s-43 -100 -100 -100c-28 0 -48 18 -72 28c-6 3 -16 3 -28 3v-231h-231c0 12 0 22 3 28c10 24 28 44 28 72
c0 57 -43 100 -100 100s-100 -43 -100 -100c0 -28 18 -48 28 -72c3 -6 3 -16 3 -28h-231v600h231c0 12 0 22 -3 28c-10 24 -28 44 -28 72z" />
<glyph glyph-name="b0" unicode="&#xe0b0;" horiz-adv-x="500"
d="M247 700c84 0 148 -20 191 -59s59 -93 59 -141c0 -117 -69 -181 -119 -225s-81 -67 -81 -150v-25h-100v25c0 117 65 181 115 225s85 67 85 150c0 25 -8 48 -28 66s-56 34 -122 34s-97 -18 -116 -37s-27 -43 -31 -69l-100 12c5 38 19 88 59 128s103 66 188 66zM197 0h100
v-100h-100v100z" />
<glyph glyph-name="b1" unicode="&#xe0b1;"
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -69 -48 -127 -112 -144c-22 55 -75 94 -138 94c-20 0 -39 -5 -56 -12c-17 64 -75 112 -144 112s-127 -48 -144 -112c-17 7 -36 12 -56 12c-37 0 -71 -12 -97 -34c-33 36 -53 82 -53 134
c0 110 90 200 200 200c23 114 129 200 250 200zM334 300h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-200c0 -28 -22 -50 -50 -50s-50 22 -50 50v200v2c0 20 15 42 34 48zM134 200h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-100c0 -28 -22 -50 -50 -50s-50 22 -50 50v100v2
c0 20 15 42 34 48zM534 200h3h4c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-100c0 -28 -22 -50 -50 -50s-50 22 -50 50v100v2c0 20 15 42 34 48z" />
<glyph glyph-name="b2" unicode="&#xe0b2;"
d="M600 800l200 -150l-200 -150v100h-50l-153 -191l175 -206l6 -3h22v100l200 -150l-200 -150v100h-25c-35 0 -56 12 -78 38l-166 190l-153 -190c-22 -27 -43 -38 -78 -38h-100v100h100l166 206l-163 191l-3 3h-100v100h100c34 0 56 -12 78 -38l153 -178l141 178
c22 27 43 38 78 38h50v100z" />
<glyph glyph-name="b3" unicode="&#xe0b3;"
d="M400 800c110 0 209 -47 281 -119l119 119v-300h-300l109 109c-54 55 -126 91 -209 91c-166 0 -300 -134 -300 -300s134 -300 300 -300c83 0 158 34 212 88l72 -72c-72 -72 -174 -116 -284 -116c-220 0 -400 180 -400 400s180 400 400 400z" />
<glyph glyph-name="b4" unicode="&#xe0b4;"
d="M400 800h400v-400l-166 166l-400 -400l166 -166h-400v400l166 -166l400 400z" />
<glyph glyph-name="b5" unicode="&#xe0b5;" horiz-adv-x="600"
d="M250 800l250 -300h-200v-200h200l-250 -300l-250 300h200v200h-200z" />
<glyph glyph-name="b6" unicode="&#xe0b6;"
d="M300 600v-200h200v200l300 -250l-300 -250v200h-200v-200l-300 250z" />
<glyph glyph-name="b7" unicode="&#xe0b7;"
d="M0 800c441 0 800 -359 800 -800h-200c0 333 -267 600 -600 600v200zM0 500c275 0 500 -225 500 -500h-200c0 167 -133 300 -300 300v200zM0 200c110 0 200 -90 200 -200h-200v200z" />
<glyph glyph-name="b8" unicode="&#xe0b8;"
d="M100 800c386 0 700 -314 700 -700h-100c0 332 -268 600 -600 600v100zM100 600c276 0 500 -224 500 -500h-100c0 222 -178 400 -400 400v100zM100 400c165 0 300 -135 300 -300h-100c0 111 -89 200 -200 200v100zM100 200c55 0 100 -45 100 -100s-45 -100 -100 -100
s-100 45 -100 100s45 100 100 100z" />
<glyph glyph-name="b9" unicode="&#xe0b9;"
d="M300 800h400c55 0 100 -45 100 -100v-200h-400v150c0 28 -22 50 -50 50s-50 -22 -50 -50v-250h400v-300c0 -55 -45 -100 -100 -100h-500c-55 0 -100 45 -100 100v200h100v-150c0 -28 22 -50 50 -50s50 22 50 50v550c0 55 45 100 100 100z" />
<glyph glyph-name="ba" unicode="&#xe0ba;"
d="M75 700h225v-100h-200v-500h400v100h100v-125c0 -41 -34 -75 -75 -75h-450c-41 0 -75 34 -75 75v550c0 41 34 75 75 75zM600 700l200 -200l-200 -200v100h-200c-94 0 -173 -65 -194 -153c23 199 189 353 394 353v100z" />
<glyph glyph-name="bb" unicode="&#xe0bb;"
d="M500 700l300 -284l-300 -316v200h-100c-200 0 -348 -102 -400 -300c0 295 100 500 500 500v200z" />
<glyph glyph-name="bc" unicode="&#xe0bc;"
d="M381 791l19 9l19 -9c127 -53 253 -108 381 -160v-31c0 -166 -67 -313 -147 -419c-40 -53 -83 -97 -125 -128s-82 -53 -128 -53s-86 22 -128 53s-85 75 -125 128c-80 107 -147 253 -147 419v31c128 52 254 107 381 160zM400 100v591l-294 -122c8 -126 58 -243 122 -328
c35 -46 73 -86 106 -110s62 -31 66 -31z" />
<glyph glyph-name="bd" unicode="&#xe0bd;"
d="M600 800h100v-800h-100v800zM400 700h100v-700h-100v700zM200 500h100v-500h-100v500zM0 300h100v-300h-100v300z" />
<glyph glyph-name="be" unicode="&#xe0be;"
d="M300 800h100v-200h200l100 -100l-100 -100h-200v-400h-100v500h-200l-100 100l100 100h200v100z" />
<glyph glyph-name="bf" unicode="&#xe0bf;"
d="M200 800h100v-600h200l-250 -200l-250 200h200v600zM400 800h200v-100h-200v100zM400 600h300v-100h-300v100zM400 400h400v-100h-400v100z" />
<glyph glyph-name="c0" unicode="&#xe0c0;"
d="M200 800h100v-600h200l-250 -200l-250 200h200v600zM400 800h400v-100h-400v100zM400 600h300v-100h-300v100zM400 400h200v-100h-200v100z" />
<glyph glyph-name="c1" unicode="&#xe0c1;"
d="M75 700h650c41 0 75 -34 75 -75v-550c0 -41 -34 -75 -75 -75h-650c-41 0 -75 34 -75 75v550c0 41 34 75 75 75zM100 600v-100h100v100h-100zM300 600v-100h400v100h-400zM100 400v-100h100v100h-100zM300 400v-100h400v100h-400zM100 200v-100h100v100h-100zM300 200
v-100h400v100h-400z" />
<glyph glyph-name="c2" unicode="&#xe0c2;"
d="M400 800l100 -300h300l-250 -200l100 -300l-250 200l-250 -200l100 300l-250 200h300z" />
<glyph glyph-name="c3" unicode="&#xe0c3;"
d="M400 800c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM150 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM650 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM400 600c110 0 200 -90 200 -200
s-90 -200 -200 -200s-200 90 -200 200s90 200 200 200zM50 450c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM750 450c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM150 200c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50
s22 50 50 50zM650 200c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM400 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
<glyph glyph-name="c4" unicode="&#xe0c4;"
d="M34 800h632c18 0 34 -16 34 -34v-732c0 -18 -16 -34 -34 -34h-632c-18 0 -34 16 -34 34v732c0 18 16 34 34 34zM100 700v-500h500v500h-500zM350 150c-38 0 -63 -42 -44 -75s69 -33 88 0s-6 75 -44 75z" />
<glyph glyph-name="c5" unicode="&#xe0c5;"
d="M0 800h300l500 -500l-300 -300l-500 500v300zM200 700c-55 0 -100 -45 -100 -100s45 -100 100 -100s100 45 100 100s-45 100 -100 100z" />
<glyph glyph-name="c6" unicode="&#xe0c6;"
d="M0 600h200l300 -300l-200 -200l-300 300v200zM340 600h160l300 -300l-200 -200l-78 78l119 122zM150 500c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
<glyph glyph-name="c7" unicode="&#xe0c7;"
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM400 600c110 0 200 -90 200 -200s-90 -200 -200 -200s-200 90 -200 200
s90 200 200 200zM400 500c-56 0 -100 -44 -100 -100s44 -100 100 -100s100 44 100 100s-44 100 -100 100z" />
<glyph glyph-name="c8" unicode="&#xe0c8;"
d="M0 700h559l-100 -100h-359v-500h500v159l100 100v-359h-700v700zM700 700l100 -100l-400 -400l-200 200l100 100l100 -100z" />
<glyph glyph-name="c9" unicode="&#xe0c9;"
d="M9 800h782c6 0 9 -3 9 -9v-782c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v782c0 6 3 9 9 9zM150 722l-72 -72l100 -100l-100 -100l72 -72l172 172zM400 500v-100h300v100h-300z" />
<glyph glyph-name="ca" unicode="&#xe0ca;"
d="M0 800h800v-200h-50c0 55 -45 100 -100 100h-150v-550c0 -28 22 -50 50 -50h50v-100h-400v100h50c28 0 50 22 50 50v550h-150c-55 0 -100 -45 -100 -100h-50v200z" />
<glyph glyph-name="cb" unicode="&#xe0cb;"
d="M0 700h100v-400h-100v400zM200 700h350c21 0 39 -13 47 -31c0 0 103 -291 103 -319s-22 -50 -50 -50h-150c-28 0 -50 -25 -50 -50s39 -158 47 -184s-5 -55 -31 -63s-52 5 -66 31s-109 219 -128 238s-44 28 -72 28v400z" />
<glyph glyph-name="cc" unicode="&#xe0cc;"
d="M400 666c10 19 28 32 47 34l19 -3c26 -8 39 -37 31 -63s-47 -159 -47 -184s22 -50 50 -50h150c28 0 50 -22 50 -50s-103 -319 -103 -319c-8 -18 -26 -31 -47 -31h-350v400c28 0 53 9 72 28s114 212 128 238zM0 400h100v-400h-100v400z" />
<glyph glyph-name="cd" unicode="&#xe0cd;"
d="M200 700h300v-100h-100v-6c25 -4 50 -8 72 -16l-34 -94c-28 11 -58 16 -88 16c-139 0 -250 -111 -250 -250s111 -250 250 -250s250 111 250 250c0 31 -5 60 -16 88l91 37c14 -38 25 -81 25 -125c0 -193 -157 -350 -350 -350s-350 157 -350 350c0 176 130 323 300 347v3
h-100v100zM700 584c0 0 -296 -348 -316 -368s-48 -20 -68 0s-20 48 0 68s384 300 384 300z" />
<glyph glyph-name="ce" unicode="&#xe0ce;"
d="M600 700l200 -150l-200 -150v100h-600v100h600v100zM200 300v-100h600v-100h-600v-100l-200 150z" />
<glyph glyph-name="cf" unicode="&#xe0cf;"
d="M300 800h100c55 0 100 -45 100 -100h100c55 0 100 -45 100 -100h-700c0 55 45 100 100 100h100c0 55 45 100 100 100zM100 500h100v-350c0 -28 22 -50 50 -50s50 22 50 50v350h100v-350c0 -28 22 -50 50 -50s50 22 50 50v350h100v-481c0 -11 -8 -19 -19 -19h-462
c-11 0 -19 8 -19 19v481z" />
<glyph glyph-name="d0" unicode="&#xe0d0;"
d="M100 800h200v-400c0 -55 45 -100 100 -100s100 45 100 100v400h100v-400c0 -110 -90 -200 -200 -200h-50c-138 0 -250 90 -250 200v400zM0 100h700v-100h-700v100z" />
<glyph glyph-name="d1" unicode="&#xe0d1;"
d="M9 700h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM609 700h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM309 500h182c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v282
c0 6 3 9 9 9zM0 100h800v-100h-800v100z" />
<glyph glyph-name="d2" unicode="&#xe0d2;"
d="M10 700h181c6 0 9 -3 9 -9v-191h-200v191c0 6 4 9 10 9zM610 700h181c6 0 9 -3 9 -9v-191h-200v191c0 6 5 9 10 9zM310 600h181c6 0 9 -3 9 -9v-91h-200v91c0 6 4 9 10 9zM0 400h800v-100h-800v100zM0 200h200v-191c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v191zM300 200
h200v-91c0 -6 -3 -9 -9 -9h-181c-6 0 -10 3 -10 9v91zM600 200h200v-191c0 -6 -3 -9 -9 -9h-181c-6 0 -10 3 -10 9v191z" />
<glyph glyph-name="d3" unicode="&#xe0d3;"
d="M0 700h800v-100h-800v100zM9 500h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM309 500h182c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v282c0 6 3 9 9 9zM609 500h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182
c-6 0 -9 3 -9 9v482c0 6 3 9 9 9z" />
<glyph glyph-name="d4" unicode="&#xe0d4;"
d="M50 600h500c28 0 50 -22 50 -50v-150l100 100h100v-300h-100l-100 100v-150c0 -28 -22 -50 -50 -50h-500c-28 0 -50 22 -50 50v400c0 28 22 50 50 50z" />
<glyph glyph-name="d5" unicode="&#xe0d5;"
d="M334 800h66v-800h-66l-134 200h-200v400h200zM500 600v100c26 0 52 -4 75 -10c130 -33 225 -150 225 -290s-95 -258 -225 -291h-3c-23 -6 -47 -9 -72 -9v100c17 0 34 2 50 6c86 22 150 100 150 194s-64 172 -150 194c-16 4 -33 6 -50 6zM500 500l25 -3
c44 -11 75 -51 75 -97s-32 -86 -75 -97l-25 -3v200z" />
<glyph glyph-name="d6" unicode="&#xe0d6;" horiz-adv-x="600"
d="M334 800h66v-800h-66l-134 200h-200v400h200zM500 500l25 -3c44 -11 75 -51 75 -97s-32 -86 -75 -97l-25 -3v200z" />
<glyph glyph-name="d7" unicode="&#xe0d7;" horiz-adv-x="400"
d="M334 800h66v-800h-66l-134 200h-200v400h200z" />
<glyph glyph-name="d8" unicode="&#xe0d8;"
d="M309 800h82c6 0 10 -4 12 -9l294 -682l3 -19v-81c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v81l3 19l294 682c2 5 6 9 12 9zM300 500v-200h100v200h-100zM300 200v-100h100v100h-100z" />
<glyph glyph-name="d9" unicode="&#xe0d9;"
d="M375 800c138 0 269 -39 378 -109l-53 -82c-93 60 -205 91 -325 91c-119 0 -229 -32 -322 -91l-53 82c109 70 237 109 375 109zM375 500c78 0 154 -23 216 -62l-53 -85c-46 30 -104 47 -163 47c-60 0 -112 -17 -159 -47l-54 85c62 40 134 62 213 62zM375 200
c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
<glyph glyph-name="da" unicode="&#xe0da;" horiz-adv-x="900"
d="M551 800c16 0 32 0 47 -3l-97 -97v-200h200l97 97c3 -15 3 -31 3 -47c0 -138 -112 -250 -250 -250c-32 0 -62 8 -90 19l-288 -291c-20 -20 -46 -28 -72 -28s-52 8 -72 28c-39 39 -39 105 0 144l291 287c-11 28 -19 59 -19 91c0 138 112 250 250 250zM101 150
c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
<glyph glyph-name="db" unicode="&#xe0db;"
d="M141 700c84 -84 169 -167 253 -250c82 83 167 165 247 250l143 -141l-253 -253c84 -82 167 -166 253 -247l-143 -143c-81 86 -165 169 -247 253l-253 -253l-141 143c85 80 167 164 250 247c-83 84 -166 169 -250 253z" />
<glyph glyph-name="dc" unicode="&#xe0dc;"
d="M0 800h100l231 -300h38l231 300h100l-225 -300h225v-100h-300v-100h300v-100h-300v-200h-100v200h-300v100h300v100h-300v100h225z" />
<glyph glyph-name="dd" unicode="&#xe0dd;" horiz-adv-x="900"
d="M350 800c193 0 350 -157 350 -350c0 -61 -17 -119 -44 -169c4 -2 10 -6 13 -9l103 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 103c-3 3 -7 9 -9 13c-50 -28 -108 -44 -169 -44c-193 0 -350 157 -350 350s157 350 350 350zM350 700
c-139 0 -250 -111 -250 -250s111 -250 250 -250c62 0 119 23 163 60c7 11 19 25 31 31l3 3c34 43 53 97 53 156c0 139 -111 250 -250 250zM300 600h100v-100h100v-100h-100v-100h-100v100h-100v100h100v100z" />
<glyph glyph-name="de" unicode="&#xe0de;" horiz-adv-x="900"
d="M350 800c193 0 350 -157 350 -350c0 -61 -17 -119 -44 -169c4 -2 10 -6 13 -9l103 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 103c-3 3 -7 9 -9 13c-50 -28 -108 -44 -169 -44c-193 0 -350 157 -350 350s157 350 350 350zM350 700
c-139 0 -250 -111 -250 -250s111 -250 250 -250c62 0 119 23 163 60c7 11 19 25 31 31l3 3c34 43 53 97 53 156c0 139 -111 250 -250 250zM200 500h300v-100h-300v100z" />
</font>
</defs></svg>

After

Width:  |  Height:  |  Size: 54 KiB

BIN
fonts/open-iconic.ttf Normal file

Binary file not shown.

BIN
fonts/open-iconic.woff Normal file

Binary file not shown.

View file

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Before After
Before After

View file

@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Airsonic</title> <title>Airsonic</title>
<link rel="stylesheet" href="./app/app.css"> <link rel="stylesheet" href="./app/style.css">
<link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="./favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="./favicon-16x16.png">

View file

@ -1,53 +0,0 @@
const { execSync } = require('child_process')
module.exports = function (config) {
let browsers = null;
if (process.env.TRAVIS || process.env.CI) {
// custom config for continuous integration
browsers = ['ChromeHeadlessCI']
} else {
try {
// if Firefox is installed, use that as the test runner
execSync('which firefox')
browsers = ['FirefoxHeadless']
} catch (_) {
browsers = ['ChromeHeadless']
}
}
const configuration = {
browsers: browsers,
// The tests are sometimes run before the tests were completely written
// to disc; this is a known problem unfortunately. This is a hack to at
// least keep the browsers connected so the tests are compiled and run
// again even if a developer isn't aware of this
autoWatchBatchDelay: 100,
browserNoActivityTimeout: 60 * 1000 * 10,
// The directory where the output file lives
basePath: 'public/test',
// The file itself
files: ['ci.js'],
frameworks: ['cljs-test'],
plugins: [
'karma-cljs-test',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-notify-reporter' // reporters are set in package.json
],
colors: true,
logLevel: config.LOG_INFO,
client: {
args: ["shadow.test.karma.init"]
},
// configure travis-ci; based on this: https://stackoverflow.com/questions/19255976/how-to-make-travis-execute-angular-tests-on-chrome-please-set-env-variable-chr#25661593
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', '--headless', '--nogpu']
}
}
}
config.set(configuration)
}

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before After
Before After

7582
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,54 +0,0 @@
{
"name": "airsonic-ui",
"version": "0.0.1",
"description": "Airsonic UI written with re-frame",
"main": "index.js",
"scripts": {
"build:cljs": "shadow-cljs release app",
"build-extra:cljs-report": "shadow-cljs run shadow.cljs.build-report app public/build-report.html",
"build:sass": "sass --style compressed src/sass/app.sass | postcss -o public/app/app.css",
"build": "mkdir -p public; rm -r public/*; run-p copy:* build:*",
"copy:assets": "cp -R src/assets/* public/",
"copy:icons": "cp -R node_modules/open-iconic/font/fonts public",
"deploy": "gh-pages -d public -m \"[skip ci] Deploying $(git rev-parse --short HEAD)\"",
"dev:cljs": "shadow-cljs watch app test",
"dev:sass": "echo src/sass/app.sass | entr npm run build:sass",
"dev:test": "karma start --reporters notify,progress --auto-watch",
"dev": "rm -r public/*; npm-run-all build:sass copy:* test:compile -p dev:*",
"test": "run-s test:compile test:run",
"test:compile": "shadow-cljs compile test",
"test:run": "karma start --single-run"
},
"author": "Arne Schlüter",
"license": "ISC",
"repository": {
"type": "git",
"url": "git://github.com/heyarne/airsonic-ui.git"
},
"dependencies": {
"@hugojosefson/color-hash": "^2.0.3",
"autoprefixer": "^9.5.0",
"bulma": "^0.8.0",
"create-react-class": "^15.6.3",
"highlight.js": "10.4.1",
"open-iconic": "^1.1.1",
"postcss-cli": "^7.0.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-sortable-hoc": "^1.8.3"
},
"devDependencies": {
"gh-pages": "^3.0.0",
"karma": "^5.0.0",
"karma-chrome-launcher": "^3.0.0",
"karma-cljs-test": "^0.1.0",
"karma-firefox-launcher": "^1.2.0",
"karma-notify-reporter": "^1.1.0",
"sass": "^1.86.3",
"npm-run-all": "^4.1.5",
"react-flip-move": "^3.0.3",
"react-highlight.js": "^1.0.7",
"sass": "^1.17.3",
"shadow-cljs": "^2.9.10"
}
}

View file

@ -1,5 +0,0 @@
module.exports = {
plugins: [
require('autoprefixer')
]
}

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before After
Before After

View file

@ -1,32 +0,0 @@
;; shadow-cljs configuration
{:source-paths
["src/cljs", "test/cljs"]
:dependencies
[[reagent "1.1.0"]
[re-frame "1.4.3"]
[re-pressed "0.3.1"]
[day8.re-frame/http-fx "v0.2.0"]
[akiroz.re-frame/storage "0.1.4"]
[funcool/bide "1.6.0"]
[fipp "0.6.22"]
;; debugging
[day8.re-frame/re-frame-10x "1.10.0"]
#_[day8.re-frame/tracing "0.5.1"]
[philoskim/debux "0.5.6"]]
:nrepl {:port 9000}
:builds
{:app {:target :browser
:output-dir "public/app/js"
:asset-path "/app/js"
:modules {:main {:entries [airsonic-ui.core]}}
:devtools {:http-root "public"
:http-port 8080
:after-load airsonic-ui.core/mount-root
:preloads [day8.re-frame-10x.preload]}
:dev {:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true}}}
:test {:target :karma
:output-to "public/test/ci.js"
:ns-regexp "-test$"}}}

View file

@ -1,45 +0,0 @@
(ns airsonic-ui.api.events
"This namespace contains all events relevant to API interaction. It contains
an event handler which issues requests as well as the appropriate handlers,
which dispatch :notification events in case of errors."
(:require [re-frame.core :refer [reg-event-fx]]
[ajax.core :as ajax]
[airsonic-ui.api.helpers :as api]))
(defn- cache-path [endpoint params] [:api/responses [endpoint params]])
(defn api-request
"Event handler to issue API request; takes care of authorization based on our
current app state."
[{:keys [db]} [_ endpoint params]]
{:http-xhrio {:method :get
:uri (api/url (:credentials db) endpoint params)
:response-format (ajax/json-response-format {:keywords? true})
:on-success [:api.response/ok endpoint params]
:on-failure [:api.response/failed endpoint params]}
:db (assoc-in db (conj (cache-path endpoint params) :api/is-loading?) true)})
(reg-event-fx :api/request api-request)
(defn api-success
"Handles when the server responded. There could still be an error while
processing the request on the server side which we have to account for."
[{:keys [db]} [_ endpoint params response]]
(let [response-cache (cache-path endpoint params)]
(try
{:db (assoc-in db response-cache (api/unwrap-response response))}
(catch ExceptionInfo e
{:dispatch [:notification/show :error (api/error-msg e)]
:db (update-in db response-cache dissoc :api/is-loading?)}))))
(reg-event-fx :api.response/ok api-success)
(defn api-failure
"Handler for catastrophic failures (network errors and such things)"
[fx [ev endpoint params]]
(let [response-cache (cons :db (cache-path endpoint params))]
{:log ["API call gone bad; are CORS headers missing? check for :status 0" ev] ; <- the :log effect is registered in ../events.cljs
:dispatch [:notification/show :error "Communication with server failed. Check browser logs for details."]
:db (update-in fx response-cache dissoc :api/is-loading?)}))
(reg-event-fx :api.response/failed api-failure)

View file

@ -1,78 +0,0 @@
(ns airsonic-ui.api.helpers
(:require [clojure.string :as str]
[clojure.set :as set]))
(def default-params {:f "json"
:c "airsonic-ui-cljs"
:v "1.15.0"})
(defn- unroll-variadic-params
"Turns {:id [1 2 3], :foo :bar} into [[:id 1] [:id 2] [:id 3] [:foo :bar]]"
[params]
(->>
(map (fn [[k vs]]
(if (sequential? vs)
(map (fn [v] [k v]) vs)
[k vs])) params)
(flatten)
(partition 2)))
(def ^:private encode js/encodeURIComponent)
(defn url
"Returns an absolute url to an API endpoint"
[credentials endpoint params]
(let [server (:server credentials)
auth (select-keys credentials [:u :p])
query (->> (merge default-params auth params)
(unroll-variadic-params)
(map (fn [[k v]] (str (encode (name k)) "=" (encode v))))
(str/join "&"))]
(str (str/replace server #"/+$" "") "/rest/" endpoint "?" query)))
(defn stream-url [credentials song-or-episode]
;; podcasts have a stream-id, normal songs just use their id
(let [params {:id (or (:streamId song-or-episode)
(:id song-or-episode))}]
(url credentials "stream" params)))
(defn cover-url [credentials item size]
(url credentials "getCoverArt" {:id (:coverArt item) :size size}))
(defn is-error? [response]
(= "failed" (get-in response [:subsonic-response :status])))
(defn- unwrap-response* [response]
(-> (:subsonic-response response)
(dissoc :status :version :type :serverVersion :openSubsonic)
vals
first))
(defn ->exception
"Takes an erroneous response and makes it a real exception"
[response]
(let [error (unwrap-response* response)]
(ex-info (:message response) error)))
(defn unwrap-response
"Retrieves the actual response body"
[response]
(if (is-error? response)
(throw (->exception response))
(unwrap-response* response)))
(defn error-msg
[exception-info]
(let [{:keys [code message]} (ex-data exception-info)]
(str "Error " code ": " message)))
(defn content-type
"Given some piece of data returned by the api, returns a keyword that
describes what we look at"
[data]
(keyword :content-type
(condp set/subset? (set (keys data))
#{:path} :song
#{:artistId :name :songCount :artist} :album
#{:id :name :albumCount} :artist
:unknown)))

View file

@ -1,71 +0,0 @@
(ns airsonic-ui.api.subs
(:require [clojure.string :as str]
[re-frame.core :refer [reg-sub]]
[airsonic-ui.helpers :refer [kebabify]]))
(defn responses
"Returns the response cache"
[db _]
(:api/responses db))
(reg-sub :api/responses responses)
(defn response-for
"Returns the cached response for a single endpoint, respecting passed
url pramters."
[responses [_ endpoint params]]
(get responses [endpoint params]))
(reg-sub
:api/response-for
:<- [:api/responses]
response-for)
(defn responses-for-endpoint
"Returns a seq of all responses for an endpoint, ignoring url parameters and
looking only at the path"
[responses [_ endpoint]]
(into {} (filter (fn [[[k _] _]] (= endpoint k)) responses)))
(reg-sub
:api/responses-for-endpoint
:<- [:api/responses]
responses-for-endpoint)
(defn endpoint->kw
"Given an endpoint like `getAlbumList2`, returns a cleaned keyword like
`:album-list`.
Rules: Kebab-case everything, remove prefixes like `get`, `create`, `delete`,
`update` and strip trailing numbers."
[endpoint-str]
(-> (str/replace endpoint-str #"^(get|create|update|delete)" "")
(str/replace #"\d+$" "")
(kebabify)))
(defn current-route-data
"Returns all responses for the current route"
[[responses current-route-events] _]
(->> (filter #(= :api/request (first %)) current-route-events)
(mapcat (fn [[_ endpoint params]]
[(endpoint->kw endpoint) (get responses [endpoint params])]))
(apply hash-map)))
(reg-sub
:api/current-route-data
:<- [:api/responses]
:<- [:routes/events-for-current-route]
current-route-data)
(defn content-pending?
"Tells us if any of the requests fired for the current route are
awaiting responses."
[current-route-data _]
(->> (vals current-route-data)
(map :api/is-loading?)
(some true?)))
(reg-sub
:api/content-pending?
:<- [:api/current-route-data]
content-pending?)

View file

@ -1,144 +0,0 @@
(ns airsonic-ui.audio.core
"This namespace contains some JS interop code to interact with an audio player
and receive information about the current playback status so we can use it in
our re-frame app."
(:require [re-frame.core :as rf]
[airsonic-ui.audio.playlist :as playlist]
[goog.functions :refer [throttle]]))
(defonce audio (atom nil))
(defn normalize-time-ranges [time-ranges]
(if (> (.-length time-ranges) 0)
(.end time-ranges (dec (.-length time-ranges)))
0))
(defn ->status
"Takes an audio object and returns a map describing its current status"
[elem]
{:ended? (.-ended elem)
:paused? (.-paused elem)
:current-src (.-currentSrc elem)
:current-time (.-currentTime elem)
:seekable (normalize-time-ranges (.-seekable elem))
:buffered (normalize-time-ranges (.-buffered elem))
:volume (.-volume elem)})
; explanation of these events: https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics
(defn attach-listeners! [el]
(let [emit-audio-update (throttle #(rf/dispatch [:audio/update (->status el)]) 16)]
(doseq [event ["loadstart" "progress" "play" "timeupdate" "pause" "volumechange"]]
(.addEventListener el event emit-audio-update))))
;; effects to be fired from event handlers
(rf/reg-fx
:audio/play
(fn [stream-url]
(when-not @audio
(reset! audio (js/Audio.))
(attach-listeners! @audio))
(.pause @audio)
(set! (.-src @audio) stream-url)
(.play @audio)))
(rf/reg-fx
:audio/pause
(fn [_]
(some-> @audio .pause)))
(rf/reg-fx
:audio/stop
(fn [_]
(when-let [audio @audio]
(.pause audio)
(set! (.-currentTime audio) 0)
(set! (.-src audio) ""))))
(rf/reg-fx
:audio/toggle-play-pause
(fn [_]
(if-let [a @audio]
(if (.-paused a)
(.play a)
(.pause a)))))
(rf/reg-fx
:audio/seek
(fn [[percentage duration]]
(set! (. @audio -currentTime)
(* percentage duration))))
(defn- set-volume! [volume]
(set! (.-volume @audio) volume))
(rf/reg-fx
:audio/set-volume
(fn [percentage]
(when @audio
(set-volume! percentage))))
(rf/reg-fx
:audio/increase-volume
(fn [_]
(when-let [vol (some-> @audio .-volume)]
(set-volume! (min 1 (+ vol 0.05))))))
(rf/reg-fx
:audio/decrease-volume
(fn [_]
(when-let [vol (some-> @audio .-volume)]
(set-volume! (max 0 (- vol 0.05))))))
;; subscriptions
(defn summary
"Returns all information about audio that we have"
[db _]
(:audio db))
(rf/reg-sub :audio/summary summary)
(defn current-playlist
"Lists the complete current-queue"
[summary _]
(:current-playlist summary))
(rf/reg-sub
:audio/current-playlist
:<- [:audio/summary]
current-playlist)
(defn current-song
"Gives us information about the currently played song as presented by
the airsonic api"
[playlist _]
(when-not (empty? playlist)
(playlist/current-song playlist)))
(rf/reg-sub
:audio/current-song
:<- [:audio/current-playlist]
current-song)
(defn playback-status
"Gives us information about the most recently fired html 5 audio event"
[summary _]
(:playback-status summary))
(rf/reg-sub
:audio/playback-status
:<- [:audio/summary]
playback-status)
(defn is-playing?
"Predicate to tell us whether we currently have audio output or not"
[playback-status _]
(and (not (:paused? playback-status))
(not (:ended? playback-status))))
(rf/reg-sub
:audio/is-playing?
:<- [:audio/playback-status]
is-playing?)

View file

@ -1,196 +0,0 @@
(ns airsonic-ui.audio.playlist
"Implements playlist queues that support different kinds of repetition and
song ordering.")
;; Turns out we can nicely implement this by thinly wrapping a sequence of items
;; We re-use the core ClojureScript protocols internally but provide a nice and
;; explicit API to consume
(defprotocol IPlaylist
(current-song [this])
(next-song [this])
(previous-song [this])
(set-current-song [this song-idx]
"Advances the queue to the song given by song-idx")
(set-playback-mode [this playback-mode]
"Changes the playback mode of a playlist and re-shuffles it if necessary")
(set-repeat-mode [this repeat-mode]
"Allows you to change how the next and previous song are selected")
(enqueue-last
[this song source]
[this song]
"Registers a song to be played last, optionally remembering the source route")
(enqueue-next
[this song source]
[this song]
"Registers a song to be played next, optionally remembering the source route")
(move-song [this from-idx to-idx]
"Allows you to move a song in a playlist")
(remove-song [this song-idx]
"Removes a song from the playlist"))
;; helpers to manage creating playlists
(defn- mark-original-order
"This function is used if we switch from linear to shuffled; it allows us to
restore the order of the queue when it was created."
[items]
(->> (sort-by (comp :playlist/linear-order meta) items)
(map-indexed (fn [idx item]
(vary-meta item assoc :playlist/linear-order idx)))))
(defn- linear-queue
[items]
(->> (mark-original-order items)
(map-indexed vector)
(into (sorted-map))))
(defn- shuffled-queue
[items]
(let [shuffled-indices (shuffle (range (count items)))]
(->> (mark-original-order items)
(map vector shuffled-indices)
(into (sorted-map)))))
;; the exported interface:
(defrecord Playlist [items current-idx playback-mode repeat-mode]
cljs.core/ICounted
(-count [_]
(count items))
cljs.core/ISequential
cljs.core/ISeqable
(-seq [_] items)
IPlaylist
(current-song [_]
(get items current-idx))
(next-song [this]
(update this :current-idx
(fn [current-idx]
(cond
(= repeat-mode :repeat-single) current-idx
(or (= repeat-mode :repeat-all)
(< current-idx (dec (count this))))
(mod (inc current-idx) (count this))))))
(previous-song [this]
(update this :current-idx
(fn [current-idx]
(cond
(= repeat-mode :repeat-single) current-idx
(or (= repeat-mode :repeat-all)
(> current-idx 0))
(mod (dec current-idx) (count this))
:else nil))))
(set-current-song [playlist song-idx]
(assoc playlist :current-idx song-idx))
(set-playback-mode [playlist playback-mode]
(let [current-song (current-song playlist)
queue-fn (case playback-mode
:shuffled shuffled-queue
:linear linear-queue)
next-playlist (-> (assoc playlist :playback-mode playback-mode)
(update :items (comp queue-fn vals)))
next-idx (first (keep (fn [[idx song]]
(when (= song current-song)
idx))
(:items next-playlist)))]
;; we have to find out the index of the currently playing song after the
;; playlist was created because it might change when shuffling / unshuffling
(set-current-song next-playlist next-idx)))
(set-repeat-mode [playlist repeat-mode]
(assoc playlist :repeat-mode repeat-mode))
(enqueue-last [this song source]
(let [order (inc (key (last items)))]
;; Arguably this is a bit weird; but if you want to play something last in
;; a shuffled playlist, you want to play it last I guess.
(assoc-in this [:items order]
(vary-meta song assoc
:playlist/linear-order order
:playlist/source source))))
(enqueue-last [this song] (enqueue-last this song nil))
(enqueue-next [this song source]
;; we slice the songs up until the currently playing one and increase the
;; order for all the songs after
(let [songs (vec (vals items))
reordered (-> (subvec songs 0 (inc current-idx))
(conj (vary-meta song assoc
:playlist/linear-order (inc current-idx)
:playlist/source source))
(concat (subvec songs (inc current-idx))))]
(assoc this :items (->> (map-indexed vector reordered)
(into (sorted-map))))))
(enqueue-next [this song] (enqueue-next this song nil))
(move-song [this from-idx to-idx]
;; we have to decide whether we move all items in-between
;; one up or one down; this depends on whether we move our
;; item to the front or to the back
(let [shift-fn (cond
(< from-idx to-idx) inc
(> from-idx to-idx) dec)
start (min from-idx to-idx)
end (inc (max from-idx to-idx))
steps (range start end)
result (update this :items
(fn [items]
(-> (reduce (fn [result idx]
(assoc result idx (get items (shift-fn idx))))
items steps)
(assoc to-idx (get items from-idx)))))]
(cond
(= from-idx current-idx) (assoc result :current-idx to-idx)
(<= to-idx current-idx from-idx) (update result :current-idx inc)
(>= to-idx current-idx from-idx) (update result :current-idx dec)
:else result)))
(remove-song [this song-idx]
(cond-> (update this :items #(let [n-items (count %)]
(-> (reduce (fn [items idx]
(assoc items idx (get items (inc idx))))
% (range song-idx n-items))
(dissoc (dec n-items)))))
(= song-idx current-idx) (assoc :current-idx -1))))
;; constructor wrapper
(defn set-item-source
"Can be used to attach a source route to an item"
[item source]
(vary-meta item assoc :playlist/source source))
(defn item-source
"Retrieve the source of an item in the playlist"
[item]
(:playlist/source (meta item)))
(defmulti ->playlist
"Creates a new playlist that behaves according to the given playback- and
repeat-mode parameters."
(fn [_ & {:keys [playback-mode]}] playback-mode))
(defmethod ->playlist :linear
[items & {:keys [playback-mode repeat-mode source]}]
(->Playlist (->> (map #(set-item-source % source) items)
(linear-queue))
0 playback-mode repeat-mode))
(defmethod ->playlist :shuffled
[items & {:keys [playback-mode repeat-mode source]}]
(->Playlist (->> (map #(set-item-source % source) items)
(shuffled-queue))
0 playback-mode repeat-mode))

View file

@ -1,25 +0,0 @@
(ns airsonic-ui.components.about.views)
(defn- link
"Creates an external link"
[url label]
[:a {:href url, :target "_blank"} label])
(defn about []
[:section.section>div.container.content
[:h1 "About"]
[:p "This is a frontend for " [link "https://airsonic.github.io/" "Airsonic"] ", a free and open source media server. You can think of Airsonic as a Spotify that you can run out of a shoebox in your bedroom, enabling you to listen to your own music wherever you are."]
[:h2 "Motivation"]
[:p "The current frontend of airsonic has been written quite a long time ago - eons on a web development timescale, where the clocks tick a bit different. While it has many features it has unfortunately aged noticeably. It does not work well on mobile and some features, such as sharing parts of your music library, require Adobe Flash, leaving them practically unusable and insecure."]
[:p "This fronted aims to provide a focused subset. Its focus for now is on playing and sharing music. Setting up the airsonic instance has to be done via the old interface, as does podcast management."]
[:h2 "Thank you"]
[:p "This web application is built upon the work of many others. A special thank you goes out to…"]
[:ul
[:li "The authors of " [link "https://github.com/facebook/react" "React"] ", " [link "https://github.com/reagent-project/reagent" "reagent"] " and " [link "https://github.com/Day8/re-frame" "re-frame"]]
[:li "Everybody who has contributed to " [link "https://github.com/jgthms/bulma" "Bulma"]]
[:li "Everyone involved in bringing " [link "https://clojure.org/" "Clojure and ClojureScript"] " into the world, also thheller for creating " [link "https://shadow-cljs.github.io/docs/UsersGuide.html" "shadow-cljs"]]
[:li "Of course, the people behind " [link "http://www.subsonic.org/pages/index.jsp" "Sub-"] ", " [link "https://github.com/Libresonic/libresonic" "Libre-"] " and " [link "https://airsonic.github.io/" "especially Airsonic"]]
[:li "Many others that have been creating tooling or libraries that I use in some way or another."]]
[:h2 "Contact"]
[:p "The airsonic community can be found on " [link "https://riot.im/app/#/room/#airsonic:matrix.org" "Matrix"]
" and IRC (#airsonic on freenode). There is also a " [link "https://www.reddit.com/r/airsonic/" "dedicated Subreddit"] ". If you think you found a bug in the frontend, it's probably a good idea to " [link "https://github.com/heyarne/airsonic-ui/issues" "report it on github"] ". I hope you have fun with the software! If you want to say thanks or have a use case that you feel could be covered, feel free to get in touch. Just know that everybody involved does this in their free time."]])

View file

@ -1,85 +0,0 @@
(ns airsonic-ui.components.artist.views
(:require [airsonic-ui.components.collection.views :as collection]
[airsonic-ui.components.library.views :as library]
[airsonic-ui.routes :as routes]
[clojure.string :as str]))
(defn link-button [attrs children]
[:p.control>a.button.is-small (merge attrs {:target "_blank"}) children])
(defn lastfm-bio
"Displays the last.fm biography without the 'Read more on Last.fm' link"
[artist-info]
(when (:biography artist-info)
(let [biography (str/replace (:biography artist-info) #"<a .*?>$" "")]
[:p {:dangerouslySetInnerHTML {:__html biography}}])))
(defn lastfm-link [artist-info]
[link-button {:href (:lastFmUrl artist-info)} "See on last.fm"])
(defn musicbrainz-link [artist-info]
(let [href (str "https://musicbrainz.org/artist/" (:musicBrainzId artist-info))]
[link-button {:href href} "See on musicbrainz"]))
(defn artist-links [artist-info]
(when-not (empty? (select-keys artist-info [:lastFmUrl :musicBrainzId]))
[:div.field.is-grouped
(when (:lastFmUrl artist-info)
[lastfm-link artist-info])
(when (:musicBrainzId artist-info)
[musicbrainz-link artist-info])]))
(defn similar-artists
"Given an artist-info response will return a list of similar artists"
[{similar-artists :similarArtist}]
[:div.tags.are-medium.similar-artists
(for [{:keys [id name]} similar-artists]
^{:key id} [:a.tag.is-link.is-light {:href (routes/url-for ::routes/artist.detail {:id id})} name])])
(defn detail
"Creates a nice artist page displaying the artist's name, bio (if available and
listing) their albums."
[{:keys [artist artist-info]}]
[:div
[:section.hero.is-small>div.hero-body>div.container
[:h1.title (:name artist)]
[:div.content
[lastfm-bio artist-info]
[artist-links artist-info]]]
[:section.section.is-small>div.container
[:h2.subtitle "Albums"]
[collection/listing (:album artist)]]
(when (:similarArtist artist-info)
[:section.section.is-small>div.container
[:h2.subtitle "Similar artists in your collection"]
[similar-artists artist-info]])])
(defn alphabetical-listing
[artists]
[:div.alphabetical-list
(for [group artists]
^{:key (:name group)}
[:div.group
[:h1.subtitle.is-4 (:name group)]
[:ol.artist-links
(for [artist (:artist group)]
(let [href (routes/url-for ::routes/artist.detail (select-keys artist [:id]))]
^{:key (:id artist)} [:li [:a {:href href} (:name artist)]]))]])])
(defn overview
"Displays the alphabetical listing of all artists along with some additional
information about the collection"
[current-route {:keys [artists]}]
(let [artists (:index artists)
;; TODO: Calculations in views should be avoided
artists-count (count (mapcat :artist artists))
album-count (->> (mapcat :artist artists)
(map :albumCount)
(reduce +))]
[:div
[library/tab-section current-route]
[:section.hero.single-line.is-small>div.hero-body
[:div.container
[:h1.title "Artists"]
[:p.subtitle.is-5.has-text-grey [:strong artists-count] " artists with " [:strong album-count] " albums"]]]
[:section.section>div.container [alphabetical-listing artists]]]))

View file

@ -1,113 +0,0 @@
(ns airsonic-ui.components.audio-player.events
(:require [re-frame.core :as rf]
[airsonic-ui.audio.playlist :as playlist]
[airsonic-ui.api.helpers :as api]))
; sets up the db, starts to play a song and adds the rest to a playlist
(defn play-all-songs [{:keys [db]
:routes/keys [current-route]} [_ songs start-idx]]
(let [playlist (-> (playlist/->playlist songs :playback-mode :linear :repeat-mode :repeat-all :source current-route)
(playlist/set-current-song start-idx))]
{:audio/play (api/stream-url (:credentials db) (playlist/current-song playlist))
:db (assoc-in db [:audio :current-playlist] playlist)}))
(rf/reg-event-fx
:audio-player/play-all
[(rf/inject-cofx :routes/current-route)]
play-all-songs)
(rf/reg-event-db
:audio-player/set-playback-mode
(fn [db [_ playback-mode]]
(update-in db [:audio :current-playlist] #(playlist/set-playback-mode % playback-mode))))
(rf/reg-event-db
:audio-player/set-repeat-mode
(fn [db [_ repeat-mode]]
(update-in db [:audio :current-playlist] #(playlist/set-repeat-mode % repeat-mode))))
(rf/reg-event-fx
:audio-player/next-song
(fn [{:keys [db]} _]
(let [db (update-in db [:audio :current-playlist] playlist/next-song)
next (playlist/current-song (get-in db [:audio :current-playlist]))]
{:db db
:audio/play (api/stream-url (:credentials db) next)})))
(rf/reg-event-fx
:audio-player/previous-song
(fn [{:keys [db]} _]
(let [db (update-in db [:audio :current-playlist] playlist/previous-song)
song (playlist/current-song (get-in db [:audio :current-playlist]))]
{:db db
:audio/play (api/stream-url (:credentials db) song)})))
(defn set-current-song [{:keys [db]} [_ idx]]
(let [db (update-in db [:audio :current-playlist] playlist/set-current-song idx)
song (playlist/current-song (get-in db [:audio :current-playlist]))]
{:db db
:audio/play (api/stream-url (:credentials db) song)}))
(rf/reg-event-fx :audio-player/set-current-song set-current-song)
(rf/reg-event-fx
:audio-player/enqueue-next
[(rf/inject-cofx :routes/current-route)]
(fn [{:keys [db]
:routes/keys [current-route]} [_ song]]
{:db (update-in db [:audio :current-playlist] #(playlist/enqueue-next % song current-route))}))
(rf/reg-event-fx
:audio-player/enqueue-last
[(rf/inject-cofx :routes/current-route)]
(fn [{:keys [db]
:routes/keys [current-route]} [_ song]]
{:db (update-in db [:audio :current-playlist] #(playlist/enqueue-last % song current-route))}))
(rf/reg-event-db
:audio-player/move-song
(fn [db [_ from-idx to-idx]]
(update-in db [:audio :current-playlist] #(playlist/move-song % from-idx to-idx))))
(rf/reg-event-fx
:audio-player/toggle-play-pause
(fn [_ _]
{:audio/toggle-play-pause nil}))
(defn remove-song [{:keys [db]} [_ song-idx]]
(let [song-removed (update-in db [:audio :current-playlist] #(playlist/remove-song % song-idx))]
(cond-> {:db song-removed}
(nil? (playlist/current-song (get-in song-removed [:audio :current-playlist])))
(assoc :audio/stop nil))))
(rf/reg-event-fx :audio-player/remove-song remove-song)
(defn audio-update
"Reacts to audio events fired by the HTML5 audio player and plays the next
track if necessary."
[{:keys [db]} [_ status]]
(cond-> {:db (assoc-in db [:audio :playback-status] status)}
(:ended? status) (assoc :dispatch [:audio-player/next-song])))
(rf/reg-event-fx :audio/update audio-update)
(rf/reg-event-fx
:audio-player/seek
(fn [{:keys [db]} [_ percentage]]
(let [duration (:duration (playlist/current-song (get-in db [:audio :current-playlist])))]
{:audio/seek [percentage duration]})))
(rf/reg-event-fx
:audio-player/set-volume
(fn [_ [_ percentage]]
{:audio/set-volume percentage}))
(rf/reg-event-fx
:audio-player/increase-volume
(fn [_ _]
{:audio/increase-volume nil}))
(rf/reg-event-fx
:audio-player/decrease-volume
(fn [_ _]
{:audio/decrease-volume nil}))

View file

@ -1,157 +0,0 @@
(ns airsonic-ui.components.audio-player.views
(:require [re-frame.core :refer [subscribe dispatch]]
[reagent.core :as r]
[airsonic-ui.routes :as routes]
[airsonic-ui.helpers :as h]
[airsonic-ui.views.cover :refer [cover]]
[bulma.icon :refer [icon]]))
;; currently playing / coming next / audio controls...
(defn seek
"Calculates the position of the click and sets current playback accordingly"
[ev]
(let [x-ratio (/ (.. ev -nativeEvent -layerX)
(.. ev -target -parentElement getBoundingClientRect -width))]
(dispatch [:audio-player/seek x-ratio])))
(defn- ratio->width [ratio]
(str (.toFixed (min 100 (* 100 ratio)) 2) "%"))
(defn progress-bars [buffered-width played-width]
[:svg.progress-bars {:aria-hidden "true"}
[:svg.complete-song-bar
[:rect {:x 0, :y "50%", :width "100%", :height 1}]]
[:svg.buffered-part-bar
[:rect.click-dummy {:on-click seek
:x 0, :y 0, :width buffered-width, :height "100%"}]
[:rect {:x 0, :y "50%", :width buffered-width, :height 1}]]
[:svg.played-back-bar
[:rect {:x 0, :y "50%", :width played-width, :height 1}]
[:circle {:cx played-width, :cy "50%", :r 2.5}]]])
(defn progress-indicators [song status]
(let [current-time (:current-time status)
buffered (:buffered status)
duration (:duration song)
progress-text (str (h/format-duration current-time :brief? true)
" / "
(h/format-duration duration :brief? true))
buffered-width (ratio->width (/ buffered duration))
played-width (ratio->width (/ current-time duration))]
[:article.progress-indicators
[progress-bars buffered-width played-width]
[:div.progress-info-text.duration-text progress-text]]))
(defn playback-info [song status]
[:a.playback-info.media
{:href (routes/url-for ::routes/current-queue)
:title "Go to current queue"}
[:div.media-left [cover song 64]]
[:div.media-content
[:div.artist-and-title
[:span.artist(:artist song)]
[:span.song-title (:title song)]]]])
(defn playback-controls [is-playing?]
[:div.button-controls.playback-controls
[:div.field.has-addons
(let [buttons [[:media-step-backward :audio-player/previous-song]
[(if is-playing? :media-pause :media-play) :audio-player/toggle-play-pause]
[:media-step-forward :audio-player/next-song]]
title {:media-step-backward "Previous"
:media-play "Play"
:media-pause "Pause"
:media-step-forward "Next"}]
(for [[icon-glyph event] buttons]
^{:key icon-glyph} [:p.control [:button.button.is-light
{:on-click (h/muted-dispatch [event])
:title (title icon-glyph)}
[icon icon-glyph]]]))]])
(defn- toggle-shuffle [playback-mode]
(h/muted-dispatch [:audio-player/set-playback-mode (if (= playback-mode :shuffled)
:linear :shuffled)]))
(defn- toggle-repeat-mode [current-mode]
(let [modes (cycle '(:repeat-none :repeat-all :repeat-single))
next-mode (->> (drop-while (partial not= current-mode) modes)
(second))]
(h/muted-dispatch [:audio-player/set-repeat-mode next-mode])))
(defn set-volume [ev]
(when (= 1 (.-buttons ev)) ;; only on left-click
(let [y-ratio (/ (.. ev -nativeEvent -offsetY)
(.. ev -target getBoundingClientRect -height))]
(dispatch [:audio-player/set-volume (- 1 y-ratio)]))))
(defonce volume-slider-visible? (r/atom false))
(defn volume-slider [volume]
(let [y-pos (* (- 1 volume) 100)]
[:svg.volume-bar {:width "100%", :height "100%"}
;; the translate(...) makes the 1px rects look smoother
[:g {:transform "translate(-0.5,0)"}
;; background line
[:rect.inactive {:x "50%", :y 0, :width 1, :height "100%"}]
;; below are the line and circle that show the current volume
[:rect.active {:x "50%", :y (str y-pos "%"),
:width 1, :height (str (- 100 y-pos) "%")}]]
[:circle.active {:cx "50%", :cy (str y-pos "%"), :r 3}]
[:rect.click-dummy {:x 0, :y 0, :width "100%", :height "100%"
:on-mouse-down set-volume
:on-mouse-up set-volume
:on-mouse-move set-volume}]]))
(def toggle-volume-slider #(swap! volume-slider-visible? not))
(def hide-volume-slider #(reset! volume-slider-visible? false))
(defn volume-controls [playback-status]
(let [volume (:volume playback-status)
volume-icon (cond
(> volume 0.66) :volume-high
(> volume 0.1) :volume-low
:else :volume-off)]
[:div.button-controls.volume-controls
(when @volume-slider-visible?
[:div.button-menu
[:div.button-menu-closer {:on-click hide-volume-slider}]
[volume-slider volume]])
[:p.control>button.button.is-light
{:on-click toggle-volume-slider}
[icon volume-icon]]]))
(defn playback-mode-controls [{:keys [repeat-mode playback-mode]}]
(let [button :p.control>button.button.is-light
shuffle-button (h/add-classes button (when (= playback-mode :shuffled) :is-primary))
repeat-button (h/add-classes button (case repeat-mode
:repeat-single :is-info
:repeat-all :is-primary
nil))
repeat-title (case repeat-mode
:repeat-all "Repeating current queue, click to repeat current track"
:repeat-single "Repeating current track, click to repeat none"
"Click to repeat current queue")]
[:div.button-controls.playback-mode-controls
[:div.button-group>div.field.has-addons
^{:key :shuffle-button} [shuffle-button {:on-click (toggle-shuffle playback-mode)
:title "Shuffle"} [icon :random]]
^{:key :repeat-button} [repeat-button {:on-click (toggle-repeat-mode repeat-mode)
:title repeat-title} [icon :loop]]]]))
(defn audio-player []
(let [current-song @(subscribe [:audio/current-song])
current-playlist @(subscribe [:audio/current-playlist])
playback-status @(subscribe [:audio/playback-status])
is-playing? @(subscribe [:audio/is-playing?])]
[:nav.audio-player
(if current-song
;; show song info, controls, progress bar, etc.
[:section.audio-interaction
[playback-info current-song playback-status]
[progress-indicators current-song playback-status]
[playback-controls is-playing?]
[volume-controls playback-status]
[playback-mode-controls current-playlist]]
;; not playing anything
[:p.navbar-item.idle-notification "No audio playing"])]))

View file

@ -1,10 +0,0 @@
(ns airsonic-ui.components.bangpow.views)
(defn not-found []
[:section.section>div.container.content
[:h1 "Oooops..."]
[:p "That should not have happened. There are multiple things that might have gone wrong:"]
[:ul
[:li "You clicked a wrong link. Maybe you copy and pasted it and missed something."]
[:li "It's a bug in the user interface. In that case: sorry! You can report it " [:a {:href "https://github.com/heyarne/airsonic-ui/issues"
:target "_blank"} "on github"]"."]]])

View file

@ -1,101 +0,0 @@
(ns airsonic-ui.components.collection.views
"A collection is a list of audio files that belong together (e.g. an album or
a podcast's overview)"
(:require [re-frame.core :refer [subscribe]]
[bulma.icon :refer [icon]]
[bulma.dropdown.views :refer [dropdown]]
[airsonic-ui.helpers :as h]
[airsonic-ui.routes :as routes]
[airsonic-ui.views.cover :refer [cover card]]))
(defn collection-info [{:keys [songCount duration year]}]
(vec (cond-> [:ul.is-smaller.collection-info
[:li [icon :audio-spectrum] (str songCount (if (= 1 songCount)
" track" " tracks"))]
[:li [icon :clock] (h/format-duration duration)]]
year (conj [:li [icon :calendar] (str "Released in " year)]))))
;; TODO: Maybe this view belongs somewhere else?
;; Something like a collection-grid component?
(defn album-card
"A single element in a grid of albums. Shows the cover, artist and album name."
[{:keys [artist artistId name id] :as album}]
[card album
:url-fn #(routes/url-for ::routes/album.detail {:id id})
:content [:div
;; link to album
[:div.title.is-5
[:a {:href (routes/url-for ::routes/album.detail {:id id})
:title name} name]]
;; link to artist page
[:div.subtitle.is-6 [:a {:href (routes/url-for ::routes/artist.detail {:id artistId})
:title artist} artist]]]])
(defn listing [albums]
;; always show 5 in a row
[:div.columns.is-multiline.is-mobile
(for [[idx album] (map-indexed vector albums)]
^{:key idx} [:div.column.is-one-fifth-desktop.is-one-quarter-tablet.is-half-mobile
[album-card album]])])
;; TODO: Avoid duplication
(defn artist-link [{id :artistId, artist :artist}]
(if id
[:a {:href (routes/url-for ::routes/artist.detail {:id id})} artist]
artist))
(defn song-link [{:keys [songs song idx]}]
[:a
{:href "#" :on-click (h/muted-dispatch [:audio-player/play-all songs idx] :sync? true)}
(:title song)])
(defn song-actions [song]
[dropdown {:items [{:label "Play Next" :event [:audio-player/enqueue-next song]}
{:label "Play Last" :event [:audio-player/enqueue-last song]}]}])
(defn default-thead []
[:thead>tr
[:td.is-narrow]
[:td.song-artist "Artist"]
[:td.song-title "Title"]
[:td.song-duration "Duration"]
[:td.is-narrow]])
(defn default-tbody [{:keys [songs current-song]}]
[:tbody
(for [[idx song] (map-indexed vector songs)]
^{:key idx}
[(if (= (:id song) (:id current-song)) :tr.is-playing :tr)
[:td.song-tracknr.is-narrow (:track song)]
[:td.song-artist [artist-link song]]
[:td.song-title [song-link {:songs songs
:song song
:idx idx}]]
[:td.song-duration (h/format-duration (:duration song) :brief? true)]
[:td.song-actions.is-narrow [song-actions song]]])])
(defn song-table [{:keys [songs thead tbody]
:or {thead default-thead, tbody default-tbody}}]
;; we subscribe here instead of one level higher up to make this a more
;; reusable component; this way we can for example get a list of all songs
;; in a search result and easily highlight the currently playing track
(let [current-song @(subscribe [:audio/current-song])]
[:table.song-listing-table.table.is-fullwidth
[thead]
[tbody {:songs songs, :current-song current-song}]]))
(defn detail
"Shows a detail view of a single album, listing all "
[{:keys [album]}]
[:div
[:section.hero.is-small>div.hero-body
[:div.container
[:article.collection-header.media
[:div.media-left [cover album 128]]
[:div.media-content
[:h2.title (:name album)]
[:h3.subtitle (:artist album)]
[collection-info album]]]]]
[:section.section>div.container
[song-table {:songs (:song album)}]]])

View file

@ -1,15 +0,0 @@
(ns airsonic-ui.components.current-queue.subs
(:require [re-frame.core :as rf]))
(defn queue-info [playlist]
{:count (count playlist)
:duration
(reduce (fn [acc [_ item]]
(+ acc (:duration item))) 0 (:items playlist))})
(println "registering the sub")
(rf/reg-sub
:current-queue/info
:<- [:audio/current-playlist]
queue-info)

View file

@ -1,107 +0,0 @@
(ns airsonic-ui.components.current-queue.views
(:require [re-frame.core :refer [subscribe dispatch-sync]]
[reagent.core :as r]
["react-sortable-hoc" :refer [SortableHandle]]
[bulma.icon :refer [icon]]
[bulma.dropdown.views :refer [dropdown]]
[airsonic-ui.helpers :as helpers]
[airsonic-ui.audio.playlist :as playlist]
[airsonic-ui.components.collection.views :as collection]
[airsonic-ui.components.sortable.views :as sortable]
[airsonic-ui.routes :as routes]
;; ↓ registers subscription handlers ↓
[airsonic-ui.components.current-queue.subs]))
(def SortHandle
(SortableHandle.
;; Alternative to r/reactify-component, which doens't convert props and hiccup,
;; is to just provide fn as component and use as-element or create-element
;; to return React elements from the component.
(fn []
(r/as-element [:span.is-size-7.has-text-grey-lighter
[icon :elevator]]))))
(defn song-actions [{:keys [song idx]}]
[dropdown {:items [{:label "Remove from queue"
:event [:audio-player/remove-song idx]}
{:label "Go to source"
:event [:routes/do-navigation (playlist/item-source song)]}]}])
(defn artist-link [{id :artistId, artist :artist}]
(if id
[:a {:href (routes/url-for ::routes/artist.detail {:id id})} artist]
artist))
(defn song-link [song idx]
[:a
{:href "#"
:on-click (helpers/muted-dispatch [:audio-player/set-current-song idx])}
(:title song)])
(defn song-table-head []
[:thead>tr
[:td.is-narrow]
[:td.song-artist "Artist"]
[:td.song-title "Title"]
[:td.song-duration "Duration"]
[:td.song-actions.is-narrow]])
(defn song-table-sortable-tbdoy [{:keys [songs current-song-idx]}]
;; we need this closure to pass in custom arguments (current-song-idx)
(fn []
[sortable/sortable-component
{:items songs
:container [:tbody]
:helper-class "sortable-is-moving"
:render-item
(fn [{[idx song] :value}]
[(if (= idx current-song-idx) :tr.is-playing :tr)
[:td.sortable-handle.is-narrow [:> SortHandle]]
[:td.song-artist [artist-link song]]
[:td.song-title [song-link song idx]]
[:td.song-duration (helpers/format-duration (:duration song) :brief? true)]
[:td.song-actions.is-narrow [song-actions {:song song
:idx idx}]]])
:on-sort-end
(fn [{:keys [old-idx new-idx]}]
;; if we don't dispatch-sync, the UI sometimes places the row back and
;; resorts it a litle later
(dispatch-sync [:audio-player/move-song old-idx new-idx]))}]))
(defn song-table [{:keys [songs current-song-idx]}]
[collection/song-table
{:songs songs
:thead song-table-head
:tbody (song-table-sortable-tbdoy {:songs songs
:current-song-idx current-song-idx})}])
(defn queue-info [{:keys [playlist-info]}]
[:ul.is-smaller.collection-info
[:li [icon :audio-spectrum] (str (:count playlist-info)
(if (pos? (:count playlist-info))
" tracks"
" track"))]
[:li [icon :clock] (helpers/format-duration (:duration playlist-info))]])
(defn playlist [props]
[:div
[queue-info props]
[song-table {:songs (get-in props [:current-playlist :items])
:current-song-idx (get-in props [:current-playlist :current-idx])}]])
(defn empty-playlist []
[:p "You are currently not playing anything. Use the search or go to your "
[:a {:href (routes/url-for ::routes/library)} "Library"] " to start playing some music."])
(defn current-queue []
(let [current-playlist @(subscribe [:audio/current-playlist])
playlist-info @(subscribe [:current-queue/info])]
[:section.section>div.container
[:h1.title "Current Queue"]
(if (empty? current-playlist)
[empty-playlist]
[playlist {:current-playlist current-playlist
:playlist-info playlist-info}])]))

View file

@ -1,7 +0,0 @@
(ns airsonic-ui.components.debug.views
(:require [fipp.edn :refer [pprint]]))
(defn debug
"Returns a nicely formatted debug view of any given data structure"
[data]
[:pre (with-out-str (pprint data))])

View file

@ -1,33 +0,0 @@
(ns airsonic-ui.components.highres-canvas.views
"This module provides a reusable canvas component. You can provide a drawing
function via the `:draw` attribute which will be passed a 2d rendering
context. It will automatically be drawn in high resolution on retina displays."
(:require [reagent.core :as reagent]))
(defn redraw [this]
(let [draw (:draw (reagent/props this))
canvas (reagent/dom-node this)
width (.-clientWidth canvas)
height (.-clientHeight canvas)
ctx (.getContext canvas "2d")
pixel-ratio (.-devicePixelRatio js/window)]
(set! (. canvas -width) width)
(set! (. canvas -height) height)
(set! (.. canvas -style -width) (str width "px"))
(set! (.. canvas -style -height) (str height "px"))
;; retina drawing code:
;; set up dimensions, reset the transform matrix to the identity
;; matrix and automatically scale up
(when (> pixel-ratio 1)
(set! (. canvas -width) (* pixel-ratio width))
(set! (. canvas -height) (* pixel-ratio height))
(.setTransform ctx 1 0 0 1 0 0)
(.scale ctx pixel-ratio pixel-ratio))
(draw ctx)))
(defn canvas [attrs & _]
(reagent/create-class
{:component-did-update redraw
:component-did-mount redraw
:render (fn render []
[:canvas.highres-canvas (dissoc attrs :draw)])}))

View file

@ -1,25 +0,0 @@
(ns airsonic-ui.components.keyboard-shortcuts.config)
;; this keymap has the following structure:
;; [[readable-key readable-description event-vector event-keys]
;; ...]
(def keymap
[["Space" "Toggle play / pause"
[:audio-player/toggle-play-pause]
[{:keyCode 32}]]
["←" "Previous song"
[:audio-player/previous-song]
[{:keyCode 37}]]
["→" "Next song"
[:audio-player/next-song]
[{:keyCode 39}]]
["+" "Increase volume"
[:audio-player/increase-volume]
[{:keyCode 171}]]
["-" "Decrease volume"
[:audio-player/decrease-volume]
[{:keyCode 173}]]
["?" "Show / hide keyboard shortcut help"
[:bulma.modal.events/toggle :keyboard-shortcuts-help]
[{:keyCode 63}]]])

View file

@ -1,13 +0,0 @@
(ns airsonic-ui.components.keyboard-shortcuts.events
(:require [re-frame.core :as rf]
[re-pressed.core :as rp]
[airsonic-ui.components.keyboard-shortcuts.config :as config]))
(rf/reg-event-fx
::init-shortcuts
(fn []
(let [event-keys (map (juxt #(nth % 2) #(nth % 3)) config/keymap)
prevent-default-keys (mapcat last event-keys)]
{:dispatch-n [[::rp/add-keyboard-event-listener "keydown"]
[::rp/set-keydown-rules {:event-keys event-keys
:prevent-default-keys prevent-default-keys}]]})))

View file

@ -1,12 +0,0 @@
(ns airsonic-ui.components.keyboard-shortcuts.views
(:require [bulma.modal.views :as bulma]
[airsonic-ui.components.keyboard-shortcuts.config :as config]))
(defn help-modal []
[bulma/modal-card {:title "Keyboard Shortcuts"
:modal-id :keyboard-shortcuts-help}
[:table.table.is-hoverable.is-fullwidth
[:thead [:tr [:th "Key"] [:th "Function"]]]
[:tbody
(for [[idx [k desc]] (map-indexed vector config/keymap)]
^{:key idx} [:tr [:td>code k] [:td desc]])]]])

View file

@ -1,41 +0,0 @@
(ns airsonic-ui.components.library.subs
(:require [re-frame.core :as rf]
[airsonic-ui.config :as conf]))
;; first some helper functions to make the structure a bit clearer
(defn filter-response-kind
"Takes all library responses and returns only the ones matching a specific kind"
[kind responses]
(filter (fn [[[_ params] _]]
(= kind (:type params))) responses))
(defn partition-responses
"Returns a map of responses, where each response is neatly mapped to the page
it show on."
[kind responses]
(->> (filter-response-kind kind responses)
(sort-by (fn [[[_ params] _]] (:offset params)))
(mapcat (fn [[[_ params] {albums :album}]]
(let [start-page (/ (:offset params) conf/albums-per-page)]
(zipmap (drop start-page (range))
(partition-all conf/albums-per-page albums)))))
(into (sorted-map))))
;; `complete-library` is the subscription that is actually exported
(defn paginated-library
"Returns a sorted map that can be used to access the library content loaded
from the server. Each key represents a page and the associated value
represents the page's content."
[responses [_ kind]]
;; note that we "humanize" the keys, meaning page 1 is the page with offset 0
(->> (partition-responses kind responses)
(map (fn [[k v]] [(inc k) v]))
(into (sorted-map))))
(rf/reg-sub
:library/paginated
:<- [:api/responses-for-endpoint "getAlbumList2"]
paginated-library)

View file

@ -1,95 +0,0 @@
(ns airsonic-ui.components.library.views
(:require [re-frame.core :refer [subscribe]]
[bulma.tabs :refer [tabs]]
[airsonic-ui.routes :as routes :refer [url-for]]
[airsonic-ui.components.collection.views :as collection]))
;; this variable determines how many pages before the first known page we should list
(def page-padding 2)
(defn pagination-link
"One of many numbered links to a page"
[current-page page href]
(let [current-page? (= page current-page)]
[(if current-page?
:a.pagination-link.is-current
:a.pagination-link)
(cond-> {:href href, :aria-label (str "Page " page)}
current-page? (assoc :aria-current "page")) page]))
(defn pagination
"Builds a pagination, calling `url-fn` for every rendered page link with the
page as its argument. When `max-pages` is `nil` an infinite pagination
will be rendered."
[{:keys [items current-page url-fn]}]
;; NOTE: This is currently slightly flawed. We don't have any good way to
;; know whether we're on the last possible page so we take the last loaded
;; page instead
(let [num-pages (last (keys items))
first-page? (= current-page 1)
pages (range (max 1 (- current-page page-padding))
(min (inc (+ current-page page-padding)) (inc num-pages)))]
[:nav.pagination.is-centered {:role "pagination", :aria-label "pagination"}
;; now we add buttons to progress one page in each direction
[:a.pagination-previous (if first-page?
{:disabled true}
{:href (url-fn (dec current-page))}) "Previous page"]
[:a.pagination-next {:href (url-fn (inc current-page))} "Next page"]
;; and here we modify the links around our current page
[:ul.pagination-list
;; some indication that there are previous pages
(when (> current-page (+ page-padding 2))
[:li [pagination-link current-page 1 (url-fn 1)]])
(when (> current-page (+ page-padding 1))
[:li>span.pagination-ellipsis "…"])
;; all pagination links around our current page
(for [page pages]
^{:key page} [:li [pagination-link current-page page (url-fn page)]])
;; some indication that there are more pages after
(when (< current-page (- num-pages page-padding))
[:li>span.pagination-ellipsis "…"])
(when (< current-page (- num-pages page-padding))
[:li [pagination-link current-page num-pages (url-fn num-pages)]])]]))
(defn tab-items [[current-id current-params :as current-route]]
(->>
[[[::routes/library {:kind "recent"}] "Recently Played"]
[[::routes/library {:kind "newest"}] "Newest Additions"]
[[::routes/library {:kind "starred"}] "Starred"]
[[::routes/artist.overview] "Artists"]]
(map (fn [[[id params :as route] label]]
(cond-> {:href (apply routes/url-for route)
:label label}
(and (= id current-id)
(= (:kind params) (:kind current-params)))
(assoc :active? true))))))
(defn tab-section [current-route]
[:section.section.ui-tab-bar.is-small>div.container
[tabs {:items (tab-items current-route)}]])
(defn main
"Renders the pagination and shows a list of all albums with their cover art.
The first parameter is the route that's passed in, the second one is the
content that has been fetched for that route."
[[_ {:keys [kind]} {:keys [page] :or {page 1}} :as current-route]
{:keys [scan-status]}]
(println "scan-status" scan-status)
(let [library @(subscribe [:library/paginated kind])
page (int page)
current-items (get library page)
url-fn #(url-for ::routes/library {:kind kind} {:page %})
pagination-links [pagination {:current-page page
:items library
:url-fn url-fn}]]
[:div
[tab-section current-route]
[:section.hero.single-line.is-small>div.hero-body>div.container
[:h2.title "Your Library"]
(if (:count scan-status)
[:p.subtitle.is-5.has-text-grey [:strong (:count scan-status)] " items"]
(when (:scanning scan-status)
[:p.subtitle.is-5.has-text-grey "Scanning…"]))]
[:section.section.is-tiny>div.container pagination-links]
[:section.section.is-tiny>div.container [collection/listing current-items]]
[:section.section.is-tiny>div.container pagination-links]]))

View file

@ -1,13 +0,0 @@
(ns airsonic-ui.components.podcast.events)
(defn subscribe-to-channel
[db [_ channel-url]])
(defn delete-podcast-channel
[db [_ channel-id]])
(defn download-episode
[db [_ episode-id]])
(defn delete-episode
[db [_ episode-id]])

View file

@ -1,52 +0,0 @@
(ns airsonic-ui.components.podcast.subs
(:require [re-frame.core :refer [reg-sub]]))
;; this unwraps the api response into a collection
(reg-sub
::podcast.response
:<- [:api/response-for "getPodcasts"]
(fn [response]
(:channel response)))
(defn podcast-channels
"Given a podcast response, returns information about the channels that have
been subscribed to."
[response _]
(when response
(map #(dissoc % :episode) response)))
(reg-sub
::podcast.channels
:<- [::podcast.response]
podcast-channels)
(defn sorted-podcast-episodes
"Given a response of all podcasts, returns all episodes sorted by a given function"
[response [_ key-fn & {:keys [n reverse?]
:or {n 15
reverse? true}}]]
;; some podcasts have an :artist and some don't, we make sure all of them have one
(let [id->channel (into {} (map (juxt :id :title) response))]
(let [sorted (->> (mapcat :episode response)
(map (fn [episode]
(assoc episode :artist (id->channel (:channelId episode)))))
(sort-by (or key-fn identity)))]
(take n (if reverse? (reverse sorted) sorted)))))
(reg-sub
::podcast.all-episodes-by
:<- [::podcast.response]
sorted-podcast-episodes)
(defn podcast-detail
"Since there's no real detail request, this function provides some abstraction
for that in providing a lense to only the podcast with a specific channel-id."
[[response [_ params _]] _]
(let [channel-id (:id params)]
(first (filter #(= channel-id (:id %)) response))))
(reg-sub
::podcast.detail-from-route
:<- [::podcast.response]
:<- [:routes/current-route]
podcast-detail)

View file

@ -1,85 +0,0 @@
(ns airsonic-ui.components.podcast.views
(:require [re-frame.core :refer [subscribe]]
[airsonic-ui.helpers :refer [muted-dispatch]]
[airsonic-ui.routes :as routes :refer [url-for]]
[airsonic-ui.components.podcast.subs :as subs]
[airsonic-ui.views.cover :refer [cover card]]
[bulma.icon :refer [icon]]
[airsonic-ui.components.debug.views :refer [debug]]))
;; TODO: Implement detail pages for podcasts
;; TODO: Implement CRUD frontend for podcasts
;; TODO: Error handling for channels and episodes
(defn channel-card
"Displays the cover of a podcast and links to the podcasts detail page"
[channel]
[card channel
:url-fn #(url-for ::routes/podcast.detail {:id (:id channel)})
:content [:div.title.is-5
[:a {:href (url-for ::routes/podcast.detail {:id (:id channel)})
:title (:title channel)} (:title channel)]]])
(defn- channel-overview [channels]
[:div.columns.is-multiline.is-mobile
(for [[idx channel] (map-indexed vector channels)]
^{:key idx}
[:div.column.is-one-fifth-desktop.is-one-quarter-tablet.is-half-mobile
[channel-card channel]])])
(defn- episode-actions [episode]
(case (:status episode)
"completed"
[[:td>a {:title "Play Next"
:href "#"
:on-click (muted-dispatch [:audio-player/enqueue-next episode])}
[icon :plus]]
[:td>a {:title "Play Last"
:href "#"
:on-click (muted-dispatch [:audio-player/enqueue-last episode])}
[icon :caret-right]]]
"skipped" ;; FIXME: Show download button
[[:td] [:td]]))
(defn- episode-list [episodes]
[:table.table.is-striped.is-hoverable.is-fullwidth>tbody
(for [[idx episode] (map-indexed vector episodes)]
^{:key idx}
(into
[:tr
[:td.grow [:span
[:a {:href (url-for ::routes/podcast.detail {:id (:channelId episode)})}
(:artist episode)]
" - "
[:a {:title (:title episode)
:href "#"
;; the reason for :sync? true can be found here
;; https://github.com/heyarne/airsonic-ui/issues/33
:on-click (muted-dispatch [:audio-player/play-all episodes idx] :sync? true)}
(:title episode)]]]]
(episode-actions episode)))])
(defn detail
"Detail page for a single channel"
[_]
;; NOTE: This isn't especially pretty, but it works. The detail page can only
;; ever be displayed for the podcast the current route points to
(let [channel @(subscribe [::subs/podcast.detail-from-route])]
[:div
[:section.section>div.hero-body
[:div.container>article.media
[:div.media-left [cover channel 128]]
[:div.media-content
[:h2.title (:title channel)]
[:p (:description channel)]]]]
[:section.section>div.container [episode-list (:episode channel)]]]))
(defn overview
"All channels and most recently published shows"
[_]
(let [channels @(subscribe [::subs/podcast.channels])
episodes @(subscribe [::subs/podcast.all-episodes-by :created])]
[:section.section>div.container
[:h1.title "Subscriptions"]
[channel-overview channels]
[:h1.title "Latest Episodes"]
[episode-list episodes]]))

View file

@ -1,15 +0,0 @@
(ns airsonic-ui.components.search.events
(:require [re-frame.core :refer [reg-event-fx reg-event-db]]
[airsonic-ui.routes :as routes]))
(reg-event-db
;; this is called on navigation and handled in routes.cljs; the reason is that
;; when we're navigating to search?query=foo we don't have the term in our db.
:search/restore-term-from-param
(fn [db [_ term]]
(assoc-in db [:search :term] term)))
(reg-event-fx
:search/do-search
(fn do-search [fx [_ term]]
{:dispatch [:routes/do-navigation [::routes/search {} {:query term}]]}))

View file

@ -1,5 +0,0 @@
(ns airsonic-ui.components.search.subs
(:require [re-frame.core :refer [reg-sub subscribe]]))
(reg-sub :search/current-term (fn current-term [db _]
(get-in db [:search :term])))

View file

@ -1,94 +0,0 @@
(ns airsonic-ui.components.search.views
(:require [re-frame.core :refer [dispatch subscribe]]
[goog.functions :refer [debounce]]
[airsonic-ui.routes :as routes :refer [url-for]]
[airsonic-ui.helpers :as h]
[airsonic-ui.components.collection.views :as collection]
[airsonic-ui.views.cover :refer [card]]))
(def search
(debounce #(dispatch [:search/do-search (.. % -target -value)]) 100))
(defn form []
(let [search-term @(subscribe [:search/current-term])]
(fn []
[:form {:on-submit #(.preventDefault %)}
[:div.feld>p.control
[:input.input {:on-change (fn [e]
;; the event might be gone when we the dispatched
;; function is fired, we need to persist it
(.persist e)
(search e))
:default-value search-term
:placeholder "Search"}]]])))
(defn result-cards [items]
[:div.columns.is-multiline.is-mobile
(for [[url item] items]
^{:key url} [:div.column.is-one-fifth-tablet.is-one-third-mobile
[card item
:url-fn (constantly url)
:content [:div>a
{:href url, :title (:name item)}
(:name item)]]])])
(defn- artist-url [artist]
(url-for ::routes/artist.detail (select-keys artist [:id])))
(defn artist-results [{:keys [artist]}]
[result-cards (map (juxt artist-url identity) artist)])
(defn- album-url [album]
(url-for ::routes/album.detail (select-keys album [:id])))
(defn album-results [{:keys [album]}]
[result-cards (map (juxt album-url identity) album)])
(defn song-table-thead []
[:thead
[:td.song-artist "Artist"]
[:td.song-album "Album"]
[:td.song-title "Title"]
[:td.song-duration "Duration"]
[:td.song-actions.is-narrow]])
(defn album-link [{id :albumId :as song}]
[:a {:href (routes/url-for ::routes/album.detail {:id id})} (:album song)])
(defn song-table-tbody [{:keys [songs current-song]}]
[:tbody
(for [[idx song] (map-indexed vector songs)]
^{:key idx}
[(if (= (:id song) (:id current-song)) :tr.is-playing :tr)
[:td.song-artist [collection/artist-link song]]
[:td.song-album [album-link song]]
[:td.song-title [collection/song-link {:songs songs
:song song
:idx idx}]]
[:td.song-duration (h/format-duration (:duration song) :brief? true)]
[:td.song-actions.is-narrow [collection/song-actions song]]])])
(defn song-results [{songs :song}]
[collection/song-table {:songs songs
:thead song-table-thead
:tbody song-table-tbody}])
(defn results [{:keys [search]}]
(let [term @(subscribe [:search/current-term])]
[:section.section>div.container
[:h2.title (str "Search results for \"" term "\"")]
(if (empty? search)
[:p "The server returned no results."]
[:div.content
(when-not (empty? (:artist search))
[:section.section.is-small
[:h3.subtitle.is-5 "Artists"]
[artist-results search]])
(when-not (empty? (:album search))
[:section.section.is-small
[:h3.subtitle.is-5 "Albums"]
[album-results search]])
(when-not (empty? (:song search))
[:section.section.is-small
[:h3.subtitle.is-5 "Songs"]
[song-results search]])])]))

View file

@ -1,98 +0,0 @@
(ns airsonic-ui.components.sortable.views
(:require [reagent.core :as r]
[clojure.string :as str]
["react-sortable-hoc" :refer [SortableHandle SortableElement
SortableContainer]]))
;; this code is taken and adapted from https://github.com/reagent-project/reagent/blob/72c95257c13e5de1531e16d1a06da7686041d3f4/examples/react-sortable-hoc/src/example/core.cljs
(defn make-wrapper [{:keys [container render-item]}]
(let [SortableItem (SortableElement.
(r/reactify-component render-item))]
(SortableContainer.
(r/reactify-component
(fn [{:keys [items]}]
(into container
(for [[idx value] (map-indexed vector items)]
(r/create-element
SortableItem
#js {:key (str "item-" idx)
:index idx
:value value}))))))))
(defn style-map
"Returns a map representing all currently set css styles; this makes sense
so we can save a non-updating version of it."
[node]
(let [style (js/window.getComputedStyle node)]
(into {} (keep (fn [idx]
(let [property (.item style idx)]
[property (.getPropertyValue style property)]))
(range (.-length style))))))
(defn node-seq
"Returns a seq of all of a node's children"
[node]
(loop [waiting [node]
nodes []]
(if-let [node (first waiting)]
(if-let [children (array-seq (.-children node))]
(recur (concat (rest waiting) children) (conj nodes node))
(recur (rest waiting) (conj nodes node)))
(rest nodes))))
(defn style-snapshot
"Recursively grabs the of all of a node's children"
[node]
(into [] (map style-map (node-seq node))))
(defn style-from-map!
"Restores the styling saved in a stylemap"
[style-map node]
(let [style (str/join ";" (map (fn [[k v]] (str k ": " v)) style-map))]
(.setAttribute node "style" style)))
(defn restore-snapshot
"Recursively restores the styling of all of a nodes children"
[style-snapshot node]
(let [nodes (vec (node-seq node))]
(dotimes [i (count nodes)]
(style-from-map! (nth style-snapshot i) (nth nodes i)))))
(defonce saved-snapshot (atom nil))
(defn sortable-component
"This function allows us to generate sortable components in a reusable way.
It takes a prop-map with several keys:
- :container A hiccup-vector that will be used as the container
- :items A seq containing the values we want to render and sort
- :render-item Decides how we render each child; will be passed {:value value}
- :on-sort-end Will be called with a map containing :old-idx & :new-idx
- :helper-class Will be appended to the element that's sorted when it's
appended to the body"
[{:keys [container items render-item on-sort-end helper-class]}]
(let [Wrapper (make-wrapper {:container container
:render-item render-item})]
(r/create-element
Wrapper
#js {:items items
:helperClass helper-class
:axis "y"
:lockAxis "y"
;; save the style of all of the rows children
:updateBeforeSortStart
(fn [event]
(reset! saved-snapshot (style-snapshot (.-node event))))
:onSortStart
(fn [_]
;; the node we get passed as parameter is the original node unfortunately
(restore-snapshot @saved-snapshot (js/document.querySelector "body > :last-child")))
;; update the state to reflect the new order
:onSortEnd
(fn [event]
(on-sort-end {:old-idx (.-oldIndex event)
:new-idx (.-newIndex event)}))
:useDragHandle true})))

View file

@ -1,8 +0,0 @@
(ns airsonic-ui.config)
(def debug?
^boolean goog.DEBUG)
;; how many covers are shown per page when browsing the library
(def albums-per-page 20)
(def albums-prefetch-factor 5)

View file

@ -1,36 +0,0 @@
(ns airsonic-ui.core
(:require [reagent.dom :as rdom]
[re-frame.core :as rf]
;; 3rd party effects / coeffects
[day8.re-frame.http-fx]
[akiroz.re-frame.storage :as storage]
;; our app; namespaces that are just required but not used register
;; event handlers, effect handlers or subscriptions
[airsonic-ui.audio.core]
[airsonic-ui.api.events]
[airsonic-ui.api.subs]
[airsonic-ui.components.audio-player.events]
[airsonic-ui.components.keyboard-shortcuts.events :as keyboard]
[airsonic-ui.components.library.subs]
[airsonic-ui.components.search.events]
[airsonic-ui.components.search.subs]
[airsonic-ui.events :as events]
[airsonic-ui.views :as views]
[airsonic-ui.config :as config]))
(defn dev-setup []
(when config/debug?
(enable-console-print!)
(println "dev mode")))
(defn mount-root []
(rf/clear-subscription-cache!)
(rdom/render [views/main-panel] (.getElementById js/document "app")))
(defn ^:export init []
(storage/reg-co-fx! :airsonic-ui {:fx :store, :cofx :store})
(rf/dispatch-sync [::events/initialize-app])
(rf/dispatch [::keyboard/init-shortcuts])
(dev-setup)
(mount-root))

View file

@ -1,4 +0,0 @@
(ns airsonic-ui.db)
(def default-db
{:notifications (sorted-map)})

View file

@ -1,170 +0,0 @@
(ns airsonic-ui.events
(:require [re-frame.core :as rf]
[ajax.core :as ajax]
[airsonic-ui.routes :as routes]
[airsonic-ui.db :as db]
[airsonic-ui.api.helpers :as api]))
(rf/reg-fx
;; a simple effect to keep println statements out of our event handlers
:log
(fn [params]
(apply println params)))
(defn noop
"An event handler that can be used for clarity; doesn't do anything, but might
give a name to an event"
[cofx _] cofx)
;; ---
;; app boot flow
;; * restoring a previous session
;; * initializing the router
;; * sending out the appropriate requests
;; ---
(defn initialize-app
[{{:keys [credentials]} :store} _]
(let [effects {:db db/default-db
:routes/start-routing nil}]
(if (not (empty? credentials))
(assoc effects :dispatch [:credentials/verify credentials])
effects)))
(rf/reg-event-fx
::initialize-app
[(rf/inject-cofx :store)]
initialize-app)
(defn verify-credentials
"Initializes the whole authentication chain when we have locally stored
credentials that look plausible."
[_ [_ credentials]]
;; TODO: spec this
(if (every? string? ((juxt :u :p :server) credentials))
{:dispatch [:credentials/send-authentication-request credentials]}))
(rf/reg-event-fx :credentials/verify verify-credentials)
;; ---
;; auth logic
;; ---
(defn user-login
"Gets called after the user clicked on the login button"
[{:keys [db]} [_ user pass server]]
(let [credentials {:u user, :p pass, :server server, :verified? false}]
{:db (assoc db :credentials credentials)
:dispatch [:credentials/send-authentication-request credentials]}))
(rf/reg-event-fx :credentials/user-login user-login)
(defn authentication-request
"Tries to authenticate a user by requesting info about the given user, saving
the credentials when the request was successful."
[cofx [_ credentials]]
{:http-xhrio {:method :get
:uri (api/url credentials "getUser" {:username (:u credentials)})
:response-format (ajax/json-response-format {:keywords? true})
:on-success [:credentials/authentication-response credentials]
:on-failure [:api.response/failed]}}) ; <- we don't need endpoint and params here because the response is not cached
(rf/reg-event-fx :credentials/send-authentication-request authentication-request)
(defn authentication-response
"Since we don't get real status codes, we have to look into the server's
response and see whether we actually sent the correct credentials"
[_ [_ credentials response]]
{:dispatch (if (api/is-error? response)
[:credentials/authentication-failure response]
[:credentials/authentication-success credentials response])})
(rf/reg-event-fx :credentials/authentication-response authentication-response)
(defn authentication-failure
"Removes all stored credentials and displays potential api errors to the user"
[{:keys [db store]} [_ response]]
{:dispatch [:notification/show :error (api/error-msg (api/->exception response))]
:store (dissoc store :credentials)
:db (dissoc db :credentials)})
(rf/reg-event-fx :credentials/authentication-failure authentication-failure)
(defn authentication-success
"Gets called after the server indicates that the credentials entered by a user
are correct (see `credentials-verification-request`)"
[{:keys [db]} [_ credentials auth-response]]
{:store {:credentials credentials}
:db (-> (assoc db :credentials (assoc credentials :verified? true))
(assoc :user (api/unwrap-response auth-response)))
:dispatch [::logged-in]})
(rf/reg-event-fx :credentials/authentication-success authentication-success)
(defn logged-in
[cofx _]
(let [redirect (or (get-in cofx [:routes/from-query-param :redirect])
[::routes/library])]
{:dispatch [:routes/do-navigation redirect]}))
(rf/reg-event-fx
::logged-in
[(rf/inject-cofx :routes/from-query-param :redirect)]
logged-in)
(defn logout
"Clears all credentials and redirects the user to the login page"
[cofx [_ & args]]
(let [args (apply hash-map args)]
{:dispatch [:routes/do-navigation (if-let [redirect (:redirect-to args)]
[::routes/login {} {:redirect (routes/encode-route redirect)}]
[::routes/login])]
:store nil
:db db/default-db
:audio/stop nil}))
(rf/reg-event-fx ::logout logout)
;; ---
;; routing
;; ---
(rf/reg-event-fx
:routes/did-navigate
(fn [{:keys [db]} [_ route params query]]
{:db (assoc db :routes/current-route [route params query])
:dispatch-n (routes/route-events route params query)}))
(rf/reg-event-fx
:routes/unauthorized
[(rf/inject-cofx :routes/current-route)]
(fn [{:routes/keys [current-route]} _]
{:dispatch [::logout :redirect-to current-route]}))
;; ---
;; user messages
;; ---
(def notification-duration
{:info 2500
:error 10000})
(defn show-notification
"Displays an informative message to the user"
[{:keys [db]} [_ level message]]
(let [id (.now js/performance)
;; the level argument is optional; if it's not given, it defaults to :info
level' (if (nil? message) :info level)
message' (if (nil? message) level message)]
{:db (assoc-in db [:notifications id] {:level level'
:message message'})
:dispatch-later [{:ms (get notification-duration level)
:dispatch [:notification/hide id]}]}))
(rf/reg-event-fx :notification/show show-notification)
(defn hide-notification
[db [_ notification-id]]
(update db :notifications dissoc notification-id))
(rf/reg-event-db :notification/hide hide-notification)

View file

@ -1,49 +0,0 @@
(ns airsonic-ui.helpers
"Assorted helper functions"
(:require [re-frame.core :as rf]
[clojure.string :as str])
(:import [goog.string format]))
(defn muted-dispatch
"Dispatches a re-frame event while canceling default DOM behavior; to be
called for example in `:on-click`."
[ev & {:keys [sync?]}]
(fn [e]
(.preventDefault e)
(if sync?
(rf/dispatch-sync ev)
(rf/dispatch ev))))
(defn add-classes
"Adds one or more classes to a hiccup keyword"
[elem & classes]
(keyword (apply str (name elem) (->> (filter identity classes)
(map #(str "." (name %)))))))
(defn kebabify
"Turns camelCased strings and keywords into kebab-cased keywords"
[x]
(-> (if (keyword? x) (name x) x)
(str/replace #"([a-z])([A-Z])" (fn [[_ a b]] (str a "-" b)))
(str/lower-case)
(keyword)))
(defn- brief-duration [hours minutes seconds]
(str (when (> hours 0)
(format "%02d:" hours))
(format "%02d:%02d" minutes seconds)))
(defn- long-duration [hours minutes seconds]
(str/trim
(cond-> ""
(> hours 0) (str hours "h ")
(> minutes 0) (str minutes "m ")
(> seconds 0) (str seconds "s"))))
(defn format-duration [seconds & {:keys [brief?]}]
(let [hours (Math/round (quot seconds 3600))
minutes (Math/round (quot (rem seconds 3600) 60))
seconds (Math/round (rem seconds 60))]
(if brief?
(brief-duration hours minutes seconds)
(long-duration hours minutes seconds))))

View file

@ -1,188 +0,0 @@
(ns airsonic-ui.routes
(:require [bide.core :as r]
[cljs.reader :refer [read-string]]
[re-frame.core :as rf]
[airsonic-ui.config :as conf]))
(def default-route ::login)
(defonce router
(r/router [["/" ::login]
["/library" ::library]
["/library/:kind" ::library]
["/artists" ::artist.overview]
["/artists/:id" ::artist.detail]
["/album/:id" ::album.detail]
["/search" ::search]
["/podcast" ::podcast.overview]
["/podcast/:id" ::podcast.detail]
["/current-queue" ::current-queue]
["/about" ::about]]))
;; use this in views to construct a url
(defn url-for
([k] (url-for k {} nil))
([k params] (url-for k params nil))
([k params query] (str "#" (r/resolve router k params query))))
;; which routes need valid login credentials?
(def protected-routes
#{::library ::artist.overview ::artist.detail ::album.detail ::search
::podcast.overview ::podcast.detail})
;; which data should be requested for which route? can either be a vector or a function returning a vector
;; TODO: It's not so nice to have this all so close to the routing logic;
;; it would be nicer to abstract this away, so the components themselves
;; could tell what kind of events they expect
(defmulti -route-events
"Returns the events that take care of correct data being fetched."
(fn [route-id & _] route-id))
(defmethod -route-events :default [route-id params query])
(defmethod -route-events ::library
[route-id {:keys [kind]} {:keys [page] :or {page 1}}]
(if kind
[[:api/request "getScanStatus"]
;; we fetch more than just the albums needed for the current page so we can
;; page through it faster
[:api/request "getAlbumList2" {:type kind
:size (* conf/albums-prefetch-factor conf/albums-per-page)
:offset (* (dec (int page)) conf/albums-per-page)}]]
[:routes/do-navigation [route-id {:kind "recent"} {:page 1}]]))
(defmethod -route-events ::artist.overview
[route-id params query]
[:api/request "getArtists"])
(defmethod -route-events ::artist.detail
[route-id params query]
(let [params (select-keys params [:id])]
[[:api/request "getArtist" params]
[:api/request "getArtistInfo2" params]]))
(defmethod -route-events ::album.detail
[route-id params query]
[:api/request "getAlbum" (select-keys params [:id])])
(defmethod -route-events ::search
[route-id params query]
[[:search/restore-term-from-param (:query query)]
[:api/request "search3" query]])
(defmethod -route-events ::podcast.overview
[route-id params query]
[[:api/request "getPodcasts"]])
(defmethod -route-events ::podcast.detail
[route-id params query]
;; this is identical to ::podcast.overview on purpose
[[:api/request "getPodcasts"]])
;; shouldn't need to change anything below
(defn- n-events?
"Predicate that tells us whether a vector is suitable for :dispatch-n"
[ev-vec]
(or (vector? (first ev-vec))))
(defn route-events
"Returns a normalized list of event vectors for a given route."
[route-id params query]
(let [ev-vec (-route-events route-id params query)]
(if (n-events? ev-vec) ev-vec [ev-vec])))
;; subscription returning the matched route for the current hashbang
(rf/reg-sub :routes/current-route (fn [db _] (:routes/current-route db)))
;; NOTE: There is some duplication here. The route events are provided as a
;; subscription but they are also invoked directly in events.cljs. It didn't
;; seem to justify pulling in a whole library and we need it in our top most view
(rf/reg-sub
:routes/events-for-current-route
(fn [db _] (rf/subscribe [:routes/current-route]))
(fn [current-route _] (apply route-events current-route)))
;; these are helper effects we can use to navigate; the first two manage an atom
;; holding credentials, which is necessary to restrict certain routes, and the
;; last one is used for actual navigation
;; the event to initialize navigation is implemented so the coeffect map is
;; returned unaltered, we just need access to the current app database for
;; authentication, which we get with an interceptor
(defonce ^:private credentials (atom nil))
(def do-navigation
"An interceptor which performs the navigation after looking up current
credentials in the app database"
(re-frame.core/->interceptor
:id :routes/do-navigation
:after (fn do-navigation [context]
(let [[_ & [route]] (get-in context [:coeffects :event])
;; because :routes/do-navigation is both an event handler and
;; an interceptor, we know that when handling the event (see
;; below) the credentials aren't altered anymore
credentials' (get-in context [:coeffects :db :credentials])]
#_(println "calling do-navigation with" route credentials')
(reset! credentials credentials')
(apply r/navigate! router route)
(dissoc context :event)))))
(rf/reg-event-fx :routes/do-navigation do-navigation (fn [& _] nil))
(defn can-access? [route]
(or (not (protected-routes route))
(:verified? @credentials)))
(defn on-navigate
[route-id params query]
#_(println "calling on-navigate with" route credentials')
(if (can-access? route-id)
(rf/dispatch [:routes/did-navigate route-id params query])
(rf/dispatch [:routes/unauthorized route-id params query])))
(defn encode-route
"Takes a parsed route and returns a representation that's suitable for
transportation in a uri component"
[route]
(js/encodeURIComponent (str route)))
(defn decode-route
"Decodes and encoded route from a uri component into a parsed route"
[encoded-route]
(read-string (js/decodeURIComponent encoded-route)))
(defn current-route
"Returns the parsed route for window.location.hash"
[]
(r/match router (subs (.. js/window -location -hash) 1)))
;; add the current route to our coeffect map
(rf/reg-cofx
:routes/current-route
(fn [coeffects _]
(assoc coeffects :routes/current-route (current-route))))
;; add route into from a URL parameter to our coeffect map
(rf/reg-cofx
:routes/from-query-param
(fn [coeffects param]
;; this allows us to encode a complete route in a url fragment; useful for
;; doing redirects
(let [[_ _ query] (current-route)
from-param (some-> (get query param) (decode-route))]
(assoc-in coeffects [:routes/from-query-param param] from-param))))
(defn start-routing!
"Initializes the router and makes sure the correct events get dispatched."
([] (r/start! router {:default default-route
:on-navigate on-navigate}))
([_] (start-routing!))) ;; <- 1-arity is for the re-frame effect exposed below
(rf/reg-fx
:routes/start-routing start-routing!)

View file

@ -1,94 +0,0 @@
(ns airsonic-ui.subs
(:require [re-frame.core :refer [reg-sub subscribe]]
[airsonic-ui.api.helpers :as api]
[airsonic-ui.helpers :refer [kebabify]]
[clojure.string :as str]))
;;
;; app initialization
;;
;; TODO: Computation and extaction is mixed; this could be simpler
(defn- error-notifications [notifications]
(filter (fn [[_ n]]
(= :error (:level n))) notifications))
(defn- no-errors? [db]
(empty? (error-notifications (:notifications db))))
(defn- no-route? [db]
(empty? (:routes/current-route db)))
(defn- no-credentials? [db]
(and (not (empty? (:credentials db)))
(not (get-in db [:credentials :verified?]))))
(defn is-booting?
"The boot process starts with setting up routing and continues if we found
previous credentials and ends when we receive a response from the server."
[db _]
;; so either we don't have any credentials or they are not verified
(and (no-errors? db) (or (no-route? db) (no-credentials? db))))
(reg-sub ::is-booting? is-booting?)
(defn credentials [db _] (:credentials db))
(reg-sub ::credentials credentials)
;; ---
;; user info and roles
;; ---
(defn user-info
"Returns the response to getUser?username=$name; this isn't cached like the
other responses because it's not retrieved via :api/request"
[db _]
(:user db))
(reg-sub :user/info user-info)
(defn user-roles
"Takes only the roles out of a getUser response to make it easier to work with"
[user-info _]
(->>
(filter (fn [[k _]] (re-find #"Role$" (name k))) user-info)
(keep (fn [[role has-role?]]
(when has-role? (str/replace (name role) #"Role$" ""))))
(map kebabify)
(set)))
(reg-sub
:user/roles
:<- [:user/info]
user-roles)
(defn user-role
"Can be used to determine whether a user is allowed to do certain things"
[user-roles [_ role]]
(or (user-roles role) (user-roles :admin)))
(reg-sub
:user/role
:<- [:user/roles]
user-role)
;; ---
;; misc
;; ---
(defn cover-url
"Provides a convenient way for views to get cover images so they don't have
to build them themselves and can live a simple and happy life."
[credentials [_ song size]]
(api/cover-url credentials song size))
(reg-sub
::cover-url
:<- [::credentials]
cover-url)
;; user notifications
(defn notifications [db _] (:notifications db))
(reg-sub ::notifications notifications)

View file

@ -1,144 +0,0 @@
(ns airsonic-ui.views
"This module contains the outmost layer of our app views. It makes sure that
the proper subscriptions are run and arranges the complete layout."
(:require [re-frame.core :refer [dispatch subscribe]]
[reagent.core :as r]
[airsonic-ui.routes :as routes :refer [url-for]]
[airsonic-ui.events :as events]
[airsonic-ui.subs :as subs]
[airsonic-ui.helpers :refer [add-classes]]
[airsonic-ui.views.notifications :refer [notification-list]]
[airsonic-ui.views.breadcrumbs :refer [breadcrumbs]]
[airsonic-ui.views.login :refer [login-form]]
[bulma.icon :refer [icon]]
[airsonic-ui.components.about.views :refer [about]]
[airsonic-ui.components.artist.views :as artist]
[airsonic-ui.components.audio-player.views :refer [audio-player]]
[airsonic-ui.components.bangpow.views :refer [not-found]]
[airsonic-ui.components.collection.views :as collection]
[airsonic-ui.components.current-queue.views :refer [current-queue]]
[airsonic-ui.components.keyboard-shortcuts.views :as keyboard]
[airsonic-ui.components.library.views :as library]
[airsonic-ui.components.podcast.views :as podcast]
[airsonic-ui.components.search.views :as search]))
(def logo-url "./img/airsonic-light-350x100.png")
;; ---
;; top navigation
;; ---
(defonce navbar-active? (r/atom false))
(def toggle-navbar-active! #(swap! navbar-active? not))
(defn navbar-item [{:keys [href]} label]
[:a.navbar-item {:href href :on-click toggle-navbar-active!} label])
(defn navbar-dropdown
([label items] (navbar-dropdown label {} items))
([label label-opts items]
[:div.navbar-item.has-dropdown.is-hoverable
[:div.navbar-link label-opts label]
[:div.navbar-dropdown
(for [[idx [opts label]] (map-indexed vector items)]
^{:key (str "navbar-dropdown-" idx)}
[navbar-item
(merge {:on-click toggle-navbar-active!} opts)
label])]]))
(defn navbar-top
"Contains search, some navigational links and the logo"
[]
(let [user @(subscribe [:user/info])
stream-role @(subscribe [:user/roles :stream])
podcast-role @(subscribe [:user/roles :podcast])
playlist-role @(subscribe [:user/roles :playlist])
share-role @(subscribe [:user/roles :share])
settings-role @(subscribe [:user/roles :settings])]
[:nav.navbar.is-fixed-top.is-dark {:role "navigation", :aria-label "search and navigation"}
;; user is `nil` when we're not logged in, we can hide the extended navigation
[:div.navbar-brand
[:div.navbar-item
[:a {:href (url-for ::routes/library)} [:img {:src logo-url}]]
[:div.navbar-burger.burger {:on-click toggle-navbar-active!}
[:span]
[:span]
[:span]]]]
(when user
[(if @navbar-active? :div.navbar-menu.is-active :div.navbar-menu)
[:div.navbar-start
[:div.navbar-item [search/form]]]
[:div.navbar-end
[:a.navbar-item {:href (url-for ::routes/current-queue)
:title "Current queue"} [:span.heart-beat [icon :audio-spectrum]]]
(when stream-role
[navbar-dropdown "Library"
[[{:href (url-for ::routes/library {:kind "recent"})} "Recently Played"]
[{:href (url-for ::routes/library {:kind "newest"})} "Newest Additions"]
[{:href (url-for ::routes/library {:kind "starred"})} "Starred"]
[{:href (url-for ::routes/artist.overview)} "Artists"]]])
(when podcast-role
#_(let [podcast-url (url-for ::routes/podcast.overview)]
[navbar-dropdown "Podcast" {:href podcast-url}
[[{:href podcast-url} "Overview"]]]))
(when playlist-role
#_[navbar-item {} "Playlists"])
(when share-role
#_[navbar-item {} "Shares"])
[:div.navbar-item.has-dropdown.is-hoverable
[:div.navbar-link "More"]
[:div.navbar-dropdown.is-right
(when settings-role
#_[navbar-item {} "Settings"])
[:a.navbar-item {:href (url-for ::routes/about)} "About"]
[:a.navbar-item
{:on-click (fn [_]
(toggle-navbar-active!)
(dispatch [::events/logout]))
:href "#"}
(str "Logout (" (:username user) ")")]]]]])]))
;; ---
;; this is the section the user mainly interacts with
;; ---
(defn media-content
"Provides the complete UI to browse the media library, interact with search
results etc"
[[route-id :as route]]
(let [content @(subscribe [:api/current-route-data])]
[:div
[:section.section
[breadcrumbs route content]
(case route-id
::routes/library [library/main route content]
::routes/artist.overview [artist/overview route content]
::routes/artist.detail [artist/detail content]
::routes/album.detail [collection/detail content]
::routes/search [search/results content]
::routes/podcast.overview [podcast/overview content]
::routes/podcast.detail [podcast/detail content]
::routes/current-queue [current-queue]
::routes/about [about]
[not-found])]
[audio-player]]))
(defn main-panel
"The outermost wrapper; handles display of the login form if necessary,
makes the code in media-content a bit easier to follow"
[]
(let [notifications @(subscribe [::subs/notifications])
is-booting? @(subscribe [::subs/is-booting?])
[route-id :as route] @(subscribe [:routes/current-route])]
[(add-classes :div route-id)
[notification-list notifications]
[keyboard/help-modal]
(if is-booting?
[:div.app-loading>div.loader]
[:div
[navbar-top]
(case route-id
::routes/login [login-form]
[media-content route])])]))

View file

@ -1,65 +0,0 @@
(ns airsonic-ui.views.breadcrumbs
(:require [re-frame.core :refer [subscribe]]
[airsonic-ui.routes :as routes :refer [url-for]]))
;; Breadcrumbs are implemented in such a way that they provide a stringent
;; hierarchy no matter how you came to the url. They should allow easy
;; navigation upwards that hierarchy (e.g. album -> artist)
(defn- bulma-breadcrumbs [& items]
(let [content-pending? @(subscribe [:api/content-pending?])]
[:div.container
[:nav.breadcrumb {:aria-label "breadcrumbs"}
[:ul
(for [[idx [href label]] (map-indexed vector (butlast items))]
[:li {:key idx} [:a {:href href} label]])
[:li.is-active>a (last items)
(when content-pending? [:span.loader])]]]]))
(defmulti breadcrumbs
;; the first parameter is always the current route, the second parameter is
;; whatever the subscriptions return as the current content (e.g. album title)
(fn dispatch-on [[route-id] _] route-id))
(defmethod breadcrumbs :default [_ _]
[bulma-breadcrumbs "Airsonic"])
(defmethod breadcrumbs ::routes/library [[_ params] _]
[bulma-breadcrumbs
[(url-for ::routes/library {:kind "recent"}) "Library"]
(case (:kind params)
"recent" "Recently Played"
"newest" "Newest Additions"
"starred" "Starred"
"…")])
(defmethod breadcrumbs ::routes/artist.overview [_ _]
[bulma-breadcrumbs
[(url-for ::routes/library {:kind "recent"}) "Library"]
"Artists"])
(defmethod breadcrumbs ::routes/artist.detail [_ {:keys [artist]}]
[bulma-breadcrumbs
[(url-for ::routes/library {:kind "recent"}) "Library"]
[(url-for ::routes/artist.overview) "Artists"]
(:name artist)])
(defmethod breadcrumbs ::routes/album.detail [_ {:keys [album]}]
[bulma-breadcrumbs
[(url-for ::routes/library {:kind "recent"}) "Library"]
[(url-for ::routes/artist.overview) "Artists"]
[(url-for ::routes/artist.detail {:id (:artistId album)}) (:artist album)]
(:name album)])
(defmethod breadcrumbs ::routes/search [_ _]
[bulma-breadcrumbs "Search"])
(defmethod breadcrumbs ::routes/podcast.overview [_ _]
;; TODO: Detail view
[bulma-breadcrumbs "Podcasts"])
(defmethod breadcrumbs ::routes/current-queue [_ _]
[bulma-breadcrumbs "Current Queue"])
(defmethod breadcrumbs ::routes/about [_ _]
[bulma-breadcrumbs "About"])

View file

@ -1,48 +0,0 @@
(ns airsonic-ui.views.cover
(:require [re-frame.core :refer [subscribe]]
[airsonic-ui.subs :as subs]
["@hugojosefson/color-hash" :as ColorHash]))
(def color-hash (ColorHash.))
(defn hsl->css [h s l]
(str "hsl(" h "," (* 100 s) "%," (* 100 l) "%)"))
(defn palette
"Generate a unique hsl palette of two colors"
[identifier]
(let [[h s l] (js->clj (.hsl color-hash identifier))]
[(hsl->css h s l)
(hsl->css (mod (+ h (* h 0.3) 10) 360) s l)]))
(defn missing-cover
[item size]
(let [identifier (str (:artistId item) "-" (or (:albumId item) (:id item)))
[color-a color-b] (palette identifier)]
[:svg.missing-cover {:viewBox "0 0 256 256"
:xmlns "http://www.w3.org/2000/svg"}
[:defs [:linearGradient {:id (str "cover-gradient-" identifier)
:x1 0, :y1 0,
:x2 1, :y2 1}
[:stop {:offset "2%", :stop-color color-a}]
[:stop {:offset "98%", :stop-color color-b}]]]
[:rect {:x 0, :y 0, :width 256, :height 256
:fill (str "url(#cover-gradient-" identifier ")")}]]))
(defn has-cover? [item]
(some? (:coverArt item)))
(defn cover
[item size]
(let [original @(subscribe [::subs/cover-url item size])
retina @(subscribe [::subs/cover-url item (* 2 size)])]
[:figure {:class (str "image is-" size "x" size)}
(if (has-cover? item)
[:img {:src original
:srcSet (str original ", " retina " 2x")}]
[missing-cover item size])]))
(defn card [item & {:keys [url-fn content size] :or {size 256}}]
[:article.card.preview-card
[:div.card-image [:a {:href (url-fn item)} [cover item size]]]
[:div.card-content content]])

View file

@ -1,42 +0,0 @@
(ns airsonic-ui.views.login
(:require [reagent.core :as r]
[re-frame.core :refer [dispatch]]
[airsonic-ui.events :as events]))
(defn- >reset!
"Sends an event's target values to the given atom"
[atom]
#(reset! atom (.. % -target -value)))
;; login form
(defn login-form []
(let [user (r/atom "")
pass (r/atom "")
server (r/atom (.. js/window -location -origin))
submit (fn [e]
(.preventDefault e)
(dispatch [:credentials/user-login @user @pass @server]))]
(fn []
[:section.hero.is-fullheight>div.hero-body
[:div.container.has-text-centered>div.column.is-4.is-offset-4
[:h3.title.has-text-grey "Airsonic"]
[:p.subtitle.has-text-grey "Please login to proceed"]
[:div.box
[:form {:on-submit submit}
[:div.field>div.control
[:input.input.is-large {:type "text"
:name "user"
:placeholder "Username"
:on-change (>reset! user)}]]
[:div.field>div.control
[:input.input.is-large {:type "password"
:name "pass"
:placeholder "Password"
:on-change (>reset! pass)}]]
[:div.field>div.control
[:input.input.is-large {:type "text"
:name "server"
:on-change (>reset! server)
:value @server}]]
[:button.button.is-block.is-info.is-large.is-fullwidth {:type "submit"} "Submit"]]]]])))

View file

@ -1,14 +0,0 @@
(ns airsonic-ui.views.notifications
(:require [re-frame.core :refer [dispatch]]))
;; user notifications
(defn notification-list [notifications]
[:div.notifications
(for [[id notification] notifications]
(let [class (case (:level notification)
:error "danger"
"info")]
^{:key id} [:div {:class (str "notification is-small is-" class)}
[:button.delete {:on-click #(dispatch [:notification/hide id])}]
(:message notification)]))])

View file

@ -1,20 +0,0 @@
(ns bulma.dropdown.events
(:require [re-frame.core :as rf]))
(defn show-dropdown [db [_ dropdown-id]]
(assoc-in db [:bulma :visible-dropdown] dropdown-id))
(rf/reg-event-db ::show show-dropdown)
(defn hide-dropdown [db _]
(update db :bulma dissoc :visible-dropdown))
(rf/reg-event-db ::hide hide-dropdown)
(defn toggle-dropdown [db [_ dropdown-id]]
(let [visible-dropdown (get-in db [:bulma :visible-dropdown])]
(if (= visible-dropdown dropdown-id)
(hide-dropdown db [::hide])
(show-dropdown db [::show dropdown-id]))))
(rf/reg-event-db ::toggle toggle-dropdown)

View file

@ -1,22 +0,0 @@
(ns bulma.dropdown.subs
(:require [re-frame.core :as rf]))
;; NOTE: This is almost the same as bulma.modal.subs
;; Maybe we can provide some abstraction that covers both, but maybe we shouldn't
(defn visible-dropdown
"Gives us the ID of the currently visible dropdown"
[db _]
(get-in db [:bulma :visible-dropdown]))
(rf/reg-sub ::visible-dropdown visible-dropdown)
(defn visible?
"Predicate to check the visibility of a single modal"
[visible-dropdown [_ dropdown-id]]
(= visible-dropdown dropdown-id))
(rf/reg-sub
::visible?
:<- [::visible-dropdown]
visible?)

View file

@ -1,43 +0,0 @@
(ns bulma.dropdown.views
(:require [re-frame.core :refer [dispatch subscribe]]
[reagent.core :as r]
[bulma.icon :refer [icon]]
[bulma.dropdown.events :as ev]
[bulma.dropdown.subs :as sub]))
(defn choose-action [event-vector]
(fn [e]
(.preventDefault e)
(dispatch [::ev/hide])
(dispatch event-vector)))
(defn generate-id []
(str "bulma-dropdown-" (random-uuid)))
(defn click-overlay
[]
[:div {:style {:position "fixed"
:z-index 19 ;; <- 20 is the z-index of .dropdown-menu
:top 0
:left 0
:bottom 0
:right 0}
:on-click #(dispatch [::ev/hide])}])
(defn dropdown [{:keys [items]}]
(let [dropdown-id (generate-id)]
(fn []
(let [visible? @(subscribe [::sub/visible? dropdown-id])]
[(if visible? :div.dropdown.is-right.is-active :div.dropdown.is-right)
(when visible? [click-overlay])
[:div.dropdown-trigger
[:span.is-small.button {:aria-haspopup "true"
:aria-controls dropdown-id
:on-click #(dispatch [::ev/toggle dropdown-id])}
[icon :ellipses]]]
[:div.dropdown-menu {:id dropdown-id, :role "menu"}
[:div.dropdown-content
(for [[idx {:keys [label event]}] (map-indexed vector items)]
^{:key (str dropdown-id "-" idx)}
[:a.dropdown-item {:href "#"
:on-click (choose-action event)} label])]]]))))

View file

@ -1,4 +0,0 @@
(ns bulma.icon)
(defn icon [glyph]
[:span.icon [:span.oi {:data-glyph (name glyph)}]])

View file

@ -1,20 +0,0 @@
(ns bulma.modal.events
(:require [re-frame.core :as rf]))
(defn show-modal [db [_ modal-id]]
(assoc-in db [:bulma :visible-modal] modal-id))
(rf/reg-event-db ::show show-modal)
(defn hide-modal [db _]
(update db :bulma dissoc :visible-modal))
(rf/reg-event-db ::hide hide-modal)
(defn toggle-modal [db [_ modal-id]]
(let [visible-modal (get-in db [:bulma :visible-modal])]
(if (= visible-modal modal-id)
(hide-modal db [::hide])
(show-modal db [::show modal-id]))))
(rf/reg-event-db ::toggle toggle-modal)

View file

@ -1,19 +0,0 @@
(ns bulma.modal.subs
(:require [re-frame.core :as rf]))
(defn visible-modal
"Gives us the ID of the currently visible modal"
[db _]
(get-in db [:bulma :visible-modal]))
(rf/reg-sub ::visible-modal visible-modal)
(defn visible?
"Predicate to check the visibility of a single modal"
[visible-modal [_ modal-id]]
(= visible-modal modal-id))
(rf/reg-sub
::visible?
:<- [::visible-modal]
visible?)

View file

@ -1,47 +0,0 @@
(ns bulma.modal.views
(:require [re-frame.core :as rf]
[bulma.modal.events :as ev]
[bulma.modal.subs :as sub]))
(defn hide-modal [_]
(rf/dispatch [::ev/hide]))
(defn modal
"Generic modal; arguments:
options:
{:has-hide-button? boolean
:modal-id :some-identifier}
& children"
[{:keys [has-hide-button? modal-id]} & children]
{:pre [(some? modal-id)]}
(let [visible? @(rf/subscribe [::sub/visible? modal-id])
modal-tag (if visible? :div.modal.is-active :div.modal)]
[modal-tag
[:div.modal-background {:on-click hide-modal}]
(into [:div.modal-content] children)
(when has-hide-button?
[:button.modal-hide.is-large {:aria-label "hide"
:on-click hide-modal}])]))
(defn modal-card
"A card modal that renders content on a background. Arguments:
options:
{:title \"Title of the card\"
:foot [[:div \"An array of hiccup elements\"]]
:modal-id :some-identifier}
& children"
[{:keys [title foot modal-id]} & children]
[modal {:has-hide-button? (not (some? title))
:modal-id modal-id}
(when title
[:div.modal-card-head
[:p.modal-card-title title]
[:button.delete {:aria-label "hide"
:on-click hide-modal}]])
(into [:section.modal-card-body] children)
(when foot
(into [:div.modal-card-foot] foot))])

View file

@ -1,8 +0,0 @@
(ns bulma.tabs)
(defn tabs [{:keys [items]}]
[:div.tabs.is-boxed
[:ul
(for [[idx {:keys [href label active?]}] (map-indexed vector items)]
^{:key idx} [:li (when active? {:class "is-active"})
[:a {:href href} label]])]])

View file

@ -1,377 +0,0 @@
@import "../../node_modules/bulma/bulma"
@import "../../node_modules/open-iconic/font/css/open-iconic.scss"
// area holding content & side navi
#app
main
margin-bottom: 0
// big loading spinner
.app-loading
display: flex
justify-content: center
align-items: center
height: 100vh
font-size: 4.8rem
color: $grey-light
.loader
+loader
// small loading indicator at top of content
.breadcrumb
.loader
margin-left: .5em
// bottom bar
.has-navbar-fixed-bottom
padding-bottom: 64px
.audio-player
+navbar-fixed
bottom: 0
// first clear some of that navigation styling
background-color: $dark
color: $dark-invert
min-height: 64px
display: flex
align-items: center
// now off to the contents
// when no song is playing
.idle-notification
color: inherit
// ... or with all the bells and whistles
.audio-interaction
display: flex
flex-grow: 1
align-items: center
.playback-info
// shows cover and current track
align-items: center
flex-grow: 1
flex-basis: 25%
color: inherit
.media-left
margin-right: .6rem
.artist-and-title
margin-right: .6rem
.artist,
.song-title
display: block
white-space: nowrap
width: 100%
max-width: 100%
overflow: hidden
text-overflow: ellipsis
.progress-indicators
// hide progress bar on mobile
display: none
+tablet
display: flex
flex-basis: 75%
height: 1rem
.progress-info-text
color: $dark-invert
font-size: $size-7
flex-shrink: 0
flex-grow: 0
svg
overflow: visible
.progress-bars
margin-left: .6rem
margin-right: .6rem
position: relative
flex-grow: 1
.complete-song-bar,
.buffered-part-bar,
.played-back-bar
height: 1rem
.complete-song-bar
width: 100%
rect
fill: rgb(93,93,93)
.buffered-part-bar
rect
fill: rgb(143,143,143)
.click-dummy
cursor: pointer
fill: transparent
.played-back-bar
pointer-events: none
circle,
rect
fill: $dark-invert
// buttons to control current playback and playlist behavior
.button-controls
position: relative
flex-shrink: 0
padding-right: .6rem
&:first-of-type
padding-left: .6rem
.button-menu
svg.volume-bar
overflow: visible
.inactive
fill: $background
.active
fill: $link
.click-dummy
cursor: pointer
fill: transparent
.button-menu-closer
// this element is needed so we can have a "click-outside"
position: fixed
z-index: -1
top: 0
left: 0
right: 0
bottom: 0
.button-menu
position: absolute
z-index: 100
width: 36px
bottom: calc(100% + .3em)
padding: $button-padding-horizontal $button-padding-horizontal / 2
border-radius: $radius
background: $white
color: $dark
box-shadow: 0 0 2px rgba(0,0,0,.1), 0 0 4px rgba(0,0,0,.1)
// little arrow at the bottom
&::after
position: absolute
content: ''
display: block
width: 6px
height: 6px
background: inherit
top: 100%
left: 50%
margin-left: -3px
margin-top: -3px
transform: rotate(45deg)
box-shadow: 2px 2px 1px rgba(0,0,0,.1)
// preview card for album or artist listings
.preview-card
.card-content > div,
.title,
.subtitle
overflow: hidden
white-space: nowrap
text-overflow: ellipsis
.image.is-256x256
width: auto
height: auto
max-width: 256px
max-height: 256px
margin: 0
.image
.missing-cover
display: block
max-width: 100%
&.is-48x48 .missing-cover
width: 48px
height: auto
&.is-128x128 .missing-cover
width: 128px
height: auto
&.is-256x256 .missing-cover
width: 256px
height: auto
// occurs in album detail view
.table
.grow
width: 100%
// useful in general to pull elements closer together; bulma es very generous
// with whitespace
.section
// $section-padding: 3rem 1.5rem
&.is-small
padding: 1.5rem 1.5rem
&.is-tiny
padding: 0.75rem 1.5rem
// tab bar on top
&.ui-tab-bar
padding-bottom: 0.75rem
// occurs on many pages at the top to show details
.hero
&.is-small + .section
padding: 1.5rem 1.5rem
&.is-tiny + .section
padding: 0.75rem 1.5rem
.media-content
align-self: center
// modifies our headlines to be next to each other
+tablet
&.single-line .container
display: flex
align-items: baseline
.title
flex-grow: 1
margin-bottom: 0
// floating notifications
.notifications:not(:empty)
@extend .container
z-index: 100
position: fixed
left: 0
right: 0
padding-top: 3.2rem
// route specific styling
.search
.content .section
padding: 1.5rem 0
.preview-card
.card-content
padding: 0.375rem 0.75rem 0.75rem
.missing-cover
display: inline-block
.artist.overview
.alphabetical-list
column-count: 2
column-gap: 1.2rem
ol
list-style: none
+tablet
column-count: 3
+widescreen
column-count: 4
.group
margin-bottom: 1.5rem
.subtitle.is-4
margin-bottom: 1rem
.album.detail
.collection-header
display: block
.media-left
margin-right: 0
margin-bottom: 1rem
+tablet
display: flex
.media-left
margin-right: 1rem
margin-bottom: 0
.song-list
counter-reset: track
tbody
tr
counter-increment: track
td:first-child > div::before
color: $grey-light
content: counter(track)
font-weight: normal
display: inline
padding-right: 0.375rem
.collection-info
list-style: none
li
display: inline-block
margin-left: 0.75rem
&:first-child
margin-left: 0
.song-listing-table
tr.is-playing
background-color: $table-row-active-background-color
color: $table-row-active-color
a, strong, td.song-duration, td.sort-handle span
color: currentColor
span.button, div.dropdown
color: $table-color
td
&.is-narrow
white-space: nowrap
&.song-duration
text-align: right
&.sortable-handle
-webkit-touch-callout: none
user-select: none
tbody .song-duration
color: $grey-light
tr:hover
.button
// drag'n'drop
.sortable-handle
span
cursor: grabbing
user-select: none
tr.sortable-is-moving.is-playing
background-color: $table-row-active-background-color
color: $table-row-active-color
a, strong, td.song-duration, td.sort-handle span
color: currentColor
// Navigation fixes
.navbar-brand > .navbar-item > a
display: flex
align-items: center

View file

@ -1,50 +0,0 @@
(ns airsonic-ui.api.events-test
(:require [cljs.test :refer-macros [deftest testing is]]
[airsonic-ui.api.events :as events]
[airsonic-ui.fixtures :as fixtures]))
(enable-console-print!)
(deftest api-failure-notifcations
(testing "Should show an error notification when airsonic responds with an error"
(let [fx (events/api-success {} [:api.response/ok "ping" nil (:error fixtures/responses)])
ev (:dispatch fx)]
(is (= :notification/show (first ev)))
(is (= :error (second ev))))))
(deftest cached-api-requests
(letfn [(cache [fx [endpoint params]]
(get-in fx [:db :api/responses [endpoint params]]))]
(testing "Should be cached"
(testing "when the response was successful"
(let [endpoint "getScanStatus"
successful (events/api-success {} [:api.response/ok endpoint nil (:ok fixtures/responses)])
unsuccessful (events/api-success {} [:api.response/ok endpoint nil (:error fixtures/responses)])]
(is (map? (cache successful [endpoint])))
(is (nil? (cache unsuccessful [endpoint])))))
(testing "in an unwrapped format"
(let [endpoint "getScanStatus"
fx (events/api-success {} [:api.response/ok endpoint nil (:ok fixtures/responses)])]
(is (= #{:count :scanning} (set (keys (cache fx [endpoint]))))))))
(testing "When being issued"
(let [endpoint "getScanStatus"
fx (events/api-request {:db {:credentials (select-keys fixtures/credentials [:server])}}
[:api/request endpoint])]
(testing "should send an http request"
(is (contains? fx :http-xhrio)))
(testing "should indicate that a request is ongoing"
(is (true? (:api/is-loading? (cache fx [endpoint]))) "for non-cached responses")
(is (true? (-> (events/api-success fx [:api.response/ok endpoint nil (:ok fixtures/responses)])
(events/api-request [:api/request endpoint])
(cache [endpoint])
:api/is-loading?)) "for cached responses"))
(testing "should remove the indication that a request is ongoing when there is a response"
(is (not (:api/is-loading? (-> (events/api-success fx [:api.response/ok endpoint nil (:ok fixtures/responses)])
(cache [endpoint])))) "for a good response")
(is (not (:api/is-loading? (-> (merge fx (events/api-success fx [:api.response/ok endpoint nil (:error fixtures/responses)]))
(cache [endpoint])))) "when an error is returned")
(is (not (:api/is-loading? (-> (merge fx (events/api-failure fx [:api.response/failed endpoint]))
(cache [endpoint])))) "when communication with the server failed"))))
(testing "Should be able to avoid the cache"
;; FIXME: Implement this
)))

View file

@ -1,87 +0,0 @@
(ns airsonic-ui.api.helpers-test
(:require [cljs.test :refer [deftest testing is]]
[clojure.string :as str]
[airsonic-ui.fixtures :as fixtures :refer [responses]]
[airsonic-ui.api.helpers :as api]))
(defn- url
"Construct a url with no params"
[server endpoint]
(api/url server endpoint {}))
(def fixtures
{:default-url (url {:server "http://localhost:8080"} "ping")})
(deftest general-url-construction
(testing "Handles missing slashes"
(is (true? (str/starts-with? (url {:server "http://localhost:8080"} "ping") "http://localhost:8080/rest/ping")))
(is (true? (str/starts-with? (url {:server "http://localhost:8080/"} "ping") "http://localhost:8080/rest/ping"))))
(testing "Should set correct default parameters"
(is (string? (re-find #"f=json" (fixtures :default-url))))
(is (string? (re-find #"v=1\.15\.0" (fixtures :default-url))))))
(deftest parameter-encoding
(testing "Should escape url parameters"
(let [query "äöüß"
encoded-str (js/encodeURIComponent query)]
(is (str/includes? (api/url {:server "http://localhost"} "search3" {:query query}) encoded-str)))))
(deftest variadic-parameters
(testing "Should append list-like parameters correctly"
(is (= (count (re-seq #"id=" (api/url {:server "http://localost"} "test" {:id []}))) 0))
(is (= (count (re-seq #"id=" (api/url {:server "http://localost"} "test" {:id [1]}))) 1))
(is (= (count (re-seq #"id=" (api/url {:server "http://localost"} "test" {:id (range 10)}))) 10)))
(testing "Should keep the non-lists"
(let [mixed (api/url {:server "http://localost"} "test" {:id (range 5) :foo "bar"})]
(is (some? (re-find #"u=user" (api/url {:server "http://localhost"} "test" {:u "user"}))))
(is (and (some? (re-find #"foo=bar" mixed))
(= (count (re-seq #"id=" mixed)) 5))))))
(deftest stream-urls
(testing "Should construct the url based on a song's id"
(let [stream-url (api/stream-url {:server "http://localhost"} fixtures/song)]
(is (str/includes? stream-url (str "id=" (:id fixtures/song))))))
(testing "Should also work for podcasts"
(let [stream-url (api/stream-url {:server "http://localhost"} fixtures/podcast-episode)]
(is (str/includes? stream-url (str "id=" (:streamId fixtures/podcast-episode)))))))
(deftest cover-urls
(let [album {:coverArt "cover-99999"}]
(testing "Should construct the url based on an item's cover-id"
(is (true? (str/includes? (api/cover-url {:server "http://server.tld"} album -1) (str "id=" (:coverArt album))))))
(testing "Should scale an image to a given size"
(is (true? (str/includes? (api/cover-url {:server "http://server.tld"} album 48) "size=48"))))))
(deftest response-handling
(testing "Should unwrap responses"
(let [response (:ok responses)]
(is (= (get-in response [:subsonic-response :scanStatus])
(api/unwrap-response response)))))
(testing "Should detect errors"
(is (true? (api/is-error? (:error responses))))
(is (false? (api/is-error? (:ok responses)))))
(testing "Should throw an informative error when trying to unwrap an erroneous response"
(let [error-response (:error responses)]
(is (thrown? ExceptionInfo (api/unwrap-response error-response)))
(try
(api/unwrap-response error-response)
(catch ExceptionInfo e
(is (= (get-in error-response [:subsonic-response :error]) (ex-data e))))))))
(deftest error-recognition
(testing "Should detect error responses"
(is (true? (api/is-error? (:error responses))))
(is (true? (api/is-error? (:auth-failure responses)))))
(testing "Should pass on good responses"
(is (false? (api/is-error? (:ok responses))))
(is (false? (api/is-error? (:ping-success responses))))))
(deftest content-type
(testing "Should detect whether the data we look at represents a song"
(is (= :content-type/song (api/content-type fixtures/song))))
(testing "Should detect whether the data we look at represents an artist"
(is (= :content-type/artist (api/content-type fixtures/artist)))
(is (= :content-type/artist (api/content-type (dissoc fixtures/artist :coverArt)))))
(testing "Should detect whether the data we look at represents an album"
(is (= :content-type/album (api/content-type fixtures/album)))
(is (= :content-type/album (api/content-type (dissoc fixtures/album :coverArt))))))

View file

@ -1,61 +0,0 @@
(ns airsonic-ui.api.subs-test
(:require [cljs.test :refer-macros [deftest testing is]]
[airsonic-ui.api.subs :as sub]))
(enable-console-print!)
(deftest single-response
(testing "Should return the response for a specified endpoint"
(let [responses (sub/responses {:api/responses {["search2" {:query "query term"}] :result}} [:api/responses])]
(is (= :result (sub/response-for responses [:api/response-for "search2" {:query "query term"}])))
(is (nil? (sub/response-for responses [:api/response-for "search2" {:query "another query term"}]))))))
(deftest responses-for-endpoint
(testing "Should concatenate all responses for an endpoint"
(let [responses {["search2" {:query "query term"}] :result1
["something-else" nil] :ignored-result
["search2" {:query "another query term"}] :result2}]
(is (= (dissoc responses ["something-else" nil])
(sub/responses-for-endpoint responses [:api/responses-for-endpoint "search2"]))))))
(deftest endpoint-keywordification
(testing "Should strip prefixes"
(is (= :artist-info (sub/endpoint->kw "getArtistInfo")))
(is (= :jukebox-control (sub/endpoint->kw "jukeboxControl"))))
(testing "Should strip trailing numbers"
(is (= :album-list (sub/endpoint->kw "getAlbumList2")))
(is (= :search (sub/endpoint->kw "search3")))))
(def responses {["getAlbumList2" {:type "recent" :size 18}]
{:album [{:genre "foo", :artistId "12345"}
{:genre "electronic", :artistId "9999"}]}
["getArtistInfo" {:id "128"}]
{:biography "Interesting bio"
:largeImageUrl "https://lastfm-img2.akamaized.net/i/u/300x300/fb416b59cd694587aca0b2dec8f41198.png"}})
(deftest responses-for-route
(testing "Should return all cached responses for a route"
(let [current-route-events [[:api/request "getAlbumList2" {:type "recent", :size 18}]
[:event/should-be-ignored]
[:api/request "getArtistInfo" {:id "128"}]]]
(is (= {:album-list (get responses ["getAlbumList2" {:type "recent" :size 18}])
:artist-info (get responses ["getArtistInfo" {:id "128"}])}
(sub/current-route-data [responses current-route-events]
[:api/current-route-data]))))))
(deftest content-pending
(testing "Should indicate if there are outstanding requests for the current route"
(let [current-route-events [[:api/request "getAlbumList2" {:type "recent", :size 18}]
[:event/should-be-ignored]
[:api/request "getArtistInfo" {:id "128"}]]
done responses
in-progress (assoc-in responses
[["getAlbumList2" {:type "recent" :size 18}] :api/is-loading?]
true)]
(is (true? (-> (sub/current-route-data [in-progress current-route-events]
[:api/current-route-data])
(sub/content-pending? [:api/content-pending?]))))
(is (not (true? (-> (sub/current-route-data [done current-route-events]
[:api/current-route-data])
(sub/content-pending? [:api/content-pending?]))))))))

View file

@ -1,26 +0,0 @@
(ns airsonic-ui.audio.core-test
(:require [airsonic-ui.audio.core :as audio]
#_[airsonic-ui.audio.playlist-test :as p]
#_[airsonic-ui.fixtures :as fixtures]
[cljs.test :refer [deftest testing is]]))
(enable-console-print!)
(deftest current-song-subscription
;; NOTE: Should the subscription be moved to the playlist.cljs?
#_(testing "Should provide information about the song"
(letfn [(current-song [db]
(-> (audio/summary db [:audio/summary])
(audio/current-song [:audio/current-song])))]
(= fixtures/song (current-song p/fixture))))
(testing "Should work fine when no song is playing"
(is (nil? (audio/current-song nil [:audio/current-song])))))
(deftest playback-status-subscription
(letfn [(is-playing? [playback-status]
(audio/is-playing? playback-status [:audio/is-playing?]))]
(testing "Should be shown as not playing when the song is paused or has ended"
(is (not (is-playing? {:paused? true, :ended? false})))
(is (not (is-playing? {:paused? false, :ended? true}))))
(testing "Should be shown as playing when the song is not paused or finished"
(is (is-playing? {:paused? false, :ended? false})))))

View file

@ -1,341 +0,0 @@
(ns airsonic-ui.audio.playlist-test
(:require [cljs.test :refer [deftest testing is]]
[airsonic-ui.audio.playlist :as playlist]
[airsonic-ui.fixtures :as fixtures]
[airsonic-ui.test-helpers :refer [song song-queue]]
#_[debux.cs.core :refer-macros [dbg]]))
(enable-console-print!)
(def fixture
{:audio {:current-song fixtures/song
:playlist (song-queue 20)
:playback-status fixtures/playback-status}})
(defn- same-song? [a b] (= (:id a) (:id b)))
(deftest playlist-creation
(testing "Playlist creation"
(testing "should give us the correct current song for linear playback-mode"
(let [queue (song-queue 10)]
(doseq [repeat-mode [:repeat-none :repeat-single :repeat-all]]
(is (same-song? (first queue)
(-> (playlist/->playlist queue :playback-mode :linear :repeat-mode repeat-mode)
(playlist/current-song)))
(str "repeat-mode: " repeat-mode)))))
(testing "any current song for shuffled playback mode"
(let [queue (song-queue 10)]
(doseq [repeat-mode [:repeat-none :repeat-single :repeat-all]]
(is (some? ((set queue)
(-> (playlist/->playlist queue :playback-mode :linear :repeat-mode repeat-mode)
(playlist/current-song))))
(str "repeat-mode: " repeat-mode)))))
(testing "should give us a playlist with the correct number of tracks"
(let [queue (song-queue 100)]
(doseq [playback-mode [:linear :shuffled]
repeat-mode [:repeat-none :repeat-single :repeat-all]]
(is (= (count queue)
(count (playlist/->playlist queue :playback-mode playback-mode :repeat-mode repeat-mode)))
(str playback-mode ", " repeat-mode)))))))
(deftest changing-playback-mode
(testing "Changing playback mode"
(testing "from linear to shuffled"
(let [queue (song-queue 10)
linear (playlist/->playlist queue :playback-mode :linear :repeat-mode :repeat-none)
shuffled (playlist/set-playback-mode linear :shuffled)]
(testing "should indicate the new playback mode"
(is (= :linear (:playback-mode linear)))
(is (= :shuffled (:playback-mode shuffled))))
(testing "should re-order the tracks"
(is (not= (:items shuffled) (:items linear))))
(testing "should not change the currently playing track"
(is (same-song? (playlist/current-song linear) (playlist/current-song shuffled))))
(testing "should not change the repeat mode"
(is (= (:repeat-mode shuffled) (:repeat-mode linear))))))
(testing "from shuffled to linear"
(let [queue (song-queue 10)
shuffled (playlist/->playlist queue :playback-mode :shuffled :repeat-mode :repeat-none)
linear (playlist/set-playback-mode shuffled :linear)]
(testing "should indicate the new playback mode"
(is (= :linear (:playback-mode linear)))
(is (= :shuffled (:playback-mode shuffled))))
(testing "should set the correct order for tracks"
(let [linear-order (comp :playlist/linear-order meta)]
(is (every? #(apply same-song? %) (interleave queue (vals (:items linear)))))
;; every song should have a smaller order than its successor
(is (->> (map linear-order (vals (:items linear)))
(partition 2 1)
(every? (fn [[a b]] (< a b)))))))
(testing "should not change the currently playing track"
(is (same-song? (playlist/current-song linear) (playlist/current-song shuffled))))
(testing "should not change the repeat mode"
(is (= (:repeat-mode shuffled) (:repeat-mode linear))))))))
(deftest changing-repeat-mode
(testing "Changing the repeat mode"
(testing "should not change the playback mode"
(doseq [playback-mode '(:linear :shuffled)
repeat-mode '(:repeat-none :repeat-single :repeat-all)
next-repeat-mode '(:repeat-none :repeat-single :repeat-all)]
(let [playlist (-> (playlist/->playlist (song-queue 1) :playback-mode playback-mode :repeat-mode repeat-mode)
(playlist/set-repeat-mode next-repeat-mode))]
(is (= playback-mode (:playback-mode playlist)))
(is (= next-repeat-mode (:repeat-mode playlist))
(str "from " repeat-mode " to " next-repeat-mode)))))))
(deftest linear-next-song
(testing "Should follow the same order as the queue used for creation"
(doseq [repeat-mode [:repeat-none :repeat-all]]
(let [queue (song-queue 5)
playlist (playlist/->playlist queue :playback-mode :linear :repeat-mode repeat-mode)]
(is (same-song? (nth queue 1) (-> (playlist/next-song playlist)
(playlist/current-song)))
(str repeat-mode ", skipped once"))
(is (same-song? (nth queue 2) (-> (playlist/next-song playlist)
(playlist/next-song)
(playlist/current-song)))
(str repeat-mode ", skipped twice")))))
;; TODO: Write this test
(testing "Should go back to the first song when repeat-mode is all and we played the last song")
(testing "Should always give the same track when repeat-mode is single"
(let [queue (song-queue 3)
playlist (playlist/->playlist queue :playback-mode :linear :repeat-mode :repeat-single)
played-back (map playlist/current-song (iterate playlist/next-song playlist))]
(is (same-song? (first queue) (nth played-back 0)))
(is (same-song? (first queue) (nth played-back 1)))
(is (same-song? (first queue) (nth played-back 2)))
(is (same-song? (first queue) (nth played-back 3)) "wrapping around")))
(testing "Should stop playing at the end of the queue when repeat-mode is none"
(is (nil? (-> (song-queue 1)
(playlist/->playlist :playback-mode :linear :repeat-mode :repeat-none)
(playlist/next-song)
(playlist/current-song))))))
(deftest shuffled-next-song
(testing "Should play every track once when called for the entire queue"
(doseq [repeat-mode '(:repeat-none :repeat-all)]
(let [length 10
playlist (playlist/->playlist (song-queue length) :playback-mode :shuffled :repeat-mode repeat-mode)
played-tracks (->> (iterate playlist/next-song playlist)
(map playlist/current-song)
(take length))]
(is (= (count played-tracks) (count (set played-tracks)))
(str repeat-mode)))))
(testing "Should keep the song order when wrapping around and repeat-mode is all"
(let [playlist (playlist/->playlist (song-queue 100) :playback-mode :shuffled :repeat-mode :repeat-all)
next-playlist (-> (playlist/set-current-song playlist 99)
(playlist/next-song))]
(= (playlist/current-song playlist)
(playlist/current-song next-playlist))))
(testing "Should always give the same track when repeat-mode is single"
(let [playlist (playlist/->playlist (song-queue 10) :playback-mode :shuffled :repeat-mode :repeat-single)
played-back (map playlist/current-song (iterate playlist/next-song playlist))]
(dotimes [i 3]
(is (same-song? (nth played-back i) (nth played-back (inc i)))))))
(testing "Should stop playing at the end of the queue when repeat-mode is none"
(is (nil? (-> (song-queue 1)
(playlist/->playlist :playback-mode :linear :repeat-mode :repeat-none)
(playlist/next-song)
(playlist/current-song))))))
(deftest linear-previous-song
(testing "Should always give the same track when repeat-mode is single"
(let [queue (song-queue 3)
playlist (playlist/->playlist queue :playback-mode :linear :repeat-mode :repeat-single)
played-back (map playlist/current-song (iterate playlist/next-song playlist))]
(is (same-song? (first queue) (nth played-back 0)))
(is (same-song? (first queue) (nth played-back 1)))
(is (same-song? (first queue) (nth played-back 2)))
(is (same-song? (first queue) (nth played-back 3)) "wrapping around")))
(testing "Should keep the linear order when repeat-mode is not single"
(doseq [repeat-mode '(:repeat-none :repeat-all)]
(let [queue (song-queue 3)
playlist (playlist/->playlist queue :playback-mode :linear :repeat-mode repeat-mode)]
(is (same-song? (nth queue 1) (-> (playlist/next-song playlist)
(playlist/next-song)
(playlist/previous-song)
(playlist/current-song)))))))
;; TODO: Should it?
#_(testing "Should repeatedly give the first song when repeat-mode is none"
(let [queue (song-queue 3)
playlist (playlist/->playlist queue :playback-mode :linear :repeat-mode :repeat-none)]
(is (same-song? (first queue) (-> (playlist/previous-song playlist)
(playlist/current-song))))))
(testing "Should wrap around to last song when repeat-mode is all"
(let [queue (song-queue 3)
playlist (playlist/->playlist queue :playback-mode :linear :repeat-mode :repeat-all)]
(is (same-song? (last queue) (-> (playlist/previous-song playlist)
(playlist/current-song)))))))
(deftest shuffled-previous-song
(with-redefs [shuffle reverse]
(testing "Should always give the same track when repeat-mode is single"
(let [queue (song-queue 3)
playlist (playlist/->playlist queue :playback-mode :shuffled :repeat-mode :repeat-single)
played-back (map playlist/current-song (iterate playlist/next-song playlist))]
(dotimes [i 3]
(is (same-song? (nth played-back i) (nth played-back (inc i)))))))
(testing "Should keep the playing order when repeat-mode is not single"
(doseq [repeat-mode '(:repeat-none :repeat-all)]
(let [queue (song-queue 3)
playlist (playlist/->playlist queue :playback-mode :shuffled :repeat-mode repeat-mode)]
(is (same-song? (playlist/current-song playlist)
(-> playlist
(playlist/next-song)
(playlist/previous-song)
(playlist/current-song)))
(str "for repeat mode " repeat-mode))
(is (same-song? (-> (playlist/next-song playlist)
(playlist/current-song))
(-> (playlist/next-song playlist)
(playlist/next-song)
(playlist/previous-song)
(playlist/current-song)))
(str "for repeat mode " repeat-mode)))))
(testing "Should keep the song order when repeat-mode is all and we go back to before the first track"
(let [playlist (playlist/->playlist (song-queue 10) :playback-mode :shuffled :repeat-mode :repeat-all)
next-playlist (-> (playlist/previous-song playlist)
(playlist/set-current-song 0))]
(is (= (playlist/current-song playlist)
(playlist/current-song next-playlist)))))))
(deftest set-current-song
(testing "Should correctly set the new song"
(doseq [repeat-mode [:repeat-all :repeat-none]]
(let [queue (song-queue 3)
playlist (playlist/->playlist queue :playback-mode :shuffled :repeat-mode repeat-mode)
next-track (-> (playlist/set-current-song playlist 1)
(playlist/current-song))]
(is (not (nil? next-track)))
(is (not (same-song? (playlist/current-song playlist)
next-track)))))))
(deftest enqueue-last
(testing "Should make sure the song is played last"
(doseq [playback-mode '(:linear :shuffled)
repeat-mode '(:repeat-none :repeat-all)]
(let [length 5, queue (song-queue length)
playlist (with-redefs [shuffle identity]
(playlist/->playlist queue :playback-mode playback-mode :repeat-mode repeat-mode))
played-back (->> (iterate playlist/next-song playlist)
(take (dec length))
(map #(:id (playlist/current-song %)))
(set))
to-enqueue (song)
playlist' (playlist/enqueue-last playlist to-enqueue)]
(is (nil? (played-back (-> (->> (iterate playlist/next-song playlist')
(map playlist/current-song))
(nth length)
(:id))))
(str "for " playback-mode ", " repeat-mode)))))
(testing "Should not change the order of the songs already in queue"
(doseq [playback-mode '(:linear :shuffled)
repeat-mode '(:repeat-none :repeat-all)]
(let [length 5, queue (song-queue length)
playlist (playlist/->playlist queue :playback-mode playback-mode :repeat-mode repeat-mode)
played-back-songs (fn played-back-songs [playlist]
(->> (iterate playlist/next-song playlist)
(take length)
(map playlist/current-song)
(map :playlist/order)))
played-back (played-back-songs playlist)
played-back' (played-back-songs (playlist/enqueue-last playlist (song)))]
(is (= played-back played-back')
(str "for " playback-mode ", " repeat-mode))))))
(deftest enqueue-next
(testing "Should play the song after the currently playing song"
(doseq [playback-mode [:linear :shuffled]
repeat-mode [:repeat-none :repeat-all]]
(let [length 5, queue (song-queue length)
playlist (playlist/->playlist queue :playback-mode playback-mode :repeat-mode repeat-mode)
next-song (song)]
(is (same-song? next-song (-> (playlist/enqueue-next playlist next-song)
(playlist/next-song)
(playlist/current-song))))))))
(deftest move-track
(testing "Should correctly set the new order"
(doseq [playback-mode [:linear :shuffled]
repeat-mode [:repeat-none :repeat-all :repeat-single]]
(let [n-songs 10
queue (song-queue n-songs)
playlist (playlist/->playlist queue :repeat-mode repeat-mode :playback-mode playback-mode)]
(is (same-song? (-> (playlist/next-song playlist)
(playlist/next-song)
(playlist/current-song))
(-> (playlist/move-song playlist 2 1)
(playlist/next-song)
(playlist/current-song)))))))
(testing "Should update the currently playing track's index"
(testing "when inserting a track before"
(doseq [playback-mode [:linear :shuffled]
repeat-mode [:repeat-none :repeat-all :repeat-single]]
(let [n-songs 10
queue (song-queue n-songs)
playlist (playlist/->playlist queue :repeat-mode repeat-mode :playback-mode playback-mode)]
(is (= 4 (-> (playlist/set-current-song playlist 3)
(playlist/move-song 5 3)
:current-idx))))))
(testing "when moving a track behind it"
(doseq [playback-mode [:linear :shuffled]
repeat-mode [:repeat-none :repeat-all :repeat-single]]
(let [n-songs 10
queue (song-queue n-songs)
playlist (playlist/->playlist queue :repeat-mode repeat-mode :playback-mode playback-mode)]
(is (= 2 (-> (playlist/set-current-song playlist 3)
(playlist/move-song 2 5)
:current-idx))))))
(testing "when moving it"
(doseq [playback-mode [:linear :shuffled]
repeat-mode [:repeat-none :repeat-all :repeat-single]]
(let [n-songs 10
queue (song-queue n-songs)
playlist (playlist/->playlist queue :repeat-mode repeat-mode :playback-mode playback-mode)]
(is (= 7 (-> (playlist/set-current-song playlist 3)
(playlist/move-song 3 7)
:current-idx))))))
(testing "when the current track is outside of the modified range"
(doseq [playback-mode [:linear :shuffled]
repeat-mode [:repeat-none :repeat-all :repeat-single]]
(let [n-songs 10
queue (song-queue n-songs)
playlist (playlist/->playlist queue :repeat-mode repeat-mode :playback-mode playback-mode)]
(is (= 3 (-> (playlist/set-current-song playlist 3)
(playlist/move-song 4 7)
:current-idx))))))))
(deftest remove-song
(with-redefs [shuffle identity]
(testing "Should remove a single song from the playlist"
(doseq [playback-mode [:linear :shuffled]
repeat-mode [:repeat-none :repeat-all :repeat-single]]
(let [n-songs 10
queue (song-queue n-songs)
playlist (playlist/->playlist queue :repeat-mode repeat-mode :playback-mode playback-mode)
first-removed (playlist/remove-song playlist 0)
middle-removed (playlist/remove-song playlist 5)
last-removed (playlist/remove-song playlist 9)
song-not-in-list? (fn [song playlist]
(every? #(not (same-song? % song))
(vals (:items playlist))))]
(is (= 9 (count first-removed) (count middle-removed) (count last-removed)))
(is (song-not-in-list? (first queue) first-removed))
(is (same-song? (second queue) (get (:items first-removed) 0)))
(is (song-not-in-list? (nth queue 5) middle-removed))
(is (same-song? (nth queue 6) (get (:items middle-removed) 5)))
(is (song-not-in-list? (last queue) last-removed)))))
(testing "Should pause if the currently playing song is removed"
(doseq [playback-mode [:linear :shuffled]
repeat-mode [:repeat-none :repeat-all :repeat-single]]
(let [n-songs 10
queue (song-queue n-songs)]
(is (nil? (-> (playlist/->playlist queue :repeat-mode repeat-mode :playback-mode playback-mode)
(playlist/set-current-song 5)
(playlist/remove-song 5)
(playlist/current-song)))))))))

View file

@ -1,39 +0,0 @@
(ns airsonic-ui.components.audio-player.events-test
(:require [cljs.test :refer-macros [deftest testing is]]
[airsonic-ui.audio.core :as audio]
[airsonic-ui.audio.playlist :as playlist]
[airsonic-ui.fixtures :as fixtures]
[airsonic-ui.test-helpers :refer [dispatches? song-queue]]
[airsonic-ui.components.audio-player.events :as events]))
(deftest song-has-ended
(testing "Should play the next song when current song has ended"
(is (not (dispatches? (events/audio-update {} [:audio/update {:ended? false}]) :audio-player/next-song)))
(is (dispatches? (events/audio-update {} [:audio/update {:ended? true}]) :audio-player/next-song))))
(deftest changing-current-song
(testing "Should correctly set the current song index"
(doseq [playback-mode [:linear :shuffled]
repeat-mode [:repeat-none :repeat-single :repeat-all]]
(let [n-songs 100
next-idx (rand-int n-songs)
fixture {:db {:credentials fixtures/credentials
:audio {:current-playlist (playlist/->playlist (song-queue n-songs) :playback-mode playback-mode :repeat-mode repeat-mode)}}}
effects (events/set-current-song fixture [:audio/set-current-song next-idx])]
(is (= next-idx
(-> (:db effects)
(audio/summary [:audio/summary])
(audio/current-playlist [:audio/current-playlist])
(:current-idx)))
(str "for playback-mode " playback-mode " and repeat-mode " repeat-mode))
(is (contains? effects :audio/play))))))
(deftest removing-currently-playing-song
(testing "Should stop all audio when removing the currently playing song"
(doseq [playback-mode [:linear :shuffled]
repeat-mode [:repeat-none :repeat-single :repeat-all]]
(let [n-songs 100
fixture {:db {:credentials fixtures/credentials
:audio {:current-playlist (playlist/->playlist (song-queue n-songs) :playback-mode playback-mode :repeat-mode repeat-mode)}}}]
(is (contains? (events/remove-song fixture [:audio/remove-song 0]) :audio/stop))
(is (not (contains? (events/remove-song fixture [:audio/remove-song 99]) :audio/stop)))))))

File diff suppressed because it is too large Load diff

View file

@ -1,33 +0,0 @@
(ns airsonic-ui.components.library.subs-test
(:require [cljs.test :refer-macros [deftest testing is]]
[airsonic-ui.config :as conf]
[airsonic-ui.components.library.fixtures :as fixtures]
[airsonic-ui.components.library.subs :as sub]))
(deftest partition-library
(testing "Should give us a map of page -> content"
(let [pages (sub/partition-responses "recent" fixtures/responses)]
(is (map? pages))
(is (every? int? (keys pages)))
(is (every? seq? (vals pages)))))
(testing "Should map each response correctly to a page"
(let [first-response (select-keys fixtures/responses [["getAlbumList2" {:type "recent", :size 100, :offset 0}]])]
(is (= (range 5) (keys (sub/partition-responses "recent" first-response)))))
(let [first-and-third (select-keys fixtures/responses [["getAlbumList2" {:type "recent", :size 100, :offset 0}]
["getAlbumList2" {:type "recent", :size 100, :offset 40}]])]
;; there will be overlapping content for pages 2, 3 and 4 (with a zero-based index)
(is (= (range 7) (keys (sub/partition-responses "recent" first-and-third)))))))
(deftest paginated-library
(testing "Should humanize page offsets"
(let [responses (select-keys fixtures/responses [["getAlbumList2" {:type "recent", :size 100, :offset 0}]])
paginated (sub/paginated-library responses [:sub/paginated-library "recent"])]
(is (= [1 2 3 4 5] (keys paginated)))))
(testing "Should concatenate and deduplicate all album list responses"
(let [responses (select-keys fixtures/responses [["getAlbumList2" {:type "recent", :size 100, :offset 0}]
["getAlbumList2" {:type "recent", :size 100, :offset 20}]
["getAlbumList2" {:type "recent", :size 100, :offset 40}]])
paginated (sub/paginated-library responses [:sub/paginated-library "recent"])]
(is (= [1 2 3 4 5 6 7] (keys paginated)))
(is (= 140 (count (mapcat val paginated))))
(is (= 140 (count (set (mapcat val paginated))))))))

View file

@ -1,136 +0,0 @@
(ns airsonic-ui.events-test
(:require [cljs.test :refer [deftest testing is]]
[clojure.string :as str]
[airsonic-ui.test-helpers :refer [dispatches?]]
[airsonic-ui.fixtures :as fixtures]
[airsonic-ui.db :as db]
[airsonic-ui.routes :as routes]
[airsonic-ui.events :as events]
[airsonic-ui.subs :as subs]
))
(enable-console-print!)
;; the event tests are actually quite nice to write:
;; because everything in re-frame is described as data, we pass on coeffects
;; to event handler after event handler and check if the final coeffect map
;; looks as expected.
(defn no-previous-session [] (events/initialize-app {} [::events/initialize-app]))
(defn has-previous-session [] (-> {:store {:credentials fixtures/credentials}}
(events/initialize-app [::events/initialize-app])))
(deftest app-initialization
(testing "Should set up notifications"
(is (map? (subs/notifications (:db (no-previous-session))
[::subs/notifications])))
(is (map? (subs/notifications (:db (has-previous-session))
[::subs/notifications]))))
(testing "Should set up the default database")
(testing "Should initialize credential verification"
(is (false? (dispatches? (no-previous-session) :credentials/verify)))
(is (true? (dispatches? (has-previous-session) [:credentials/verify fixtures/credentials]))))
(testing "Should initialize the router"
(is (contains? (no-previous-session) :routes/start-routing))
(is (contains? (has-previous-session) :routes/start-routing))))
(deftest credential-verification
(testing "Should fail when there are no credentials"
(is (false? (dispatches? (-> (no-previous-session)
(events/verify-credentials [:credentials/verify nil])) [::subs/is-booting?]))))
(testing "Should happen server-side when we have credentials"
(let [cofx (-> (has-previous-session)
(events/verify-credentials [:credentials/verify fixtures/credentials]))]
(is (true? (dispatches? cofx :credentials/send-authentication-request)))))
(testing "Should verify the structure of credentials"
(let [empty-creds {:store {:credentials {}}}]
(is (false? (boolean (dispatches? empty-creds :credentials/send-authentication-request)))))
(let [malformed {:store {:credentials {:xyz #{12 34 56}}}}]
(is (false? (boolean (dispatches? malformed :credentials/send-authentication-request)))))))
(deftest authentication-request
(let [event [:credentials/send-authentication-request fixtures/credentials]
fx (events/authentication-request {} event)
request (:http-xhrio fx)]
(testing "uses correct server url"
(let [uri (:uri request)]
(is (str/starts-with? uri (:server fixtures/credentials)))
(is (str/includes? uri "/getUser"))
(is (str/includes? uri (str "p=" (:p fixtures/credentials))))
(is (str/includes? uri (str "u=" (:u fixtures/credentials))))
(is (str/includes? uri (str "username=" (:u fixtures/credentials))))))
(testing "invokes correct callback on server response"
(is (= [:credentials/authentication-response fixtures/credentials] (:on-success request))))
(testing "invokes correct callback when server is not reachable"
(is (= [:api.response/failed] (:on-failure request))))))
(deftest authentication-response
(testing "On success"
(let [cofx (-> (has-previous-session)
(events/authentication-response [:credentials/authentication-response (:auth-success fixtures/responses)])
(events/authentication-success [:credentials/authentication-success fixtures/credentials (:auth-success fixtures/responses)]))]
(testing "should mark the credentials as verified"
(is (true? (get-in cofx [:db :credentials :verified?]))))
(testing "should store the credentials in localstorage"
(let [stored-credentials (get-in cofx [:store :credentials])]
(is (= fixtures/credentials stored-credentials))))))
(testing "On failure"
(let [cofx (-> (has-previous-session)
(events/authentication-response [:credentials/authentication-response (:auth-failure fixtures/responses)])
(events/authentication-failure [:credentials/authentication-failure (:auth-failure fixtures/responses)]))]
(testing "should display a notification to the user"
(is (true? (dispatches? cofx :notification/show)))))))
(deftest manual-login
(let [{:keys [u p server]} fixtures/credentials
credentials (assoc fixtures/credentials :verified? false)
effect (events/user-login {} [:credentials/user-login u p server])]
(testing "Should save the credentials as unverified"
(is (= credentials (get-in effect [:db :credentials]))))
(testing "Should start the authentication request"
(is (true? (dispatches? effect [:credentials/send-authentication-request credentials]))))))
(deftest logout
(let [fx (events/logout {} [:_])]
(testing "Should clear all stored data"
(is (nil? (:store fx))))
(testing "Should redirect to the login screen"
(is (dispatches? fx [:routes/do-navigation [::routes/login]])))
(testing "Should reset the app-db"
(is (= db/default-db (:db fx))))
(testing "Should stop currently playing songs"
(is (contains? fx :audio/stop))))
(testing "Should be able to keep a redirection parameter"
(let [redirect [:route {:with-data #{1 2 3 4 5}}]
navigation-event (:dispatch (events/logout {} [:_ :redirect-to redirect]))]
(is (= :routes/do-navigation (first navigation-event)))
(let [[route-id _ query] (second navigation-event)]
(is (= ::routes/login route-id))
(is (contains? query :redirect))))))
(defn- first-notification [fx]
(-> (get-in fx [:db :notifications]) vals first))
(deftest user-notifications
(testing "Should be able to display a message with an assigned level"
(is (= :error (:level (first-notification (events/show-notification {} [:_ :error "foo"])))))
(is (= :info (:level (first-notification (events/show-notification {} [:_ :info "some other message"]))))))
(testing "Should default to level :info"
(is (= :info (:level (first-notification (events/show-notification {} [:_ "and another one"]))))))
(testing "Should create a unique id for each message"
(let [state (->
{}
(events/show-notification [:_ :info "Something something"])
(events/show-notification [:_ :error "Something important"]))
ids (keys (:notifications state))]
(is (= (count ids) (count (set ids))))))
(testing "Should remove a message, given it's id"
(let [state (events/show-notification {} [:_ "This is a notification"])
id (-> (:notifications state)
keys
first)]
(is (empty? (:notifications (events/hide-notification state [:_ id]))))))
(testing "Should automatically remove a message after a while"
(let [fx (events/show-notification {} [:_ :info "This is a notification"])]
(is (= :notification/hide (-> (:dispatch-later fx) first :dispatch first))))))

View file

@ -1,115 +0,0 @@
(ns airsonic-ui.fixtures)
(def credentials {:u "username"
:p "cleartext-password"
:server "https://demo.airsonic.io"})
(def responses {:error {:subsonic-response
{:error {:code 50
:message "Incompatible Airsonic REST protocol version. Server must upgrade."}
:status "failed"
:version "1.15.0"}}
:ok {:subsonic-response
{:scanStatus {:count 10326
:scanning false}
:status "ok"
:version "1.15.0"}}
:ping-success {:subsonic-response {:status "ok"
:version "1.15.0"}}
:auth-success {:subsonic-response
{:status "ok",
:version "1.15.0",
:user
{:videoConversionRole false,
:playlistRole true,
:shareRole true,
:podcastRole true,
:email "admin@example.com",
:streamRole true,
:folder [0],
:username "admin",
:scrobblingEnabled false,
:adminRole true,
:settingsRole true,
:commentRole true,
:jukeboxRole true,
:coverArtRole true,
:downloadRole true,
:maxBitRate 320,
:uploadRole true}}}
:auth-failure {:subsonic-response {:status "failed"
:version "1.15.0"
:error {:code 40
:message "Wrong username or password."}}}})
(def artist
{:id "499", :name "Tomemitsu", :coverArt "ar-497", :albumCount 1})
(def album
{:artistId "258",
:name "Tocotronic",
:songCount 26,
:created "2017-12-31T08:18:45.000Z",
:duration 7383,
:artist "Tocotronic",
:year 2015,
:id "439",
:coverArt "al-439"})
(def song
{:artistId 42,
:path "DJ Koze/DJ Koze - Reincarnations Part 2, The Remix Chapter 2009-2014/14. Apparat - Black Water (DJ Koze Remix).mp3",
:suffix "mp3",
:isDir false,
:bitRate 320,
:parent 3556,
:albumId 382,
:type "music",
:created "2017-06-28T19:07:02.000Z",
:duration 317,
:artist "Apparat",
:isVideo false,
:size 12850290,
:title "Black Water (DJ Koze Remix)",
:playCount 0
:year 2014,
:id 3562,
:coverArt 3556,
:contentType "audio/mpeg",
:album "Reincarnations, Pt. 2 - The Remix Chapter 2009 - 2014",
:track 14})
(def playback-status
{:ended? false
:loop? false
:muted? false
:paused? false
:current-src "https://londe.arnes.space/rest/stream?f=json&c=airsonic-ui-cljs&v=1.15.0&id=9574&u=arne&p=27h-%25bO%5B8-.ys%40SQ%7Bg%24-%5B5NZkX%7Dw%24NNwY%263DPATi%2CgaFoH%40e"
:current-time 3.477029})
(def podcast-episode
{:genre "Vocal",
:description
"Themen der Sendung: Druck auf Maaßen nach Äußerungen zu Chemnitz wächst, Köthen: 22-Jähriger stirbt nach Streit an Herzversagen, Parlamentswahl in Schweden, Russland und Syrien setzen Luftangriffe auf syrische Provinz Idlib fort, Tote und Verletzte bei Ausschreitungen im irakischem Basra, Nordkorea feiert 70. Jubiläum seiner Staatsgründung, Zahl der Toten nach Erdbeben in Japan steigt auf 39, Pläne von CDU und CSU: Fluggesellschaften sollen Auskunft über Verspätungen geben, Menschenkette in Dangast als Zeichen gegen Flüchtlingssterben im Mittelmeer, Das Wetter",
:suffix "mp3",
:isDir false,
:bitRate 64,
:parent "10409",
:channelId "4",
:type "podcast",
:created "2018-09-09T19:41:13.000Z",
:duration 965,
:artist "Tagesschau (Audio-Podcast)",
:isVideo false,
:publishDate "2018-09-09T18:00:00.000Z",
:size 7812758,
:title "09.09.2018 - tagesschau 20:00 Uhr",
:playCount 0,
:year 2018,
:streamId "11181",
:status "completed",
:id "507",
:coverArt "10409",
:contentType "audio/mpeg",
:album "tagesschau",
:track 1})

View file

@ -1,34 +0,0 @@
(ns airsonic-ui.helpers-test
(:require [cljs.test :refer [deftest testing is]]
[airsonic-ui.helpers :as helpers]))
(deftest add-classes
(testing "Should add classes to a simple hiccup keyword"
(is (= :div.foo (helpers/add-classes :div :foo)))
(is (= :div.bar.bar (helpers/add-classes :div.bar :bar)))
(is (= :div.foo.bar (helpers/add-classes :div.foo :bar))))
(testing "Should add classes to the innermost child of a nested hiccup element"
(is (= :p>input.input (helpers/add-classes :p>input :input)))
(is (= :div.field>p>input.input.has-background-red (helpers/add-classes :div.field>p>input.input :has-background-red)))))
(deftest kebabify
(testing "Should turn camelCased and PascalCased strings into kebab-cased keywords"
(is (= :hello-world (helpers/kebabify "HelloWorld")))
(is (= :how-are-you (helpers/kebabify "howAreYou")))
(is (= :foobar (helpers/kebabify "foobar"))))
(testing "Should kebab-case camelCased and PascalCased keywords"
(is (= :hello-world (helpers/kebabify :HelloWorld)))
(is (= :how-are-you (helpers/kebabify :howAreYou)))
(is (= :foobar (helpers/kebabify :foobar)))))
(deftest format-duration
(testing "Should format hours, minutes and seconds"
(is (= "1h" (helpers/format-duration 3600)))
(is (= "59m" (helpers/format-duration (* 59 60))))
(is (= "1m" (helpers/format-duration 60)))
(is (= "5s" (helpers/format-duration 5))))
(testing "Should respect the :brief? option"
(is (= "01:00:00" (helpers/format-duration 3600 :brief? true)))
(is (= "59:00" (helpers/format-duration (* 59 60) :brief? true)))
(is (= "01:00" (helpers/format-duration 60 :brief? true)))
(is (= "00:05" (helpers/format-duration 5 :brief? true)))))

View file

@ -1,23 +0,0 @@
(ns airsonic-ui.routes-test
(:require [airsonic-ui.routes :as routes]
[cljs.test :refer [deftest testing is]]))
(def fixtures
{:default [::route {:some :data} {:some-more true}]})
#_(deftest permission-checking
(testing "Should succeed for unprotected routes"
(testing "without credentials")
(testing "with unverified credentials"))
(testing "Should fail for protected routes"
(testing "without credentials")
(testing "with unverified credentials"))
(testing "Should succeed for protected routes with verified credentials"))
(deftest route-encoding
(testing "Should return a string with hash-compatible characters"
(let [encoded (routes/encode-route (:default fixtures))]
(is (string? encoded))
(is (re-matches #"^[^#?&=]+$" encoded))))
(testing "Should be bijective"
(is (= (:default fixtures) (routes/decode-route (routes/encode-route (:default fixtures)))))))

View file

@ -1,66 +0,0 @@
(ns airsonic-ui.subs-test
(:require [cljs.test :refer [deftest testing is]]
[airsonic-ui.fixtures :as fixtures]
[airsonic-ui.api.helpers :as api]
[airsonic-ui.events :as events]
[airsonic-ui.subs :as subs]))
(deftest booting
(let [route [:some-route nil nil]
verified-credentials (assoc fixtures/credentials :verified? true)
is-booting? (fn is-booting? [db]
(subs/is-booting? db [:subs/is-booting?]))]
(testing "Should be false when we don't have previous credentials"
(is (not (is-booting? {:routes/current-route route})))
(is (not (is-booting? {:routes/current-route route
:credentials {}}))) )
(testing "Should be true when we have unverified credentials"
(is (true? (is-booting? {:routes/current-route route
:credentials fixtures/credentials}))))
(testing "Should be false when we have verified credentials"
(is (not (is-booting? {:routes/current-route route
:credentials verified-credentials}))))
(testing "Should be true when routing is not yet set up"
(is (true? (is-booting? {:routes/current-route nil
:credentials verified-credentials}))))
(testing "Should be false when an error occurred"
(is (false? (is-booting? (:db (events/show-notification {} [:_ :error "Something bad happened"]))))))))
(deftest cover-images
(let [credentials {:server "https://foo.bar"
:u "test-user"
:p "some-random-password"}]
(testing "Should give the correct path once the credentials are set"
(is (= (api/cover-url credentials fixtures/song 48)
(subs/cover-url credentials [:subs/cover-image fixtures/song 48]))))))
(def successful-auth-db
"For the details see event_test.cljs"
(-> {:store {:credentials fixtures/credentials}}
(events/initialize-app [::events/initialize-app])
(events/authentication-response [:credentials/authentication-response (:auth-success fixtures/responses)])
(events/authentication-success [:credentials/authentication-success fixtures/credentials (:auth-success fixtures/responses)])
(:db)))
(deftest user-roles
(testing "Should be available after a successful authentication"
(let [user-roles (-> (subs/user-info successful-auth-db [:user/info])
(subs/user-roles [:user/roles]))]
(is (set? user-roles))
(is (every? keyword? user-roles))
(is (not (user-roles :username)) "and contain only roles")))
(testing "Should indicate whether a user has a given role"
(letfn [(role [role]
(-> (subs/user-info successful-auth-db [:user/info])
(subs/user-roles [:user/roles])
(disj :admin) ; <- makes sure we're not allowed everything
(subs/user-role [:user/role role])))]
(is (some? (role :stream)))
(is (not (some? (role :video-conversion))))))
(testing "Should allow everything to an admin"
(letfn [(admin-role [role]
(-> (subs/user-info successful-auth-db [:user/info])
(subs/user-roles [:user/roles])
(subs/user-role [:user/role role])))]
(is (some? (admin-role :stream)))
(is (some? (admin-role :video-conversion))))))

View file

@ -1,35 +0,0 @@
(ns airsonic-ui.test-helpers)
(defn dispatches?
"Helper to see whether an event is dispatched in a coeffect; `ev` can either
be a whole vector or a keyword which is interpreted as the event name."
[cofx ev]
(let [all-events (conj (get cofx :dispatch-n []) (:dispatch cofx))]
(boolean (some #(= ev (if (vector? ev) % (first %))) all-events))))
(defn rand-str
"Generates a random string; ported from https://stackoverflow.com/a/27747377/2345852"
([] (rand-str 40))
([len]
(let [arr (js/Uint8Array. (/ len 2))]
(.. js/window -crypto (getRandomValues arr))
(.. js/Array
(from arr #(-> (str 0 (.toString % 16))
(.substr -2)))
(join "")))))
(defn song []
(hash-map :id (rand-int 9999)
:coverArt (rand-int 9999)
:year (+ 1900 (rand-int 118))
:artist (rand-str)
:artistId (rand-int 100000)
:title (rand-str)
:album (rand-str)))
(defn song-queue
"Generates a seq of n different songs"
[n]
(let [r-int (atom 0)]
(with-redefs [rand-int #(mod (swap! r-int inc) %1)]
(repeatedly n song))))

View file

@ -1,24 +0,0 @@
(ns airsonic-ui.test-helpers-test
(:require [cljs.test :refer [deftest testing is]]
[airsonic-ui.test-helpers :as h]))
(deftest dispatch-helper
(testing "Should identify singly dispatched events"
(is (false? (h/dispatches? {} :foo)))
(is (true? (h/dispatches? {:dispatch [:foo 1 2 3]} :foo)))
(is (false? (h/dispatches? {:dispatch [:foo 1 2 3]} :bar)))
(is (true? (h/dispatches? {:dispatch [:foo 1 2 3]} [:foo 1 2 3])))
(is (false? (h/dispatches? {:dispatch [:foo 1 2 3]} [:bar 2 3]))))
(testing "Should identify an event along multiple dispatched events"
(is (false? (h/dispatches? {:dispatch-n [[:bar]]} :foo)))
(is (true? (h/dispatches? {:dispatch-n [[:foo 1 2 3]]} :foo)))
(is (false? (h/dispatches? {:dispatch-n [[:foo 1 2 3]]} :bar)))
(is (h/dispatches? {:dispatch-n [[:foo 1 2 3]]} [:foo 1 2 3]))
(is (false? (h/dispatches? {:dispatch-n [[:foo 1 2 3]]} [:bar 2 3])))))
(deftest rand-str
(testing "Generates strings"
(is (string? (h/rand-str)))
(is (string? (h/rand-str 20))))
(testing "Should respect the length for even lengths"
(is (= 124 (count (h/rand-str 124))))))

View file

@ -1,40 +0,0 @@
(ns bulma.dropdown-test
(:require [cljs.test :refer-macros [deftest testing is]]
[bulma.dropdown.subs :as sub]
[bulma.dropdown.events :as ev]))
;; NOTE: Here as well; this code is very much like the modal code
;; Not sure whether to explicitly duplicate it or provide some smarter
;; abstraction that's harder to understand at first sight
(enable-console-print!)
(deftest bulma-dropdowns
(testing "Should create a collection of dropdowns if there is none"
(let [new-db (ev/show-dropdown {} [::ev/show :some-dropdown-id])]
(is (= :some-dropdown-id (sub/visible-dropdown new-db [::sub/visible-dropdown])))))
(testing "Should hide other dropdowns when displaying a new one"
(let [dropdown-ids [:some-id-1 :some-id-2 :some-id-3]
new-db (reduce (fn [db dropdown-id]
(ev/show-dropdown db [::ev/show dropdown-id]))
{} dropdown-ids)]
(is (= :some-id-3 (sub/visible-dropdown new-db [::sub/visible-dropdown])))))
(testing "Should remove a dropdown from the collection when we hide it"
(let [dropdown-ids [:some-id-1 :some-id-2 :some-id-3]
new-db (-> (reduce (fn [db dropdown-id]
(ev/show-dropdown db [::ev/show dropdown-id]))
{} dropdown-ids)
(ev/hide-dropdown [::ev/hide]))]
(is (not (some? (sub/visible-dropdown new-db [::sub/visible-dropdown]))))))
(testing "Should tell us about the visibility of a dropdown with a predicate"
(is (true? (-> (ev/show-dropdown {} [::ev/show :getting-repetitive])
(sub/visible-dropdown [::sub/visible-dropdown])
(sub/visible? [::sub/visible? :getting-repetitive])))))
(testing "Dropdown toggling"
(is (true? (-> (ev/toggle-dropdown {} [::ev/toggle :some-generic-dropdown])
(sub/visible-dropdown [::sub/visible-dropdown])
(sub/visible? [::sub/visible? :some-generic-dropdown]))))
(is (not (true? (-> (ev/toggle-dropdown {} [::ev/toggle :some-generic-dropdown])
(ev/toggle-dropdown [::ev/toggle :some-generic-dropdown])
(sub/visible-dropdown [::sub/visible-dropdown])
(sub/visible? [::sub/visible? :some-generic-dropdown])))))))

View file

@ -1,36 +0,0 @@
(ns bulma.modal-test
(:require [cljs.test :refer-macros [deftest testing is]]
[bulma.modal.subs :as sub]
[bulma.modal.events :as ev]))
(enable-console-print!)
(deftest bulma-modals
(testing "Should create a collection of modals if there is none"
(let [new-db (ev/show-modal {} [::ev/show :some-modal-id])]
(is (= :some-modal-id (sub/visible-modal new-db [::sub/visible-modal])))))
(testing "Should hide other modals when displaying a new one"
(let [modal-ids [:some-id-1 :some-id-2 :some-id-3]
new-db (reduce (fn [db modal-id]
(ev/show-modal db [::ev/show modal-id]))
{} modal-ids)]
(is (= :some-id-3 (sub/visible-modal new-db [::sub/visible-modal])))))
(testing "Should remove a modal from the collection when we hide it"
(let [modal-ids [:some-id-1 :some-id-2 :some-id-3]
new-db (-> (reduce (fn [db modal-id]
(ev/show-modal db [::ev/show modal-id]))
{} modal-ids)
(ev/hide-modal [::ev/hide]))]
(is (not (some? (sub/visible-modal new-db [::sub/visible-modal]))))))
(testing "Should tell us about the visibility of a modal with a predicate"
(is (true? (-> (ev/show-modal {} [::ev/show :getting-repetitive])
(sub/visible-modal [::sub/visible-modal])
(sub/visible? [::sub/visible? :getting-repetitive])))))
(testing "Modal toggling"
(is (true? (-> (ev/toggle-modal {} [::ev/toggle :some-generic-modal])
(sub/visible-modal [::sub/visible-modal])
(sub/visible? [::sub/visible? :some-generic-modal]))))
(is (not (true? (-> (ev/toggle-modal {} [::ev/toggle :some-generic-modal])
(ev/toggle-modal [::ev/toggle :some-generic-modal])
(sub/visible-modal [::sub/visible-modal])
(sub/visible? [::sub/visible? :some-generic-modal])))))))