Initial commit
This commit is contained in:
commit
b4623926a2
5
.editorconfig
Normal file
5
.editorconfig
Normal file
@ -0,0 +1,5 @@
|
||||
[*.{js,jsx,ts,tsx,vue}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
21
.gitignore
vendored
Normal file
21
.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
36
.gitlab-ci.yml
Normal file
36
.gitlab-ci.yml
Normal file
@ -0,0 +1,36 @@
|
||||
image: node:13-alpine
|
||||
|
||||
stages:
|
||||
- build
|
||||
- deploy-dev
|
||||
- deploy-prod
|
||||
|
||||
variables:
|
||||
NETLIFY_SITE_ID: airsonic
|
||||
|
||||
build:
|
||||
stage: build
|
||||
script:
|
||||
- export VUE_APP_VERSION=$CI_COMMIT_SHORT_SHA
|
||||
- yarn install
|
||||
- yarn build
|
||||
artifacts:
|
||||
paths:
|
||||
- dist
|
||||
|
||||
deploy dev:
|
||||
stage: deploy-dev
|
||||
script:
|
||||
- npm i -g netlify-cli
|
||||
- netlify deploy --dir dist --site $NETLIFY_SITE_ID --auth $NETLIFY_AUTH_TOKEN
|
||||
|
||||
deploy production:
|
||||
stage: deploy-prod
|
||||
environment:
|
||||
name: production
|
||||
url: https://airsonic.netlify.com
|
||||
only:
|
||||
- master
|
||||
script:
|
||||
- npm i -g netlify-cli
|
||||
- netlify deploy --dir dist --site $NETLIFY_SITE_ID --auth $NETLIFY_AUTH_TOKEN --prod
|
661
LICENSE
Normal file
661
LICENSE
Normal file
@ -0,0 +1,661 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
51
README.md
Normal file
51
README.md
Normal file
@ -0,0 +1,51 @@
|
||||
# Airsonic Web Client
|
||||
|
||||
[](https://gitlab.com/tamland/airsonic-ui/pipelines)
|
||||
|
||||
Modern responsive web frontend for [Airsonic](https://github.com/airsonic/airsonic). It's currently based on the [Subsonic API](http://www.subsonic.org/pages/api.jsp) and should work with other backends implementing this API as well.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
## Supported features
|
||||
- Responsive UI. Works on mobile and desktop
|
||||
- Playback with presistent queue
|
||||
- Browse library for albums, artist, generes and starred songs
|
||||
- Create, delete and edit playlists
|
||||
- Search for artists, albums and songs
|
||||
- Play random songs with the built-in smart playlist
|
||||
|
||||
|
||||
## Demo
|
||||
|
||||
https://airsonic.netlify.com
|
||||
|
||||
Use address/credentials for your own Airsonic server, or use the subsonic.org demo server:
|
||||
- server: http://demo.subsonic.org
|
||||
- username: guest1
|
||||
- password guest
|
||||
|
||||
|
||||
## Build
|
||||
|
||||
```
|
||||
yarn install
|
||||
yarn build
|
||||
```
|
||||
|
||||
Bundle can be found in the `dist` folder.
|
||||
|
||||
|
||||
## Develop
|
||||
|
||||
```
|
||||
yarn install
|
||||
yarn serve
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Licensed under the [AGPLv3](LICENSE) license.
|
5
babel.config.js
Normal file
5
babel.config.js
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/app'
|
||||
]
|
||||
}
|
42
package.json
Normal file
42
package.json
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "airsonic",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mdi/font": "^4.5.95",
|
||||
"axios": "^0.19.0",
|
||||
"bootstrap": "^4.3.1",
|
||||
"bootstrap-vue": "^2.1.0",
|
||||
"howler": "^2.1.2",
|
||||
"material-design-icons-iconfont": "^5.0.1",
|
||||
"roboto-fontface": "*",
|
||||
"uuid": "^3.3.2",
|
||||
"vue": "^2.6.10",
|
||||
"vue-router": "^3.0.3",
|
||||
"vuex": "^3.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/howler": "^2.1.2",
|
||||
"@vue/cli-plugin-babel": "^4.0.5",
|
||||
"@vue/cli-plugin-typescript": "^4.0.5",
|
||||
"@vue/cli-service": "^4.0.5",
|
||||
"sass": "^1.18.0",
|
||||
"sass-loader": "^8.0.0",
|
||||
"typescript": "^3.4.3",
|
||||
"vue-template-compiler": "^2.6.10"
|
||||
},
|
||||
"postcss": {
|
||||
"plugins": {
|
||||
"autoprefixer": {}
|
||||
}
|
||||
},
|
||||
"browserslist": [
|
||||
"defaults",
|
||||
"not IE 11",
|
||||
"not IE_Mob 11"
|
||||
]
|
||||
}
|
1
public/_redirects
Normal file
1
public/_redirects
Normal file
@ -0,0 +1 @@
|
||||
/* /index.html 200
|
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
17
public/index.html
Normal file
17
public/index.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but this application doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
BIN
screenshots/album.png
Normal file
BIN
screenshots/album.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 273 KiB |
BIN
screenshots/albumlist.jpg
Normal file
BIN
screenshots/albumlist.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 430 KiB |
5
src/app/About.vue
Normal file
5
src/app/About.vue
Normal file
@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<div class="about">
|
||||
<h1>This is an about page</h1>
|
||||
</div>
|
||||
</template>
|
66
src/app/App.vue
Normal file
66
src/app/App.vue
Normal file
@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="min-vh-100 d-flex align-items-stretch justify-spcace-between">
|
||||
<div class="sidebar elevated d-none d-md-block" :class="{'d-block':showMenu}">
|
||||
<SideNav></SideNav>
|
||||
</div>
|
||||
<div class="main flex-fill">
|
||||
<div class="container-fluid pt-3 pb-3">
|
||||
<TopNav/>
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="footer elevated">
|
||||
<Player />
|
||||
</footer>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" >
|
||||
.sidebar {
|
||||
// position: sticky;
|
||||
// top: 0;
|
||||
// height: calc(100vh - 80px);
|
||||
// width: 200px;
|
||||
// min-width: 200px;
|
||||
// max-width: 200px;
|
||||
// text-overflow: ellipsis;
|
||||
|
||||
.nav-link {
|
||||
width: 220px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
.main {
|
||||
margin-bottom: 80px;
|
||||
}
|
||||
.sidebar {
|
||||
padding-bottom: 180px;
|
||||
}
|
||||
.footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 80px;
|
||||
}
|
||||
</style>
|
||||
<script lang="ts">
|
||||
import SideNav from "./SideNav.vue";
|
||||
import TopNav from "./TopNav.vue";
|
||||
import Player from "@/player/Player.vue";
|
||||
import { mapState, mapMutations } from 'vuex';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SideNav,
|
||||
TopNav,
|
||||
Player,
|
||||
},
|
||||
computed: {
|
||||
...mapState(['showMenu'])
|
||||
},
|
||||
};
|
||||
</script>
|
76
src/app/SideNav.vue
Normal file
76
src/app/SideNav.vue
Normal file
@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<div class="text-truncate">
|
||||
<nav class="nav flex-column">
|
||||
<router-link class="nav-link" :to="{name: 'home'}">
|
||||
<img src="@/app/logo.png" class="img-fluid">
|
||||
</router-link>
|
||||
|
||||
<router-link class="nav-link" :to="{name: 'home'}">
|
||||
<Icon>mdi-home</Icon> Home
|
||||
</router-link>
|
||||
|
||||
|
||||
<router-link class="nav-link" :to="{name: 'queue'}">
|
||||
<Icon>mdi-view-list</Icon> Playing
|
||||
</router-link>
|
||||
|
||||
<router-link class="nav-link" :to="{name: 'starred'}">
|
||||
<Icon>mdi-star</Icon> Starred
|
||||
</router-link>
|
||||
|
||||
<a class="nav-link disabled">
|
||||
<small class="text-uppercase text-muted font-weight-bold">
|
||||
Library
|
||||
</small>
|
||||
</a>
|
||||
|
||||
|
||||
<router-link class="nav-link" :to="{name: 'albums'}">
|
||||
<Icon>mdi-album</Icon> Albums
|
||||
</router-link>
|
||||
|
||||
<router-link class="nav-link" :to="{name: 'artists'}">
|
||||
<Icon>mdi-artist</Icon> Artists
|
||||
</router-link>
|
||||
|
||||
<router-link class="nav-item nav-link" :to="{name: 'genres'}">
|
||||
<Icon>mdi-library-music</Icon> Genres
|
||||
</router-link>
|
||||
|
||||
<PlaylistNav/>
|
||||
|
||||
|
||||
<!--
|
||||
<router-link class="nav-item nav-link" :to="{name: 'radio'}">
|
||||
<Icon>mdi-radio</Icon> Radio
|
||||
</router-link>
|
||||
|
||||
<router-link class="nav-item nav-link" :to="{name: 'settings'}">
|
||||
<Icon>mdi-settings</Icon>Settings
|
||||
</router-link> -->
|
||||
<!-- <a href="#" class="nav-item nav-link" @click.prevent="logout">
|
||||
<Icon>mdi-</Icon> Logout
|
||||
</a> -->
|
||||
</nav>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import PlaylistNav from "@/playlist/PlaylistNav.vue";
|
||||
import { mapState } from 'vuex';
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
PlaylistNav,
|
||||
},
|
||||
props: {
|
||||
show: Boolean
|
||||
},
|
||||
methods: {
|
||||
logout() {
|
||||
this.$auth.logout();
|
||||
this.$router.go(0);
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
42
src/app/TopNav.vue
Normal file
42
src/app/TopNav.vue
Normal file
@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div class="d-flex align-items-center mb-2">
|
||||
<button class="navbar-toggler text-white d-md-none" @click="toggleMenu">
|
||||
<Icon>mdi-menu</Icon>
|
||||
</button>
|
||||
|
||||
<div class="ml-auto"></div>
|
||||
|
||||
<SearchForm/>
|
||||
|
||||
<template v-if="username">
|
||||
<b-dropdown variant="link" right :text="username">
|
||||
<b-dropdown-item-button @click="logout">
|
||||
<Icon>mdi-logout</Icon> Logout
|
||||
</b-dropdown-item-button>
|
||||
</b-dropdown>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import { mapMutations, mapState } from 'vuex';
|
||||
import SearchForm from '@/search/SearchForm.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
SearchForm,
|
||||
},
|
||||
computed: {
|
||||
...mapState(["username"])
|
||||
},
|
||||
methods: {
|
||||
...mapMutations([
|
||||
'toggleMenu',
|
||||
]),
|
||||
logout() {
|
||||
this.$auth.logout();
|
||||
this.$router.go(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
BIN
src/app/logo.png
Normal file
BIN
src/app/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
1
src/app/logo.svg
Normal file
1
src/app/logo.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 87.5 100"><defs><style>.cls-1{fill:#1697f6;}.cls-2{fill:#7bc6ff;}.cls-3{fill:#1867c0;}.cls-4{fill:#aeddff;}</style></defs><title>Artboard 46</title><polyline class="cls-1" points="43.75 0 23.31 0 43.75 48.32"/><polygon class="cls-2" points="43.75 62.5 43.75 100 0 14.58 22.92 14.58 43.75 62.5"/><polyline class="cls-3" points="43.75 0 64.19 0 43.75 48.32"/><polygon class="cls-4" points="64.58 14.58 87.5 14.58 43.75 100 43.75 62.5 64.58 14.58"/></svg>
|
After Width: | Height: | Size: 539 B |
78
src/auth/Login.vue
Normal file
78
src/auth/Login.vue
Normal file
@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-modal title="Login" hide-footer no-close-on-esc :visible="showModal">
|
||||
<form @submit.prevent="login">
|
||||
<fieldset :disabled="busy">
|
||||
<b-form-group label="Server">
|
||||
<b-form-input name="server" type="text" v-model="server" required></b-form-input>
|
||||
</b-form-group>
|
||||
<b-form-group label="Username">
|
||||
<b-form-input name="username" type="text" v-model="username" required></b-form-input>
|
||||
</b-form-group>
|
||||
<b-form-group label="Password">
|
||||
<b-form-input name="password" type="password" v-model="password" required></b-form-input>
|
||||
</b-form-group>
|
||||
<b-form-group>
|
||||
<b-form-checkbox v-model="rememberLogin">Remember</b-form-checkbox>
|
||||
</b-form-group>
|
||||
<b-alert :show="!!error" variant="danger">
|
||||
Login failed.
|
||||
</b-alert>
|
||||
<button class="btn btn-primary" @click="login">
|
||||
<b-spinner v-show="busy" small type="grow"/>
|
||||
Login
|
||||
</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
</b-modal>
|
||||
</div>
|
||||
</template>>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import { mapMutations, mapState } from "vuex";
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
returnTo: { type: String, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
server: "",
|
||||
username: "",
|
||||
password: "",
|
||||
rememberLogin: false,
|
||||
busy: false,
|
||||
error: false,
|
||||
showModal: false,
|
||||
};
|
||||
},
|
||||
async created() {
|
||||
this.server = await this.$auth.server;
|
||||
this.username = await this.$auth.username;
|
||||
this.password = await this.$auth.password;
|
||||
const success = await this.$auth.autoLogin();
|
||||
if (success) {
|
||||
this.$store.commit("setLoginSuccess", { username: this.username});
|
||||
this.$router.push(this.returnTo);
|
||||
} else {
|
||||
this.showModal = true;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
login() {
|
||||
this.busy = true;
|
||||
this.$auth.login(this.server, this.username, this.password, this.rememberLogin)
|
||||
.then(() => {
|
||||
this.$store.commit("setLoginSuccess", { username: this.username });
|
||||
this.$router.push(this.returnTo);
|
||||
})
|
||||
.catch(err => {
|
||||
this.error = true;
|
||||
})
|
||||
.finally(() => {
|
||||
this.busy = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
58
src/auth/service.ts
Normal file
58
src/auth/service.ts
Normal file
@ -0,0 +1,58 @@
|
||||
import axios from 'axios';
|
||||
|
||||
|
||||
export class AuthService {
|
||||
public server: string = "";
|
||||
public username: string = "";
|
||||
public password: string = "";
|
||||
private authenticated: boolean = false;
|
||||
|
||||
constructor() {
|
||||
this.server = localStorage.getItem("server") || "";
|
||||
this.username = localStorage.getItem("username") || "";
|
||||
this.password = localStorage.getItem("password") || "";
|
||||
}
|
||||
|
||||
private saveSession() {
|
||||
localStorage.setItem("server", this.server);
|
||||
localStorage.setItem("username", this.username);
|
||||
localStorage.setItem("password", this.password);
|
||||
}
|
||||
|
||||
async autoLogin(): Promise<boolean> {
|
||||
if (!this.server || !this.username) {
|
||||
return false;
|
||||
}
|
||||
return this.login(this.server, this.username, this.password, false)
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
}
|
||||
|
||||
async login(server: string, username: string, password: string, remember: boolean) {
|
||||
return axios.get(`${server}/rest/ping.view?u=${username}&p=${password}&v=1.15.0&c=app&f=json`)
|
||||
.then((response) => {
|
||||
const subsonicResponse = response.data["subsonic-response"];
|
||||
if (!subsonicResponse || subsonicResponse.status !== "ok") {
|
||||
const err = new Error(subsonicResponse.status);
|
||||
return Promise.reject(err);
|
||||
}
|
||||
this.authenticated = true;
|
||||
this.server = server;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
if (remember) {
|
||||
this.saveSession();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
logout() {
|
||||
localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
}
|
||||
|
||||
isAuthenticated() {
|
||||
return this.authenticated;
|
||||
}
|
||||
|
||||
}
|
9
src/home/Home.vue
Normal file
9
src/home/Home.vue
Normal file
@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
|
||||
export default Vue.extend({
|
||||
});
|
||||
</script>
|
35
src/library/TrackContextMenu.vue
Normal file
35
src/library/TrackContextMenu.vue
Normal file
@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<b-dropdown variant="link" boundary="window" no-caret toggle-class="p-0">
|
||||
<template #button-content>
|
||||
<Icon>mdi-dots-vertical</Icon>
|
||||
</template>
|
||||
<b-dropdown-item-button @click="toggleStarred()">
|
||||
{{ starred ? 'Unstar' : 'Star' }}
|
||||
</b-dropdown-item-button>
|
||||
<slot :item="track"></slot>
|
||||
</b-dropdown>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
track: { type: Object, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
starred: this.track.starred,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleStarred() {
|
||||
if (this.starred) {
|
||||
this.$api.unstar('track', this.track.id);
|
||||
} else {
|
||||
this.$api.star('track', this.track.id);
|
||||
}
|
||||
this.starred = !this.starred;
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
115
src/library/TrackList.vue
Normal file
115
src/library/TrackList.vue
Normal file
@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-table-simple borderless hover>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="pl-0 pr-0 text-center text-muted"></th>
|
||||
<th class="text-left">Title</th>
|
||||
<th class="text-left">Artist</th>
|
||||
<th v-if="showAlbum" class="text-left">Album</th>
|
||||
<th class="text-right">Duration</th>
|
||||
<th class="text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in tracks" :key="item.id"
|
||||
draggable="true" @dragstart="dragstart(item.id, $event)"
|
||||
:class="{'text-primary': item.id === playingTrackId}">
|
||||
<td class="pl-0 pr-0 text-center text-muted" style="min-width: 20px; max-width: 20px;">
|
||||
<span class="track-status">
|
||||
<template v-if="item.id === playingTrackId">
|
||||
<Icon>{{ isPlaying ? 'mdi-volume-high' : 'mdi-play' }}</Icon>
|
||||
</template>
|
||||
<template v-else>{{ item.track || 1 }}</template>
|
||||
</span>
|
||||
<span class="track-status-hover">
|
||||
<span v-if="item.id === playingTrackId" @click="playPause()">
|
||||
<Icon>{{ isPlaying ? 'mdi-pause' : 'mdi-play' }}</Icon>
|
||||
</span>
|
||||
<span v-else @click="play(index)">
|
||||
<Icon>mdi-play</Icon>
|
||||
</span>
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ item.title }}</td>
|
||||
<td>
|
||||
<template v-if="item.artistId">
|
||||
<router-link :to="{name: 'artist', params: {id: item.artistId}}">
|
||||
{{ item.artist }}
|
||||
</router-link>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.artist }}
|
||||
</template>
|
||||
</td>
|
||||
<td v-if="showAlbum">
|
||||
<router-link :to="{name: 'album', params: {id: item.albumId}}">
|
||||
{{ item.album }}
|
||||
</router-link>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
{{ item.duration | duration }}
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<TrackContextMenu :track="item">
|
||||
<template v-slot="{ item }">
|
||||
<slot name="context-menu" :index="index" :item="item"></slot>
|
||||
</template>
|
||||
</TrackContextMenu>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</b-table-simple>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.track-status-hover {
|
||||
display: none;
|
||||
}
|
||||
tr:hover {
|
||||
.track-status-hover {
|
||||
display: inline;
|
||||
}
|
||||
.track-status {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import { mapActions, mapMutations, mapGetters, mapState } from 'vuex';
|
||||
import TrackContextMenu from "@/library/TrackContextMenu.vue"
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
TrackContextMenu,
|
||||
},
|
||||
props: {
|
||||
tracks: { type: Array, required: true },
|
||||
showAlbum: { type: Boolean, default: false },
|
||||
},
|
||||
computed: {
|
||||
...mapState("player", {
|
||||
isPlaying: "isPlaying",
|
||||
}),
|
||||
...mapGetters({
|
||||
playingTrackId: "player/trackId",
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
...mapMutations({
|
||||
playPause: "player/playPause",
|
||||
}),
|
||||
play(index: number) {
|
||||
this.$store.dispatch('player/play', {
|
||||
index,
|
||||
queue: this.tracks,
|
||||
})
|
||||
},
|
||||
dragstart(id: string, event: any) {
|
||||
console.log("dragstart: " + id)
|
||||
event.dataTransfer.setData("id", id);
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
45
src/library/album/Album.vue
Normal file
45
src/library/album/Album.vue
Normal file
@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<div v-if="album">
|
||||
<div class="row mb-4">
|
||||
<div class="col-auto">
|
||||
<b-img height="300" width="300" :src="album.image"></b-img>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h1>{{ album.name }}</h1>
|
||||
<p>by
|
||||
<router-link :to="{name: 'artist', params: { id: album.artistId }}">
|
||||
{{ album.artist }}
|
||||
</router-link>
|
||||
<span v-if="album.year"> · {{ album.year }}</span>
|
||||
<span v-if="album.genre"> · {{ album.genre }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<TrackList :tracks="album.song"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import TrackList from "@/library/TrackList.vue"
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
TrackList,
|
||||
},
|
||||
props: {
|
||||
id: String
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
album: null,
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
this.album = await this.$api.getAlbumDetails(this.id);
|
||||
}
|
||||
});
|
||||
</script>
|
35
src/library/album/AlbumCard.vue
Normal file
35
src/library/album/AlbumCard.vue
Normal file
@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<div class="card">
|
||||
<img class="card-img-top" :src="item.image">
|
||||
<div class="card-body">
|
||||
<div class=" ">
|
||||
<div class="text-truncate">
|
||||
<router-link :to="{name: 'album', params: { id: item.id } }">
|
||||
<strong>{{ item.name }}</strong>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="text-truncate text-muted">
|
||||
{{ item.artist }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.on-hover {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.show-btns {
|
||||
color: rgba(255, 255, 255, 1) !important;
|
||||
}
|
||||
</style>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
item: Object
|
||||
}
|
||||
});
|
||||
</script>
|
62
src/library/album/AlbumList.vue
Normal file
62
src/library/album/AlbumList.vue
Normal file
@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<div>
|
||||
<Spinner :data="albums" v-slot="{albums: data}">
|
||||
<Tiles :items="albums" v-slot="{ item }" square>
|
||||
<div class="text-truncate">
|
||||
<router-link :to="{name: 'album', params: { id: item.id } }">
|
||||
<strong>{{ item.name }}</strong>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="text-truncate text-muted">
|
||||
<router-link :to="{name: 'artist', params: { id: item.artistId } }">
|
||||
{{ item.artist }}
|
||||
</router-link>
|
||||
</div>
|
||||
</Tiles>
|
||||
</Spinner>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import AlbumCard from "./AlbumCard.vue";
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
AlbumCard
|
||||
},
|
||||
props: {
|
||||
msg: String
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
sort: "newest",
|
||||
albums: null,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
sortOptions() {
|
||||
return [
|
||||
{ text: "A-Z", value: "alphabeticalByName" },
|
||||
{ text: "Date", value: "newest" },
|
||||
{ text: "frequent", value: "frequent" },
|
||||
// { text: "random", value: "random" },
|
||||
// { text: "recent", value: "recent" },
|
||||
// { text: "starred", value: "starred" },
|
||||
]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
sort: {
|
||||
immediate: true,
|
||||
handler(value: string) {
|
||||
this.albums = null;
|
||||
this.$api.getAlbums(value).then(albums => {
|
||||
this.albums = albums;
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
}
|
||||
});
|
||||
</script>
|
21
src/library/artist/ArtistCard.vue
Normal file
21
src/library/artist/ArtistCard.vue
Normal file
@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="text-truncate">
|
||||
<router-link :to="{name: 'artist', params: { id: item.id } }">
|
||||
<strong>{{ item.name }}</strong>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="text-truncate text-muted">
|
||||
<strong>{{ item.albumCount }}</strong> albums
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
item: { type: Object, required: true }
|
||||
}
|
||||
});
|
||||
</script>
|
58
src/library/artist/ArtistDetails.vue
Normal file
58
src/library/artist/ArtistDetails.vue
Normal file
@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<div v-if="item">
|
||||
<div class="row mb-2">
|
||||
<!-- <div class="col"> -->
|
||||
<!-- <b-img height="300" width="300" :src="item.image"></b-img> -->
|
||||
<!-- </div> -->
|
||||
<div class="col col-xl-8">
|
||||
<h1>{{ item.name }}</h1>
|
||||
<p>{{ item.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="pt-5">Albums</h3>
|
||||
<Tiles :items="item.albums" v-slot="{ item }" square>
|
||||
<div class="text-truncate">
|
||||
<router-link :to="{name: 'album', params: { id: item.id } }">
|
||||
<strong>{{ item.name }}</strong>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="text-truncate text-muted">
|
||||
{{ item.artist }}
|
||||
</div>
|
||||
</Tiles>
|
||||
|
||||
<h3 class="pt-5">Similar artist</h3>
|
||||
<Tiles :items="item.similarArtist" v-slot="{ item }">
|
||||
<ArtistCard :item="item"></ArtistCard>
|
||||
</Tiles>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import AlbumCard from "@/library/album/AlbumCard.vue";
|
||||
import ArtistCard from "@/library/artist/ArtistCard.vue";
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
AlbumCard,
|
||||
ArtistCard,
|
||||
},
|
||||
props: {
|
||||
id: String
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
item: null as any,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
id: {
|
||||
immediate: true,
|
||||
async handler(value: string) {
|
||||
this.item = null,
|
||||
this.item = await this.$api.getArtistDetails(this.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
32
src/library/artist/ArtistList.vue
Normal file
32
src/library/artist/ArtistList.vue
Normal file
@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<Tiles :items="items" v-slot="{ item }">
|
||||
<div class="text-truncate">
|
||||
<router-link :to="{name: 'artist', params: { id: item.id } }">
|
||||
<strong>{{ item.name }}</strong>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="text-truncate text-muted">
|
||||
<strong>{{ item.albumCount }}</strong> albums
|
||||
</div>
|
||||
</Tiles>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import ArtistCard from "./ArtistCard.vue";
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
ArtistCard,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
items: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.$api.getArtists().then(items => {
|
||||
this.items = items;
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
27
src/library/genre/GenreDetails.vue
Normal file
27
src/library/genre/GenreDetails.vue
Normal file
@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<div v-if="item">
|
||||
<h1>{{ item.name }}</h1>
|
||||
<TrackList :tracks="item.tracks" show-album/>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import TrackList from "@/library/TrackList.vue"
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
TrackList,
|
||||
},
|
||||
props: {
|
||||
id: String
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
item: null as any,
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.item = await this.$api.getGenreDetails(this.id);
|
||||
}
|
||||
});
|
||||
</script>
|
34
src/library/genre/GenreList.vue
Normal file
34
src/library/genre/GenreList.vue
Normal file
@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<Tiles :items="items">
|
||||
<template v-slot="{ item }">
|
||||
<div class="text-truncate">
|
||||
<router-link :to="{name: 'genre', params: { id: item.id } }">
|
||||
<strong>{{ item.name }}</strong>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="text-truncate text-muted">
|
||||
<strong>{{ item.albumCount }}</strong> albums ·
|
||||
<strong>{{ item.songCount }}</strong> songs
|
||||
</div>
|
||||
</template>
|
||||
</Tiles>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
items: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.$api.getGenres().then(items => {
|
||||
this.items = items;
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
25
src/library/starred/Starred.vue
Normal file
25
src/library/starred/Starred.vue
Normal file
@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<div v-if="items">
|
||||
<TrackList :tracks="items.tracks"/>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import TrackList from "@/library/TrackList.vue"
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
TrackList,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
items: null as any,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$api.getStarred().then(result => {
|
||||
this.items = result;
|
||||
})
|
||||
}
|
||||
});
|
||||
</script>
|
40
src/main.ts
Normal file
40
src/main.ts
Normal file
@ -0,0 +1,40 @@
|
||||
import Vue from 'vue'
|
||||
import Router from "vue-router"
|
||||
import Vuex from "vuex"
|
||||
import BootstrapVue from 'bootstrap-vue'
|
||||
import '@/style/main.scss'
|
||||
import '@/shared/components'
|
||||
import '@/shared/filters'
|
||||
import App from '@/app/App.vue'
|
||||
import {setupRouter} from '@/shared/router'
|
||||
import {setupStore} from '@/shared/store'
|
||||
import { API } from '@/shared/api';
|
||||
import { AuthService } from '@/auth/service';
|
||||
import { connectAudioToStore } from './player/store'
|
||||
|
||||
declare module 'vue/types/vue' {
|
||||
interface Vue {
|
||||
$auth: AuthService
|
||||
$api: API
|
||||
}
|
||||
}
|
||||
|
||||
Vue.config.productionTip = false
|
||||
Vue.use(Router)
|
||||
Vue.use(Vuex);
|
||||
Vue.use(BootstrapVue)
|
||||
|
||||
const authService = new AuthService();
|
||||
const api = new API(authService);
|
||||
const router = setupRouter(authService);
|
||||
const store = setupStore(authService, api);
|
||||
connectAudioToStore(store);
|
||||
|
||||
Vue.prototype.$auth = authService;
|
||||
Vue.prototype.$api = api;
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
94
src/player/Player.vue
Normal file
94
src/player/Player.vue
Normal file
@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<div class="d-flex player">
|
||||
<div v-if="track" class="d-none d-sm-block">
|
||||
<b-img :src="track.image" block width="80px" height="80px"></b-img>
|
||||
</div>
|
||||
<div class="flex-fill">
|
||||
<!-- Progress --->
|
||||
<div class="progress2" @click="seek">
|
||||
<b-progress :value="progress" :max="100" height="4px"></b-progress>
|
||||
</div>
|
||||
<div class="row d-flex align-items-center p-2 m-0">
|
||||
<!-- Track info --->
|
||||
<div class="col d-flex p-0 text-truncate">
|
||||
<div class="d-flex align-items-center">
|
||||
<template v-if="track">
|
||||
<div class="ml-2 align-middle">
|
||||
<div>{{ track.title }}</div>
|
||||
<div>{{ track.artist }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Controls--->
|
||||
<div class="col-auto p-0">
|
||||
<b-button variant="link" class="m-2"
|
||||
:disabled="!hasPrevious" @click="playPrevious">
|
||||
<Icon>mdi-skip-previous</Icon>
|
||||
</b-button>
|
||||
<b-button variant="link" size="lg" class="m-2" @click="playPause">
|
||||
<Icon>{{ isPlaying ? 'mdi-pause' : 'mdi-play' }}</Icon>
|
||||
</b-button>
|
||||
<b-button variant="link" class="m-2"
|
||||
:disabled="!hasNext" @click="playNext">
|
||||
<Icon>mdi-skip-next</Icon>
|
||||
</b-button>
|
||||
</div>
|
||||
<div class="col p-0 text-truncate">
|
||||
<div v-if="track" class="text-right">
|
||||
<span>{{ currentTime | duration }} / {{ duration | duration }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
.progress2 {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import { mapMutations, mapState, mapGetters, mapActions } from 'vuex';
|
||||
|
||||
export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState("player", {
|
||||
isPlaying: (state: any) => state.isPlaying,
|
||||
currentTime: (state: any) => state.currentTime,
|
||||
duration: (state: any) => state.duration,
|
||||
}),
|
||||
...mapGetters("player", [
|
||||
"track",
|
||||
"progress",
|
||||
"hasNext",
|
||||
"hasPrevious",
|
||||
]),
|
||||
},
|
||||
methods: {
|
||||
...mapMutations("player", [
|
||||
"playPause",
|
||||
]),
|
||||
...mapActions("player", [
|
||||
"playNext",
|
||||
"playPrevious",
|
||||
]),
|
||||
seek(event: any) {
|
||||
if (event.target) {
|
||||
const width = event.target.clientWidth;
|
||||
const value = event.offsetX / width
|
||||
this.$store.commit("player/seek", value)
|
||||
// this.internalValue = e.offsetX / width * 100
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
33
src/player/Queue.vue
Normal file
33
src/player/Queue.vue
Normal file
@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div>
|
||||
<TrackList :tracks="tracks">
|
||||
<template #context-menu="{index}">
|
||||
<b-dropdown-item-button @click="remove(index)">
|
||||
Remove
|
||||
</b-dropdown-item-button>
|
||||
</template>
|
||||
</TrackList>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import { mapState, mapMutations } from 'vuex';
|
||||
import TrackList from "@/library/TrackList.vue";
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
TrackList,
|
||||
},
|
||||
computed: {
|
||||
...mapState("player", {
|
||||
tracks: (state: any) => state.queue,
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
...mapMutations("player", {
|
||||
play: "playQueueIndex",
|
||||
remove: "removeFromQueue",
|
||||
}),
|
||||
}
|
||||
});
|
||||
</script>
|
27
src/player/TrackInfo.vue
Normal file
27
src/player/TrackInfo.vue
Normal file
@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="col" d-flex fill-height grow>
|
||||
<h1>{{ track.name }}</h1>
|
||||
<div>{{ track.artist }}</div>
|
||||
<v-card color=blue tile height="100%" width="100%"></v-card>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.on-hover {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.show-btns {
|
||||
color: rgba(255, 255, 255, 1) !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
album: Object
|
||||
}
|
||||
});
|
||||
</script>
|
127
src/player/store.ts
Normal file
127
src/player/store.ts
Normal file
@ -0,0 +1,127 @@
|
||||
import { Store, Module } from 'vuex'
|
||||
|
||||
|
||||
interface State {
|
||||
queue: any[];
|
||||
queueIndex: number;
|
||||
isPlaying: boolean;
|
||||
duration: number; // duration of current track in seconds
|
||||
currentTime: number; // position of current track in seconds
|
||||
}
|
||||
|
||||
const audio = new Audio();
|
||||
const storedQueue = JSON.parse(localStorage.getItem("queue") || "[]");
|
||||
const storedQueueIndex = parseInt(localStorage.getItem("queueIndex") || "-1");
|
||||
if (storedQueueIndex > -1 && storedQueueIndex < storedQueue.length) {
|
||||
audio.src = storedQueue[storedQueueIndex].url;
|
||||
}
|
||||
|
||||
export const playerModule: Module<State, any> = {
|
||||
namespaced: true,
|
||||
state: {
|
||||
queue: storedQueue,
|
||||
queueIndex: storedQueueIndex,
|
||||
isPlaying: false,
|
||||
duration: 0,
|
||||
currentTime: 0,
|
||||
},
|
||||
|
||||
mutations: {
|
||||
playPause(state: State) {
|
||||
if (state.isPlaying) {
|
||||
state.isPlaying = false;
|
||||
audio.pause();
|
||||
} else {
|
||||
state.isPlaying = true;
|
||||
audio.play();
|
||||
}
|
||||
},
|
||||
seek(state, value: number) {
|
||||
console.log("seek: " + value);
|
||||
if (state.queueIndex != -1) {
|
||||
const seconds = state.duration * value;
|
||||
audio.currentTime = seconds;
|
||||
}
|
||||
},
|
||||
setQueueAndPlay(state, { queue, index }) {
|
||||
state.queue = queue;
|
||||
state.queueIndex = index;
|
||||
localStorage.setItem("queue", JSON.stringify(queue));
|
||||
localStorage.setItem("queueIndex", index);
|
||||
state.isPlaying = true;
|
||||
audio.src = queue[index].url;
|
||||
audio.play();
|
||||
},
|
||||
playQueueIndex(state, index) {
|
||||
if (state.queue.length === 0) {
|
||||
return;
|
||||
}
|
||||
index = index < state.queue.length ? index : 0;
|
||||
state.isPlaying = true;
|
||||
state.queueIndex = index;
|
||||
audio.src = state.queue[index].url;
|
||||
audio.play();
|
||||
},
|
||||
removeFromQueue(state, index) {
|
||||
state.queue.splice(index, 1);
|
||||
if (index < state.queueIndex) {
|
||||
state.queueIndex--;
|
||||
}
|
||||
},
|
||||
setProgress(state: State, value: any) {
|
||||
state.currentTime = value;
|
||||
},
|
||||
setDuration(state: State, value: any) {
|
||||
state.duration = value;
|
||||
},
|
||||
},
|
||||
|
||||
actions: {
|
||||
play({ commit }, { queue, index }) {
|
||||
commit('setQueueAndPlay', { index, queue });
|
||||
},
|
||||
playNext({ commit, state }) {
|
||||
commit("playQueueIndex", state.queueIndex + 1);
|
||||
},
|
||||
playPrevious({ commit, state }) {
|
||||
commit("playQueueIndex", state.queueIndex - 1);
|
||||
},
|
||||
},
|
||||
|
||||
getters: {
|
||||
track(state) {
|
||||
if (state.queueIndex != -1) {
|
||||
return state.queue[state.queueIndex];
|
||||
}
|
||||
return null;
|
||||
},
|
||||
trackId(state, getters): number {
|
||||
return getters.track ? getters.track.id : -1;
|
||||
},
|
||||
progress(state) {
|
||||
if (state.currentTime > -1 && state.duration > 0) {
|
||||
return (state.currentTime / state.duration) * 100;
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
hasNext(state) {
|
||||
return state.queueIndex < state.queue.length - 1;
|
||||
},
|
||||
hasPrevious(state) {
|
||||
return state.queueIndex > 0;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
export function connectAudioToStore(store: Store<any>) {
|
||||
audio.ontimeupdate = (event) => {
|
||||
store.commit("player/setProgress", audio.currentTime)
|
||||
};
|
||||
audio.ondurationchange = (event) => {
|
||||
store.commit("player/setDuration", audio.duration);
|
||||
}
|
||||
audio.onended = (event) => {
|
||||
store.dispatch("player/playNext");
|
||||
}
|
||||
}
|
48
src/playlist/Playlist.vue
Normal file
48
src/playlist/Playlist.vue
Normal file
@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<Spinner :data="playlist" v-slot="{ data }">
|
||||
<h1>{{ data.name }}</h1>
|
||||
<TrackList :tracks="data.tracks" show-album @remove="remove(index)">
|
||||
<template v-slot:context-menu="{index}">
|
||||
<b-dropdown-item-button @click="remove(index)">
|
||||
Remove
|
||||
</b-dropdown-item-button>
|
||||
</template>
|
||||
</TrackList>
|
||||
</Spinner>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import TrackList from "@/library/TrackList.vue";
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
TrackList,
|
||||
},
|
||||
props: {
|
||||
id: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
playlist: null as any,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'id': {
|
||||
immediate: true,
|
||||
handler(value: string) {
|
||||
this.playlist = null;
|
||||
this.$api.getPlaylist(value).then(playlist => {
|
||||
this.playlist = playlist;//.sort((a: any, b:any) => a.created.localeCompare(b.created));
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
remove(index: number) {
|
||||
console.log("remove: " + index)
|
||||
this.$api.removeFromPlaylist(this.id, index.toString());
|
||||
this.playlist.tracks.splice(index, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
47
src/playlist/PlaylistList.vue
Normal file
47
src/playlist/PlaylistList.vue
Normal file
@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-table-simple>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Created</th>
|
||||
<th>Updated</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in playlists" :key="item.id">
|
||||
<td>
|
||||
<router-link :to="{name: 'playlist', params: { id: item.id } }">
|
||||
{{ item.name }}
|
||||
</router-link>
|
||||
</td>
|
||||
<td>{{ item.created | dateTime }}</td>
|
||||
<td>{{ item.changed | dateTime }}</td>
|
||||
<td class="text-right">
|
||||
<OverflowMenu>
|
||||
<b-dropdown-item-btn @click="deletePlaylist(item.id)">Delete</b-dropdown-item-btn>
|
||||
</OverflowMenu>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</b-table-simple>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import { mapState, mapActions } from 'vuex';
|
||||
|
||||
export default Vue.extend({
|
||||
computed: {
|
||||
...mapState([
|
||||
"playlists"
|
||||
]),
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
deletePlaylist: 'deletePlaylist'
|
||||
})
|
||||
}
|
||||
});
|
||||
</script>
|
72
src/playlist/PlaylistNav.vue
Normal file
72
src/playlist/PlaylistNav.vue
Normal file
@ -0,0 +1,72 @@
|
||||
<template>
|
||||
<div>
|
||||
<span class="nav-link">
|
||||
<small class="text-uppercase text-muted font-weight-bold">
|
||||
Playlists
|
||||
<button class="btn btn-link btn-sm p-0 float-right" @click="showModal = true">
|
||||
<Icon>mdi-plus</Icon>
|
||||
</button>
|
||||
</small>
|
||||
</span>
|
||||
|
||||
<router-link class="nav-item nav-link" :to="{name: 'playlist', params: { id: 'random' }}">
|
||||
<Icon>mdi-view-list</Icon> Random
|
||||
</router-link>
|
||||
|
||||
<router-link v-for="item in playlists" :key="item.id"
|
||||
:to="{name: 'playlist', params: { id: item.id }}"
|
||||
class="nav-item nav-link">
|
||||
<span @dragover="onDragover" @drop="onDrop(item.id, $event)">
|
||||
<Icon>mdi-playlist-music</Icon> {{ item.name }}
|
||||
</span>
|
||||
</router-link>
|
||||
|
||||
<router-link class="nav-item nav-link" :to="{name: 'playlists'}">
|
||||
More...
|
||||
</router-link>
|
||||
|
||||
<b-modal v-model="showModal" title="New playlist">
|
||||
<b-form-group label="Name">
|
||||
<b-form-input type="text" v-model="playlistName"/>
|
||||
</b-form-group>
|
||||
<template #modal-footer>
|
||||
<b-button variant="primary" @click="createPlaylist">Create</b-button>
|
||||
</template>
|
||||
</b-modal>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import { mapState } from 'vuex';
|
||||
|
||||
export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
playlistName: "",
|
||||
showModal: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
playlists() {
|
||||
return this.$store.state.playlists.slice(0, 10);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
createPlaylist() {
|
||||
this.$store.dispatch("createPlaylist", this.playlistName);
|
||||
this.playlistName = "";
|
||||
this.showModal = false;
|
||||
},
|
||||
onDrop(playlistId: string, event: any) {
|
||||
console.log("onDrop")
|
||||
event.preventDefault();
|
||||
const trackId = event.dataTransfer.getData("id");
|
||||
this.$store.dispatch("addTrackToPlaylist", { playlistId, trackId })
|
||||
},
|
||||
onDragover(event: any) {
|
||||
console.log("onDragover")
|
||||
event.preventDefault();
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
42
src/playlist/RandomSongs.vue
Normal file
42
src/playlist/RandomSongs.vue
Normal file
@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div v-if="items">
|
||||
<TrackList :tracks="items" show-album/>
|
||||
<table class="table">
|
||||
<thead>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in items" :key="item.id">
|
||||
<td>
|
||||
<Icon @click="() => {}">mdi-play-outline</Icon>
|
||||
<Icon @click="() => {}">mdi-plus</Icon>
|
||||
</td>
|
||||
<td>{{ item.artist }}</td>
|
||||
<td>{{ item.album }}</td>
|
||||
<td>{{ item.duration | duration }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import TrackList from "@/library/TrackList.vue";
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
TrackList,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
items: [] as any[],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.$api.getRandomSongs().then(items => {
|
||||
this.loading = false;
|
||||
this.items = items;//.sort((a: any, b:any) => a.created.localeCompare(b.created));
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
24
src/search/SearchForm.vue
Normal file
24
src/search/SearchForm.vue
Normal file
@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<div>
|
||||
<form class="form-inline my-2 my-lg-0" @submit.prevent="search">
|
||||
<input
|
||||
class="form-control mr-sm-2"
|
||||
type="search" placeholder="Search"
|
||||
v-model="query">
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
query: String
|
||||
},
|
||||
methods: {
|
||||
search(): void {
|
||||
this.$router.push({ name: 'search', query: { q: this.query } });
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
102
src/search/SearchResult.vue
Normal file
102
src/search/SearchResult.vue
Normal file
@ -0,0 +1,102 @@
|
||||
<template>
|
||||
<div v-if="result">
|
||||
|
||||
<div>
|
||||
<h5 class="text-uppercase">Artists</h5>
|
||||
<div class="d-flex">
|
||||
<div class="tiles">
|
||||
<div v-for="item in result.artists" :key="item.id">
|
||||
<ArtistCard :item="item"></ArtistCard>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<b-table-simple hover borderless>
|
||||
<tbody>
|
||||
<tr v-for="item in result.artists" :key="item.id">
|
||||
<td>{{ item.name }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</b-table-simple>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h5 class="text-uppercase">Albums</h5>
|
||||
<div class="d-flex">
|
||||
<div class="tiles">
|
||||
<div v-for="item in result.albums" :key="item.id">
|
||||
<AlbumCard :item="item"></AlbumCard>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<b-table-simple hover borderless>
|
||||
<tbody>
|
||||
<tr v-for="item in result.albums">
|
||||
<td>{{ item.name }}</td>
|
||||
<td>{{ item.artist }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</b-table-simple>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h5 class="text-uppercase">Tracks</h5>
|
||||
<b-table-simple hover>
|
||||
<!-- <thead>
|
||||
<tr>
|
||||
<th class="text-left"></th>
|
||||
<th class="text-left">Title</th>
|
||||
<th class="text-left">Artist</th>
|
||||
<th class="text-left">Album</th>
|
||||
<th class="text-left">Duration</th>
|
||||
<th class="text-left">Actions</th>
|
||||
</tr>
|
||||
</thead> -->
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in result.tracks">
|
||||
<td>
|
||||
<span @click="play(index)">
|
||||
<Icon>mdi-play</Icon>
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ item.title }}</td>
|
||||
<td>{{ item.artist }}</td>
|
||||
<td>{{ item.album }}</td>
|
||||
<!-- <td>{{ item.duration | duration }}</td> -->
|
||||
</tr>
|
||||
</tbody>
|
||||
</b-table-simple>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import AlbumCard from "@/library/album/AlbumCard.vue";
|
||||
import ArtistCard from "@/library/artist/ArtistCard.vue";
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
AlbumCard,
|
||||
ArtistCard,
|
||||
},
|
||||
props: {
|
||||
query: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: null as any,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
query: {
|
||||
immediate: true,
|
||||
handler(value: string) {
|
||||
this.$api.search(this.query).then(result => {
|
||||
this.result = result;
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
267
src/shared/api.ts
Normal file
267
src/shared/api.ts
Normal file
@ -0,0 +1,267 @@
|
||||
import axios, { AxiosRequestConfig, AxiosInstance } from "axios"
|
||||
import { AuthService } from '@/auth/service';
|
||||
|
||||
|
||||
export class API {
|
||||
readonly http: AxiosInstance;
|
||||
readonly get: (path: string, params?: any) => Promise<any>;
|
||||
readonly post: (path: string, params?: any) => Promise<any>;
|
||||
|
||||
constructor(private auth: AuthService) {
|
||||
|
||||
this.http = axios.create({});
|
||||
this.http.interceptors.request.use((config: AxiosRequestConfig) => {
|
||||
config.params = config.params || {};
|
||||
config.baseURL = this.auth.server
|
||||
config.params.u = this.auth.username;
|
||||
config.params.p = this.auth.password;
|
||||
config.params.c = "app";
|
||||
config.params.f = "json";
|
||||
config.params.v = "1.15.0";
|
||||
return config;
|
||||
});
|
||||
|
||||
this.get = (path: string, params: any = {}) => {
|
||||
return this.http.get(path, {params}).then(response => {
|
||||
const subsonicResponse = response.data["subsonic-response"];
|
||||
if (subsonicResponse.status !== "ok") {
|
||||
const err = new Error(subsonicResponse.status);
|
||||
return Promise.reject(err);
|
||||
}
|
||||
return Promise.resolve(subsonicResponse);
|
||||
})
|
||||
}
|
||||
|
||||
this.post = (path: string, params: any = {}) => {
|
||||
return this.http.post(path, params).then(response => {
|
||||
const subsonicResponse = response.data["subsonic-response"];
|
||||
if (subsonicResponse.status !== "ok") {
|
||||
const err = new Error(subsonicResponse.status);
|
||||
return Promise.reject(err);
|
||||
}
|
||||
return Promise.resolve(subsonicResponse);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async getGenres() {
|
||||
const response = await this.get("rest/getGenres", {});
|
||||
return response.genres.genre.map((item: any) => ({
|
||||
id: encodeURIComponent(item.value),
|
||||
name: item.value,
|
||||
...item,
|
||||
}));
|
||||
}
|
||||
|
||||
async getGenreDetails(id: string) {
|
||||
const params = {
|
||||
genre: decodeURIComponent(id),
|
||||
count: 500,
|
||||
offset: 0,
|
||||
}
|
||||
const response = await this.get("rest/getSongsByGenre", params);
|
||||
return {
|
||||
name: id,
|
||||
tracks: this.normalizeTrackList(response.songsByGenre.song),
|
||||
}
|
||||
}
|
||||
|
||||
async getArtists(offset: any = 0, size: any = 400) {
|
||||
const params = {
|
||||
type: "random",
|
||||
offset,
|
||||
size,
|
||||
};
|
||||
const data = await this.get("rest/getArtists", params);
|
||||
return data.artists.index.flatMap((index: any) => index.artist.map((artist: any) => ({
|
||||
id: artist.id,
|
||||
name: artist.name,
|
||||
...artist
|
||||
})));
|
||||
}
|
||||
|
||||
async getAlbums(sort: string) {
|
||||
const params = {
|
||||
type: sort,
|
||||
offset: "0",
|
||||
size: "500",
|
||||
};
|
||||
const data = await this.get("rest/getAlbumList2", params);
|
||||
return data.albumList2.album.map((item: any) => ({
|
||||
...item,
|
||||
image: item.coverArt ? this.getCoverArtUrl(item) : undefined,
|
||||
}));
|
||||
}
|
||||
|
||||
async getArtistDetails(id: string) {
|
||||
const params = { id };
|
||||
const [info1, info2] = await Promise.all([
|
||||
this.get("rest/getArtist", params).then(r => r.artist),
|
||||
this.get("rest/getArtistInfo2", params).then(r => r.artistInfo2),
|
||||
])
|
||||
return {
|
||||
info1,
|
||||
info2,
|
||||
id: info1.id,
|
||||
name: info1.name,
|
||||
description: info2.biography,
|
||||
image: info2.largeImageUrl || info2.mediumImageUrl || info2.smallImageUrl,
|
||||
lastFmUrl: info2.lastFmUrl,
|
||||
musicBrainzId: info2.musicBrainzId,
|
||||
albums: info1.album.map((album: any) => this.normalizeAlbumResponse(album)),
|
||||
similarArtist: (info2.similarArtist || []).map((artist: any) => ({
|
||||
id: artist.id,
|
||||
name: artist.name,
|
||||
...artist
|
||||
}))
|
||||
};
|
||||
}
|
||||
|
||||
async getAlbumDetails(id: string) {
|
||||
const params = {id};
|
||||
const data = await this.get("rest/getAlbum", params);
|
||||
const item = data.album;
|
||||
const image = this.getCoverArtUrl(item);
|
||||
const trackList = item.song.map((s: any) => ({
|
||||
...s,
|
||||
image,
|
||||
url: this.getStreamUrl(s.id),
|
||||
}))
|
||||
return {
|
||||
...item,
|
||||
image,
|
||||
song: trackList,
|
||||
};
|
||||
}
|
||||
|
||||
async getPlaylists() {
|
||||
const response = await this.get("rest/getPlaylists");
|
||||
return response.playlists.playlist.map((playlist: any) => ({
|
||||
...playlist,
|
||||
name: playlist.name || "(Unnamed)",
|
||||
}));
|
||||
}
|
||||
|
||||
async getPlaylist(id: string) {
|
||||
if (id === 'random') {
|
||||
return {
|
||||
id,
|
||||
name: 'Random',
|
||||
tracks: await this.getRandomSongs(),
|
||||
};
|
||||
}
|
||||
const response = await this.get("rest/getPlaylist", { id });
|
||||
return {
|
||||
...response.playlist,
|
||||
name: response.playlist.name || "(Unnamed)",
|
||||
tracks: this.normalizeTrackList(response.playlist.entry || []),
|
||||
};
|
||||
}
|
||||
|
||||
async createPlaylist(name: string) {
|
||||
await this.get("rest/createPlaylist", { name });
|
||||
return this.getPlaylists();
|
||||
}
|
||||
|
||||
async deletePlaylist(id: string) {
|
||||
await this.get("rest/deletePlaylist", { id });
|
||||
}
|
||||
|
||||
async addToPlaylist(playlistId: string, trackId: string) {
|
||||
const params = {
|
||||
playlistId,
|
||||
songIdToAdd: trackId,
|
||||
}
|
||||
await this.get("rest/updatePlaylist", params);
|
||||
}
|
||||
|
||||
async removeFromPlaylist(playlistId: string, index: string) {
|
||||
const params = {
|
||||
playlistId,
|
||||
songIndexToRemove: index,
|
||||
}
|
||||
await this.get("rest/updatePlaylist", params);
|
||||
}
|
||||
|
||||
async getRandomSongs() {
|
||||
const params = {
|
||||
size: 200,
|
||||
};
|
||||
const data = await this.get("rest/getRandomSongs", params);
|
||||
return this.normalizeTrackList(data.randomSongs.song);
|
||||
}
|
||||
|
||||
async getStarred() {
|
||||
const [tracks, albums] = await Promise.all([
|
||||
this.get("rest/getStarred2").then(r => r.starred2.song),
|
||||
this.get("rest/getAlbumList2", { type: 'starred' }).then(r => r.albumList2),
|
||||
this.get("rest/getAlbumList2", { type: 'starred' }).then(r => r.albumList2),
|
||||
]);
|
||||
return { tracks, albums }
|
||||
}
|
||||
|
||||
async star(type: 'track' | 'album' | 'artist', id: string) {
|
||||
const params = {
|
||||
id: type === 'track' ? id : undefined,
|
||||
albumId: type === 'album' ? id : undefined,
|
||||
artistId: type === 'artist' ? id : undefined,
|
||||
}
|
||||
await this.get("rest/star", params);
|
||||
}
|
||||
|
||||
async unstar(type: 'track' | 'album' | 'artist', id: string) {
|
||||
const params = {
|
||||
id: type === 'track' ? id : undefined,
|
||||
albumId: type === 'album' ? id : undefined,
|
||||
artistId: type === 'artist' ? id : undefined,
|
||||
}
|
||||
await this.get("rest/unstar", params);
|
||||
}
|
||||
|
||||
async search(query: string) {
|
||||
const params = {
|
||||
query,
|
||||
};
|
||||
const data = await this.get("rest/search3", params);
|
||||
return {
|
||||
tracks: data.searchResult3.song || [],
|
||||
albums: (data.searchResult3.album || []).map((x: any) => this.normalizeAlbumResponse(x)),
|
||||
artists: (data.searchResult3.artist || []).map((x: any) => this.normalizeArtistResponse(x)),
|
||||
};
|
||||
}
|
||||
|
||||
private normalizeTrackList(items: any[]) {
|
||||
return items.map((item => ({
|
||||
...item,
|
||||
url: this.getStreamUrl(item.id),
|
||||
image: this.getCoverArtUrl(item),
|
||||
})))
|
||||
}
|
||||
|
||||
private normalizeAlbumResponse(item: any) {
|
||||
return {
|
||||
...item,
|
||||
image: this.getCoverArtUrl(item)
|
||||
}
|
||||
}
|
||||
|
||||
private normalizeArtistResponse(item: any) {
|
||||
return {
|
||||
...item,
|
||||
image: this.getCoverArtUrl(item)
|
||||
}
|
||||
}
|
||||
|
||||
private getCoverArtUrl(item: any) {
|
||||
if (!item.coverArt) {
|
||||
return undefined;
|
||||
}
|
||||
const { server, username, password } = this.auth;
|
||||
return `${server}/rest/getCoverArt?id=${item.coverArt}&v=1.15.0&u=${username}&p=${password}&c=test&size=300`
|
||||
}
|
||||
|
||||
private getStreamUrl(id: any) {
|
||||
const { server, username, password } = this.auth;
|
||||
return `${server}/rest/stream?id=${id}&format=raw&v=1.15.0&u=${username}&p=${password}&c=test&size=300`
|
||||
}
|
||||
}
|
8
src/shared/components/Icon.vue
Normal file
8
src/shared/components/Icon.vue
Normal file
@ -0,0 +1,8 @@
|
||||
<template>
|
||||
<span :class="`mdi ${$slots.default[0].text}`"></span>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
|
||||
export default Vue.extend({});
|
||||
</script>
|
52
src/shared/components/ImgContainer.vue
Normal file
52
src/shared/components/ImgContainer.vue
Normal file
@ -0,0 +1,52 @@
|
||||
<template functional>
|
||||
<div class="fixed-img bg-secondary">
|
||||
<div class="fixed-img-inner">
|
||||
<img v-if="props.src" :src="props.src">
|
||||
<div v-else class="text-muted">
|
||||
<Icon>mdi-music</Icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss">
|
||||
.fixed-img-sq {
|
||||
padding-bottom: 100%;
|
||||
}
|
||||
.fixed-img-rect {
|
||||
padding-bottom: 70%;
|
||||
}
|
||||
.fixed-img {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
.tile-img-inner {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
img {
|
||||
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
span {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-size: 4.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
square: { type: Boolean, default: false },
|
||||
}
|
||||
});
|
||||
</script>
|
13
src/shared/components/OverflowMenu.vue
Normal file
13
src/shared/components/OverflowMenu.vue
Normal file
@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<b-dropdown variant="link" boundary="window" no-caret toggle-class="p-0">
|
||||
<template #button-content>
|
||||
<Icon>mdi-dots-vertical</Icon>
|
||||
</template>
|
||||
<slot/>
|
||||
</b-dropdown>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
|
||||
export default Vue.extend({});
|
||||
</script>
|
12
src/shared/components/Spinner.vue
Normal file
12
src/shared/components/Spinner.vue
Normal file
@ -0,0 +1,12 @@
|
||||
<template functional>
|
||||
<div>
|
||||
<slot v-if="props.data" :data="props.data"></slot>
|
||||
<div v-else class="text-center">
|
||||
<span class="spinner-grow"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
export default Vue.extend({})
|
||||
</script>
|
79
src/shared/components/Tiles.vue
Normal file
79
src/shared/components/Tiles.vue
Normal file
@ -0,0 +1,79 @@
|
||||
<template functional>
|
||||
<div class="tiles" :class="props.square ? 'tiles-sq' : 'tiles-rect'">
|
||||
<div v-for="(item, index) in props.items" :key="item.id">
|
||||
<div class="card">
|
||||
<div class="tile-img bg-secondary">
|
||||
<div class="tile-img-inner">
|
||||
<img v-if="item.image" :src="item.image">
|
||||
<div v-else class="fallback-img text-muted">
|
||||
<Icon>mdi-music</Icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<slot :item="item" :index="index"></slot>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss">
|
||||
.tiles {
|
||||
display: grid;
|
||||
grid-gap: 12px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
}
|
||||
@media(max-width: 442px) { // 15px padding + 200px tile + 12px gap + 200px tile + 15px padding
|
||||
.tiles {
|
||||
grid-gap: 8px;
|
||||
grid-template-columns: repeat(2, minmax(1px, 1fr))
|
||||
}
|
||||
}
|
||||
|
||||
.tiles-sq {
|
||||
.tile-img {
|
||||
padding-bottom: 100%;
|
||||
}
|
||||
}
|
||||
.tiles-rect {
|
||||
.tile-img {
|
||||
padding-bottom: 70%;
|
||||
}
|
||||
}
|
||||
.tile-img {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
.tile-img-inner {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.fallback-img {
|
||||
*{
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-size: 4.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
items: { type: Array, required: true },
|
||||
square: { type: Boolean, default: false },
|
||||
}
|
||||
});
|
||||
</script>
|
19
src/shared/components/index.ts
Normal file
19
src/shared/components/index.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import Vue from 'vue';
|
||||
import Icon from "./Icon.vue";
|
||||
import OverflowMenu from "./OverflowMenu.vue";
|
||||
import Spinner from "./Spinner.vue";
|
||||
import Tiles from "./Tiles.vue";
|
||||
|
||||
const components = {
|
||||
Icon,
|
||||
OverflowMenu,
|
||||
Spinner,
|
||||
Tiles,
|
||||
};
|
||||
|
||||
type Key = keyof typeof components;
|
||||
|
||||
Object.keys(components).forEach((_key) => {
|
||||
const key = _key as keyof typeof components;
|
||||
Vue.component(key, components[key]);
|
||||
});
|
12
src/shared/filters.ts
Normal file
12
src/shared/filters.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
|
||||
Vue.filter("duration", (value: number) => {
|
||||
const minutes = Math.floor(value / 60);
|
||||
const seconds = Math.floor(value % 60);
|
||||
return (minutes < 10 ? '0' : '') + minutes + ':' + (seconds < 10 ? '0' : '') + seconds;
|
||||
})
|
||||
|
||||
Vue.filter("dateTime", (value: string) => {
|
||||
return value;
|
||||
})
|
118
src/shared/router.ts
Normal file
118
src/shared/router.ts
Normal file
@ -0,0 +1,118 @@
|
||||
import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
import Login from '@/auth/Login.vue'
|
||||
import Queue from '@/player/Queue.vue'
|
||||
import Home from '@/home/Home.vue'
|
||||
import AlbumList from '@/library/album/AlbumList.vue'
|
||||
import ArtistDetails from '@/library/artist/ArtistDetails.vue'
|
||||
import ArtistList from '@/library/artist/ArtistList.vue'
|
||||
import Album from '@/library/album/Album.vue'
|
||||
import RandomSongs from '@/playlist/RandomSongs.vue'
|
||||
import GenreList from '@/library/genre/GenreList.vue'
|
||||
import GenreDetails from '@/library/genre/GenreDetails.vue'
|
||||
import Starred from '@/library/starred/Starred.vue'
|
||||
import Playlist from '@/playlist/Playlist.vue'
|
||||
import PlaylistList from '@/playlist/PlaylistList.vue'
|
||||
import SearchResult from '@/search/SearchResult.vue'
|
||||
import { AuthService } from '@/auth/service';
|
||||
|
||||
|
||||
export function setupRouter(auth: AuthService) {
|
||||
const router = new Router({
|
||||
mode: 'history',
|
||||
linkExactActiveClass: 'active',
|
||||
base: process.env.BASE_URL,
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Home
|
||||
},
|
||||
{
|
||||
name: 'login',
|
||||
path: '/login',
|
||||
component: Login,
|
||||
props: (route) => ({
|
||||
returnTo: route.query.returnTo,
|
||||
})
|
||||
},
|
||||
{
|
||||
name: 'queue',
|
||||
path: '/queue',
|
||||
component: Queue,
|
||||
},
|
||||
{
|
||||
name: 'albums',
|
||||
path: '/albums',
|
||||
component: AlbumList
|
||||
},
|
||||
{
|
||||
name: 'album',
|
||||
path: '/album/:id',
|
||||
component: Album,
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
name: 'artists',
|
||||
path: '/artists',
|
||||
component: ArtistList
|
||||
},
|
||||
{
|
||||
name: 'artist',
|
||||
path: '/artist/:id',
|
||||
component: ArtistDetails,
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
name: 'genres',
|
||||
path: '/genres',
|
||||
component: GenreList,
|
||||
},
|
||||
{
|
||||
name: 'genre',
|
||||
path: '/genre/:id',
|
||||
component: GenreDetails,
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
name: 'starred',
|
||||
path: '/starred',
|
||||
component: Starred,
|
||||
},
|
||||
{
|
||||
name: 'playlists',
|
||||
path: '/playlists',
|
||||
component: PlaylistList,
|
||||
},
|
||||
{
|
||||
name: 'playlist',
|
||||
path: '/playlist/:id',
|
||||
component: Playlist,
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
name: 'playlist-random',
|
||||
path: '/random',
|
||||
component: RandomSongs,
|
||||
},
|
||||
{
|
||||
name: 'search',
|
||||
path: '/search',
|
||||
component: SearchResult,
|
||||
props: (route) => ({
|
||||
query: route.query.q,
|
||||
})
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.name !== 'login' && !auth.isAuthenticated()) {
|
||||
next({name: 'login', query: { returnTo: to.fullPath }});
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
return router;
|
||||
}
|
82
src/shared/store.ts
Normal file
82
src/shared/store.ts
Normal file
@ -0,0 +1,82 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex, { Module } from 'vuex'
|
||||
import { ActionContext } from "vuex"
|
||||
import { playerModule } from "@/player/store"
|
||||
import axios from 'axios';
|
||||
import { AuthService } from '@/auth/service';
|
||||
import { API } from './api';
|
||||
|
||||
interface State {
|
||||
isLoggedIn: boolean;
|
||||
username: null | string;
|
||||
showMenu: boolean;
|
||||
errors: any[];
|
||||
playlists: any[];
|
||||
}
|
||||
|
||||
const setupRootModule = (authService: AuthService, api: API): Module<State, any> => ({
|
||||
state: {
|
||||
isLoggedIn: false,
|
||||
username: null,
|
||||
showMenu: false,
|
||||
errors: [],
|
||||
playlists: [],
|
||||
},
|
||||
mutations: {
|
||||
setLoginSuccess(state, { username }) {
|
||||
state.isLoggedIn = true;
|
||||
state.username = username;
|
||||
},
|
||||
toggleMenu(state) {
|
||||
state.showMenu = !state.showMenu;
|
||||
},
|
||||
setPlaylists(state, playlists: any[]) {
|
||||
state.playlists = playlists;
|
||||
},
|
||||
removePlaylist(state, id: string) {
|
||||
state.playlists = state.playlists.filter(p => p.id !== id);
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
loadPlaylists({ commit }) {
|
||||
api.getPlaylists().then(result => {
|
||||
commit("setPlaylists", result);
|
||||
})
|
||||
},
|
||||
createPlaylist({ commit }, name) {
|
||||
api.createPlaylist(name).then(result => {
|
||||
commit("setPlaylists", result);
|
||||
})
|
||||
},
|
||||
addTrackToPlaylist({ }, { playlistId, trackId }) {
|
||||
api.addToPlaylist(playlistId, trackId);
|
||||
},
|
||||
deletePlaylist({ commit, state }, id) {
|
||||
api.deletePlaylist(id).then(() => {
|
||||
commit("removePlaylist", id)
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export function setupStore(authService: AuthService, api: API) {
|
||||
const store = new Vuex.Store({
|
||||
strict: true,
|
||||
...setupRootModule(authService, api),
|
||||
modules: {
|
||||
player: {
|
||||
namespaced: true,
|
||||
...playerModule
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
store.watch(
|
||||
(state) => state.isLoggedIn,
|
||||
() => {
|
||||
store.dispatch("loadPlaylists")
|
||||
}
|
||||
);
|
||||
|
||||
return store;
|
||||
}
|
4
src/shims-vue.d.ts
vendored
Normal file
4
src/shims-vue.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
declare module '*.vue' {
|
||||
import Vue from 'vue'
|
||||
export default Vue
|
||||
}
|
23
src/style/main.scss
Normal file
23
src/style/main.scss
Normal file
@ -0,0 +1,23 @@
|
||||
@import '~roboto-fontface/css/roboto/roboto-fontface.css';
|
||||
@import '~@mdi/font/css/materialdesignicons.css';
|
||||
|
||||
$enable-rounded: false;
|
||||
$enable-print-styles: false;
|
||||
.breadcrumb {
|
||||
background: none !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
@import './theme.scss';
|
||||
|
||||
a.active {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
// color: $primary;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@import '~bootstrap';
|
||||
@import '~bootstrap-vue';
|
31
src/style/theme.scss
Normal file
31
src/style/theme.scss
Normal file
@ -0,0 +1,31 @@
|
||||
// $BASE: #080808;
|
||||
// $BASE_EVEVATED: #222;
|
||||
$BASE: #000;
|
||||
$BASE_EVEVATED: rgb(25, 25, 25);
|
||||
|
||||
$primary: #09f;
|
||||
$danger: #e54b4b;
|
||||
|
||||
// $black: #000 !default;
|
||||
|
||||
$body-bg: $BASE;
|
||||
$body-color: #ccc;
|
||||
$link-color: #ccc;
|
||||
$text-muted: #999;
|
||||
// strong { color: #ddd }
|
||||
|
||||
// Cards
|
||||
$card-cap-bg: $BASE_EVEVATED;
|
||||
$card-bg: $BASE_EVEVATED;
|
||||
|
||||
$modal-content-bg: $BASE_EVEVATED;
|
||||
|
||||
$input-bg: $BASE_EVEVATED;
|
||||
$input-color: #ccc !default;
|
||||
|
||||
$progress-bg: rgb(35, 35, 35);
|
||||
$border-color: #444;
|
||||
|
||||
.elevated {
|
||||
background-color: $BASE_EVEVATED;
|
||||
}
|
38
tsconfig.json
Normal file
38
tsconfig.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
"importHelpers": true,
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"sourceMap": true,
|
||||
"baseUrl": ".",
|
||||
"types": [
|
||||
"webpack-env"
|
||||
],
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
"src/**/*.vue",
|
||||
"tests/**/*.ts",
|
||||
"tests/**/*.tsx"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
0
vue.config.js
Normal file
0
vue.config.js
Normal file
Loading…
x
Reference in New Issue
Block a user