mirror of
https://github.com/janishutz/MusicPlayer.git
synced 2026-09-10 14:25:24 +02:00
Compare commits
122
Commits
V1.0.0
..
6d9853f2c1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d9853f2c1 | ||
|
|
054fda2fb9 | ||
|
|
867374fa47 | ||
|
|
a5910df441 | ||
|
|
cb5cdc483f | ||
|
|
18bdf82bcf | ||
|
|
68bbfa7896 | ||
|
|
8a83326d60 | ||
|
|
ab08a94d55 | ||
|
|
4d4ddfe255 | ||
|
|
c123673ca5 | ||
|
|
223478f7cc | ||
|
|
b77f0a6dcf | ||
|
|
778f54055d | ||
|
|
b903eb416f | ||
|
|
8a3dd7a583 | ||
|
|
aba98d3122 | ||
|
|
4339861ffd | ||
|
|
01526034ce | ||
|
|
faa271edd6 | ||
|
|
3a0f8210dd | ||
|
|
a2b93e9624 | ||
|
|
f3d9251eee | ||
|
|
72dada18eb | ||
|
|
5f6e034dac | ||
|
|
eead8b558a | ||
|
|
4753d998b3 | ||
|
|
9bf88e033e | ||
|
|
0e155831d7 | ||
|
|
1d492d5922 | ||
|
|
4d9064f5c2 | ||
|
|
5b223875bd | ||
|
|
ce35371c06 | ||
|
|
4c5e1a864b | ||
|
|
94906c3499 | ||
|
|
c38b8d3115 | ||
|
|
d03fbe5e66 | ||
|
|
494eef6cd2 | ||
|
|
cb0db033ea | ||
|
|
d7433e95a4 | ||
|
|
576b6f9490 | ||
|
|
e0dcfa6964 | ||
|
|
69d2db8c37 | ||
|
|
9a347c9206 | ||
|
|
60ea4669ab | ||
|
|
669cc620bf | ||
|
|
64d086dec4 | ||
|
|
1d714da494 | ||
|
|
d63df5898b | ||
|
|
bd18636141 | ||
|
|
51f0b5639a | ||
|
|
6a6b06a994 | ||
|
|
e2e27e640f | ||
|
|
ac575adedb | ||
|
|
d15366e572 | ||
|
|
25cfc80925 | ||
|
|
952ef0ee85 | ||
|
|
80c497b80a | ||
|
|
8778740454 | ||
|
|
74075c2919 | ||
|
|
3e13a4ebf5 | ||
|
|
84b640ee5e | ||
|
|
0315241d76 | ||
|
|
6e93cfdf2c | ||
|
|
6b9d556e57 | ||
|
|
025c7ed111 | ||
|
|
057ea67a95 | ||
|
|
16543fb577 | ||
|
|
f0c538126d | ||
|
|
b0a1f9a538 | ||
|
|
9fac37203d | ||
|
|
b10aeed1f8 | ||
|
|
b8faeef189 | ||
|
|
4ef98f80cf | ||
|
|
c9f487b981 | ||
|
|
dc2327af33 | ||
|
|
360cc7c206 | ||
|
|
7e8170c794 | ||
|
|
83b800ad96 | ||
|
|
52d7fa7de7 | ||
|
|
a2f6757d84 | ||
|
|
da01326777 | ||
|
|
c77bfc8336 | ||
|
|
372ebf1057 | ||
|
|
6cf9e72263 | ||
|
|
b989111849 | ||
|
|
bd2e4cdac4 | ||
|
|
4ae05bd060 | ||
|
|
e3e4bfc8bd | ||
|
|
f8f0b27d52 | ||
|
|
1567640634 | ||
|
|
070e9d158b | ||
|
|
8d9607dbc6 | ||
|
|
95170194af | ||
|
|
e54f5178a1 | ||
|
|
a2711b76dd | ||
|
|
d7f36b8e07 | ||
|
|
a5e2520d28 | ||
|
|
221ae67ec2 | ||
|
|
361523172d | ||
|
|
88ecea1761 | ||
|
|
c3bff192bb | ||
|
|
1c4aace806 | ||
|
|
429bb53f36 | ||
|
|
f314732f3f | ||
|
|
7a42ab8b4e | ||
|
|
1e11f1dc2e | ||
|
|
76f543eb2f | ||
|
|
4ecf93d31b | ||
|
|
ed63ca77d6 | ||
|
|
b2d8180bb9 | ||
|
|
1ffdc873a7 | ||
|
|
56a714ab9e | ||
|
|
8f5fce8b97 | ||
|
|
ce82014826 | ||
|
|
17225d07bc | ||
|
|
15d59d9cee | ||
|
|
28ae628f4d | ||
|
|
c903481739 | ||
|
|
eb15e1fc3f | ||
|
|
cc09bb87f8 | ||
|
|
eae13bd107 |
@@ -0,0 +1,2 @@
|
|||||||
|
web/eslint.config.mjs linguist-generated
|
||||||
|
backend/eslint.config.mjs linguist-generated
|
||||||
@@ -3,3 +3,6 @@ node_modules
|
|||||||
*.secret.json
|
*.secret.json
|
||||||
apple_private_key.p8
|
apple_private_key.p8
|
||||||
musicplayerv2-server.zip
|
musicplayerv2-server.zip
|
||||||
|
dist
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
|
|||||||
@@ -1,619 +1,212 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
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.
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
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.
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
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.
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
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.
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
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.
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
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.
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
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.
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
The precise terms and conditions for copying, distribution and modification follow.
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
0. Definitions.
|
0. Definitions.
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
"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
|
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
"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.
|
||||||
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
|
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.
|
||||||
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
|
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
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.
|
||||||
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
|
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.
|
||||||
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"
|
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.
|
||||||
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.
|
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.
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the 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.
|
||||||
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
|
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.
|
||||||
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
|
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
|
||||||
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.
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
The Corresponding Source for a work in source code form is that same work.
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
2. Basic Permissions.
|
||||||
same work.
|
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.
|
||||||
|
|
||||||
2. Basic Permissions.
|
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.
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
permission to run the unmodified Program. The output from running a
|
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.
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
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.
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
You may make, run and propagate covered works that you do not
|
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.
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
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.
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
5. Conveying Modified Source Versions.
|
||||||
the terms of this License in conveying all material for which you do
|
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:
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
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".
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
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.
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
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.
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
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.
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
6. Conveying Non-Source Forms.
|
||||||
measure under any applicable law fulfilling obligations under article
|
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:
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
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.
|
||||||
measures.
|
|
||||||
|
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.
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
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.
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
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.
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
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.
|
||||||
technological measures.
|
|
||||||
|
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.
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
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.
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
"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.
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
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).
|
||||||
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
|
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.
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
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.
|
||||||
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.
|
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.
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
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.
|
||||||
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
|
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:
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
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
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
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
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||||
"keep intact all notices".
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
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.
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
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.
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
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.
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
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.
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
8. Termination.
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
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).
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
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.
|
||||||
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,
|
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.
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
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.
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
9. Acceptance Not Required for Having Copies.
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
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.
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
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.
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of 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.
|
||||||
in one of these ways:
|
|
||||||
|
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.
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
11. Patents.
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
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".
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
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.
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
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.
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
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.
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
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
|
||||||
medium customarily used for software interchange, for a price no
|
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.
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
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.
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
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.
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
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.
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
12. No Surrender of Others' Freedom.
|
||||||
with subsection 6b.
|
|
||||||
|
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
|
||||||
d) Convey the object code by offering access from a designated
|
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.
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
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.
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
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.
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
14. Revised Versions of this License.
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
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.
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
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.
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
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.
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
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.
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
15. Disclaimer of Warranty.
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
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.
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
16. Limitation of Liability.
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
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.
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
17. Interpretation of Sections 15 and 16.
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
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.
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|||||||
@@ -1,33 +1,57 @@
|
|||||||
<div id="title" align="center">
|
<div id="title" align="center">
|
||||||
<img src="./assets/logo.png" width="300">
|
<img src="./assets/logo.png" width="300">
|
||||||
<h1>MusicPlayerV2</h1>
|
<h1>MusicPlayer</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="badges" align="center">
|
<div id="badges" align="center">
|
||||||
<img alt="Project License" src="https://img.shields.io/github/license/simplePCBuilding/MusicPlayerV2.svg">
|
<img alt="Project License" src="https://img.shields.io/github/license/janishutz/MusicPlayer.svg">
|
||||||
<img alt="GitHub Repo size" src="https://img.shields.io/github/repo-size/simplePCBuilding/MusicPlayerV2.svg">
|
<img alt="GitHub Repo size" src="https://img.shields.io/github/repo-size/janishutz/MusicPlayer.svg">
|
||||||
<img alt="Project code lines count" src="https://img.shields.io/tokei/lines/github/simplePCBuilding/MusicPlayerV2">
|
<img alt="GitHub Repo issues" src="https://img.shields.io/github/issues-pr-raw/janishutz/MusicPlayer">
|
||||||
<img alt="GitHub Repo issues" src="https://img.shields.io/github/issues-pr-raw/simplePCBuilding/MusicPlayerV2">
|
<img alt="Top Languages" src="https://img.shields.io/github/languages/top/janishutz/MusicPlayer">
|
||||||
<img alt="Top Languages" src="https://img.shields.io/github/languages/top/simplePCBuilding/MusicPlayerV2">
|
<img alt="GitHub Repo filecount" src="https://img.shields.io/github/directory-file-count/janishutz/MusicPlayer.svg">
|
||||||
<img alt="GitHub Repo filecount" src="https://img.shields.io/github/directory-file-count/simplePCBuilding/MusicPlayerV2.svg">
|
|
||||||
<br>
|
<br>
|
||||||
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/simplePCBuilding/MusicPlayerV2">
|
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/janishutz/MusicPlayer">
|
||||||
<img alt="GitHub watchers" src="https://img.shields.io/github/watchers/simplePCBuilding/MusicPlayerV2">
|
<img alt="GitHub watchers" src="https://img.shields.io/github/watchers/janishutz/MusicPlayer">
|
||||||
<img alt="GitHub forks" src="https://img.shields.io/github/forks/simplePCBuilding/MusicPlayerV2">
|
<img alt="GitHub forks" src="https://img.shields.io/github/forks/janishutz/MusicPlayer">
|
||||||
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/simplePCBuilding/MusicPlayerV2">
|
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/janishutz/MusicPlayer">
|
||||||
<br>
|
<br>
|
||||||
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/simplePCBuilding/MusicPlayerV2/total?label=Downloads (total)">
|
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/janishutz/MusicPlayer/total?label=Downloads (total)">
|
||||||
<img alt="GitHub release (latest by date)" src="https://img.shields.io/github/downloads/simplePCBuilding/MusicPlayerV2/latest/total?label=Downloads (latest)">
|
<img alt="GitHub release (latest by date)" src="https://img.shields.io/github/downloads/janishutz/MusicPlayer/latest/total?label=Downloads (latest)">
|
||||||
<img alt="Latest release" src="https://img.shields.io/github/release/simplePCBuilding/MusicPlayerV2.svg">
|
<img alt="Latest release" src="https://img.shields.io/github/release/janishutz/MusicPlayer.svg">
|
||||||
<img alt="App Version" src="https://img.shields.io/github/package-json/v/simplePCBuilding/MusicPlayerV2.svg?label=Development Version">
|
<img alt="App Version" src="https://img.shields.io/github/package-json/v/janishutz/MusicPlayer.svg?label=Development Version">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
A music player, specifically created for displaying song information from a CSV or JSON file on multiple different displays that are connected
|
# Development Branch
|
||||||
to the same network, just from the browser.
|
This branch is for the upcoming version 4 of Music Player and is in early stages of development
|
||||||
|
|
||||||
|
It uses my manually created [types for MusicKitJS](https://github.com/janishutz/musickit-v3-types)
|
||||||
|
|
||||||
|
|
||||||
|
# MusicPlayer
|
||||||
|
|
||||||
|
A music player, specifically created for displaying song information on multiple different displays that are connected to the same network, just from the browser.
|
||||||
|
|
||||||
|
The [hosted version](https://music.janishutz.com) of this MusicPlayer, which is fully set up for you is subscription-based and can be paid for on my [store](https://store.janishutz.com/product/com.janishutz).
|
||||||
|
|
||||||
|
<div id="donate" align="center">
|
||||||
|
<a href="https://store.janishutz.com/donate" target="_blank"><img src="https://store-cdn.janishutz.com/static/support-me.jpg" width="150px"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
- Electron App that runs on all major Desktop OS (Linux, MacOS & Windows)
|
**NOTICE:** This section has not been updated for the new version of MusicPlayer yet
|
||||||
- Show all song information over the local network on any amount of client displays
|
- Browser based App that runs on all OS (Linux, MacOS, Windows, iOS, Android, iPadOS, ...)
|
||||||
- Client displays show the playback position and all information from the metadata and CSV / JSON file that contains all song information
|
- Fully featured Music Player
|
||||||
|
- Show all song information over the Internet on any amount of client displays
|
||||||
|
- Client displays show the playback position and all information from song metadata fetched from the Apple Music API
|
||||||
- Play most common music files
|
- Play most common music files
|
||||||
- Backend to allow users to connect over the internet
|
- No setup required when using the hosted version at [music.janishutz.com](https://music.janishutz.com)
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
MusicPlayer Copyright (C) 2026 janishutz
|
||||||
|
|
||||||
|
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 http://www.gnu.org/licenses/.
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
FROM node:25-alpine3.21 AS build
|
||||||
|
|
||||||
|
WORKDIR /usr/src/build
|
||||||
|
COPY . /usr/src/build
|
||||||
|
|
||||||
|
RUN npm i
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
|
||||||
|
# Prod build with fewer deps
|
||||||
|
FROM node:25-alpine3.21 AS prod
|
||||||
|
|
||||||
|
WORKDIR /usr/src/musicplayer
|
||||||
|
COPY --from=build /usr/src/build/dist /usr/src/musicplayer/dist
|
||||||
|
COPY ./index.js /usr/src/musicplayer/index.js
|
||||||
|
|
||||||
|
RUN npm i --omit=dev
|
||||||
|
|
||||||
|
CMD [ "node", "index.js" ]
|
||||||
-184
@@ -1,184 +0,0 @@
|
|||||||
const express = require( 'express' );
|
|
||||||
let app = express();
|
|
||||||
const path = require( 'path' );
|
|
||||||
const expressSession = require( 'express-session' );
|
|
||||||
const fs = require( 'fs' );
|
|
||||||
const bodyParser = require( 'body-parser' );
|
|
||||||
// const favicon = require( 'serve-favicon' );
|
|
||||||
|
|
||||||
const authKey = '' + fs.readFileSync( path.join( __dirname + '/authorizationKey.txt' ) );
|
|
||||||
|
|
||||||
app.use( expressSession ( {
|
|
||||||
secret: 'akgfsdkgfösdolfgslöodfvolwseifvoiwefö',
|
|
||||||
resave: true,
|
|
||||||
saveUninitialized: true
|
|
||||||
} ) );
|
|
||||||
app.use( bodyParser.urlencoded( { extended: false } ) );
|
|
||||||
app.use( bodyParser.json() );
|
|
||||||
// app.use( favicon( path.join( __dirname + '' ) ) );
|
|
||||||
|
|
||||||
let connectedClients = {};
|
|
||||||
let currentDetails = {
|
|
||||||
'songQueue': [],
|
|
||||||
'playingSong': {},
|
|
||||||
'pos': 0,
|
|
||||||
'isPlaying': false,
|
|
||||||
'queuePos': 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
app.get( '/', ( request, response ) => {
|
|
||||||
response.sendFile( path.join( __dirname + '/ui/index.html' ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/showcase.js', ( request, response ) => {
|
|
||||||
response.sendFile( path.join( __dirname + '/ui/showcase.js' ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/showcase.css', ( request, response ) => {
|
|
||||||
response.sendFile( path.join( __dirname + '/ui/showcase.css' ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.post( '/authSSE', ( req, res ) => {
|
|
||||||
if ( req.body.authKey === authKey ) {
|
|
||||||
req.session.isAuth = true;
|
|
||||||
res.send( 'ok' );
|
|
||||||
} else {
|
|
||||||
res.send( 'hello' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.post( '/fancy/auth', ( req, res ) => {
|
|
||||||
if ( req.body.key === authKey ) {
|
|
||||||
req.session.isAuth = true;
|
|
||||||
res.redirect( '/fancy' );
|
|
||||||
} else {
|
|
||||||
res.send( 'wrong' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/fancy', ( req, res ) => {
|
|
||||||
if ( req.session.isAuth ) {
|
|
||||||
res.sendFile( path.join( __dirname + '/ui/fancy/showcase.html' ) );
|
|
||||||
} else {
|
|
||||||
res.sendFile( path.join( __dirname + '/ui/fancy/auth.html' ) );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/fancy/showcase.js', ( req, res ) => {
|
|
||||||
if ( req.session.isAuth ) {
|
|
||||||
res.sendFile( path.join( __dirname + '/ui/fancy/showcase.js' ) );
|
|
||||||
} else {
|
|
||||||
res.redirect( '/' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/fancy/showcase.css', ( req, res ) => {
|
|
||||||
if ( req.session.isAuth ) {
|
|
||||||
res.sendFile( path.join( __dirname + '/ui/fancy/showcase.css' ) );
|
|
||||||
} else {
|
|
||||||
res.redirect( '/' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/fancy/backgroundAnim.css', ( req, res ) => {
|
|
||||||
if ( req.session.isAuth ) {
|
|
||||||
res.sendFile( path.join( __dirname + '/ui/fancy/backgroundAnim.css' ) );
|
|
||||||
} else {
|
|
||||||
res.redirect( '/' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
let connectedMain = {};
|
|
||||||
|
|
||||||
app.get( '/mainNotifier', ( req, res ) => {
|
|
||||||
const ipRetrieved = req.headers[ 'x-forwarded-for' ];
|
|
||||||
const ip = ipRetrieved ? ipRetrieved.split( /, / )[ 0 ] : req.connection.remoteAddress;
|
|
||||||
if ( req.session.isAuth ) {
|
|
||||||
res.writeHead( 200, {
|
|
||||||
'Content-Type': 'text/event-stream',
|
|
||||||
'Cache-Control': 'no-cache',
|
|
||||||
'Connection': 'keep-alive',
|
|
||||||
} );
|
|
||||||
res.status( 200 );
|
|
||||||
res.flushHeaders();
|
|
||||||
let det = { 'type': 'basics' };
|
|
||||||
res.write( `data: ${ JSON.stringify( det ) }\n\n` );
|
|
||||||
connectedMain = res;
|
|
||||||
} else {
|
|
||||||
res.send( 'wrong' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
// STATUS UPDATE from the client display to send to main ui
|
|
||||||
// Send update if page is closed
|
|
||||||
const allowedMainUpdates = [ 'blur', 'visibility' ];
|
|
||||||
app.post( '/clientStatusUpdate', ( req, res ) => {
|
|
||||||
if ( allowedMainUpdates.includes( req.body.type ) ) {
|
|
||||||
const ipRetrieved = req.headers[ 'x-forwarded-for' ];
|
|
||||||
const ip = ipRetrieved ? ipRetrieved.split( /, / )[ 0 ] : req.connection.remoteAddress;
|
|
||||||
sendClientUpdate( req.body.type, ip );
|
|
||||||
res.send( 'ok' );
|
|
||||||
} else {
|
|
||||||
res.status( 400 ).send( 'ERR_UNKNOWN_TYPE' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
const sendClientUpdate = ( update, ip ) => {
|
|
||||||
try {
|
|
||||||
connectedMain.write( 'data: ' + JSON.stringify( { 'type': update, 'ip': ip } ) + '\n\n' );
|
|
||||||
} catch ( err ) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
app.post( '/connect', ( request, response ) => {
|
|
||||||
if ( request.body.authKey === authKey ) {
|
|
||||||
request.session.authorized = true;
|
|
||||||
response.send( 'Handshake OK' );
|
|
||||||
} else {
|
|
||||||
response.status( 403 ).send( 'AuthKey wrong' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/clientDisplayNotifier', ( req, res ) => {
|
|
||||||
res.writeHead( 200, {
|
|
||||||
'Content-Type': 'text/event-stream',
|
|
||||||
'Cache-Control': 'no-cache',
|
|
||||||
'Connection': 'keep-alive',
|
|
||||||
} );
|
|
||||||
res.status( 200 );
|
|
||||||
res.flushHeaders();
|
|
||||||
let det = { 'type': 'basics', 'data': currentDetails };
|
|
||||||
res.write( `data: ${ JSON.stringify( det ) }\n\n` );
|
|
||||||
connectedClients[ req.session.id ] = res;
|
|
||||||
req.on( 'close', () => {
|
|
||||||
connectedClients.splice( Object.keys( connectedClients ).indexOf( req.session.id ), 1 );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
|
|
||||||
const sendUpdate = ( update ) => {
|
|
||||||
for ( let client in connectedClients ) {
|
|
||||||
connectedClients[ client ].write( 'data: ' + JSON.stringify( { 'type': update, 'data': currentDetails[ update ] } ) + '\n\n' );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const allowedTypes = [ 'playingSong', 'isPlaying', 'songQueue', 'pos', 'queuePos' ];
|
|
||||||
app.post( '/statusUpdate', ( req, res ) => {
|
|
||||||
if ( req.body.authKey === authKey ) {
|
|
||||||
if ( allowedTypes.includes( req.body.type ) ) {
|
|
||||||
currentDetails[ req.body.type ] = req.body.data
|
|
||||||
res.send( 'thanks' );
|
|
||||||
sendUpdate( req.body.type );
|
|
||||||
} else {
|
|
||||||
res.status( 400 ).send( 'incorrect request' );
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
res.status( 403 ).send( 'Unauthorized' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.use( ( request, response, next ) => {
|
|
||||||
response.sendFile( path.join( __dirname + '' ) )
|
|
||||||
} );
|
|
||||||
|
|
||||||
const PORT = process.env.PORT || 3000;
|
|
||||||
app.listen( PORT );
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
gaöwovwef89voawö8p9 odövefw8öoaewpf89wec
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"mode": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"foss",
|
||||||
|
"hosted"
|
||||||
|
],
|
||||||
|
"default": "foss",
|
||||||
|
"description": "Mode to use for the login. If set to hosted, sdk configuration needs to be complete"
|
||||||
|
},
|
||||||
|
"clientMode": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"sse",
|
||||||
|
"poll"
|
||||||
|
],
|
||||||
|
"default": "poll",
|
||||||
|
"description": "Default information retrieval mode for the basic remote displays. Polling is slightly cheaper at the cost of responsiveness"
|
||||||
|
},
|
||||||
|
"webUrl": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The URL to the frontend. Just the host, in form https://music.janishutz.com"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"mode",
|
||||||
|
"clientMode",
|
||||||
|
"webUrl"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../config.schema.json",
|
||||||
|
"mode": "foss",
|
||||||
|
"clientMode": "sse",
|
||||||
|
"webUrl": "http://localhost:8081"
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"token": "phafowegoväbwpb$weapvbpvfwcvfäawef39'ü0wtäqgpt5^ü62q'ẗ9wäa3g",
|
||||||
|
"name": "localhost:8082",
|
||||||
|
"client": "localhost:8081",
|
||||||
|
"backendURL": "http://localhost:8080",
|
||||||
|
"failReturnURL": "http://localhost:8081"
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"backendURL": "http://localhost:8083",
|
||||||
|
"name": "testing",
|
||||||
|
"signingSecret": "test"
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"playlists":[],"userid":"server-stubs","version":"1"}
|
||||||
Generated
+744
@@ -0,0 +1,744 @@
|
|||||||
|
import eslint from '@eslint/js';
|
||||||
|
import globals from 'globals';
|
||||||
|
import stylistic from '@stylistic/eslint-plugin';
|
||||||
|
import tseslint from 'typescript-eslint';
|
||||||
|
import typescript from '@typescript-eslint/eslint-plugin';
|
||||||
|
import vue from 'eslint-plugin-vue';
|
||||||
|
|
||||||
|
const style = {
|
||||||
|
'plugins': {
|
||||||
|
'@stylistic': stylistic,
|
||||||
|
'@stylistic/js': stylistic,
|
||||||
|
'@stylistic/ts': stylistic
|
||||||
|
},
|
||||||
|
'files': [
|
||||||
|
'**/*.ts',
|
||||||
|
'**/*.js',
|
||||||
|
'**/*.mjs',
|
||||||
|
'**/*.cjs',
|
||||||
|
'**/*.tsx',
|
||||||
|
'**/*.jsx'
|
||||||
|
],
|
||||||
|
'rules': {
|
||||||
|
'sort-imports': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
'ignoreCase': false,
|
||||||
|
'ignoreDeclarationSort': false,
|
||||||
|
'ignoreMemberSort': false,
|
||||||
|
'memberSyntaxSortOrder': [
|
||||||
|
'none',
|
||||||
|
'all',
|
||||||
|
'multiple',
|
||||||
|
'single'
|
||||||
|
],
|
||||||
|
'allowSeparatedGroups': false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// Formatting
|
||||||
|
'@stylistic/array-bracket-newline': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'multiline': false,
|
||||||
|
'minItems': 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/array-bracket-spacing': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/array-element-newline': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'consistent': false,
|
||||||
|
'multiline': false,
|
||||||
|
'minItems': 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/arrow-parens': [
|
||||||
|
'error',
|
||||||
|
'as-needed'
|
||||||
|
],
|
||||||
|
'@stylistic/arrow-spacing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'before': true,
|
||||||
|
'after': true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/block-spacing': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/brace-style': [
|
||||||
|
'error',
|
||||||
|
'1tbs',
|
||||||
|
{
|
||||||
|
'allowSingleLine': false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/comma-dangle': [
|
||||||
|
'error',
|
||||||
|
'never'
|
||||||
|
],
|
||||||
|
'@stylistic/comma-spacing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'before': false,
|
||||||
|
'after': true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/comma-style': [
|
||||||
|
'error',
|
||||||
|
'last'
|
||||||
|
],
|
||||||
|
'@stylistic/dot-location': [
|
||||||
|
'error',
|
||||||
|
'property'
|
||||||
|
],
|
||||||
|
'@stylistic/function-call-argument-newline': [
|
||||||
|
'error',
|
||||||
|
'consistent'
|
||||||
|
],
|
||||||
|
'@stylistic/function-call-spacing': [
|
||||||
|
'error',
|
||||||
|
'never'
|
||||||
|
],
|
||||||
|
'@stylistic/function-paren-newline': [
|
||||||
|
'error',
|
||||||
|
'multiline-arguments'
|
||||||
|
],
|
||||||
|
'@stylistic/implicit-arrow-linebreak': [
|
||||||
|
'error',
|
||||||
|
'beside'
|
||||||
|
],
|
||||||
|
'@stylistic/indent': [
|
||||||
|
'error',
|
||||||
|
4
|
||||||
|
],
|
||||||
|
'@stylistic/indent-binary-ops': [
|
||||||
|
'error',
|
||||||
|
4
|
||||||
|
],
|
||||||
|
'@stylistic/key-spacing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'beforeColon': false,
|
||||||
|
'afterColon': true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/keyword-spacing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'before': true,
|
||||||
|
'after': true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/lines-between-class-members': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/max-len': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
'code': 140,
|
||||||
|
'comments': 160,
|
||||||
|
'ignoreComments': false,
|
||||||
|
'ignoreUrls': true,
|
||||||
|
'ignoreStrings': true,
|
||||||
|
'ignoreTemplateLiterals': true,
|
||||||
|
'ignoreRegExpLiterals': true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/max-statements-per-line': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'max': 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/multiline-ternary': [
|
||||||
|
'error',
|
||||||
|
'always-multiline'
|
||||||
|
],
|
||||||
|
'@stylistic/new-parens': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/newline-per-chained-call': 'error',
|
||||||
|
'@stylistic/no-confusing-arrow': 'error',
|
||||||
|
'@stylistic/no-extra-parens': [
|
||||||
|
'error',
|
||||||
|
'all',
|
||||||
|
{
|
||||||
|
'nestedBinaryExpressions': false,
|
||||||
|
'ternaryOperandBinaryExpressions': false,
|
||||||
|
'ignoreJSX': 'multi-line',
|
||||||
|
'nestedConditionalExpressions': false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/no-extra-semi': 'error',
|
||||||
|
'@stylistic/no-floating-decimal': 'error',
|
||||||
|
'@stylistic/no-mixed-operators': 'error',
|
||||||
|
'@stylistic/no-mixed-spaces-and-tabs': 'error',
|
||||||
|
'@stylistic/no-multi-spaces': 'error',
|
||||||
|
'@stylistic/no-multiple-empty-lines': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'max': 3,
|
||||||
|
'maxEOF': 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/no-tabs': 'error',
|
||||||
|
'@stylistic/no-trailing-spaces': 'error',
|
||||||
|
'@stylistic/no-whitespace-before-property': 'error',
|
||||||
|
'@stylistic/object-curly-newline': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'multiline': true,
|
||||||
|
'minProperties': 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/object-curly-spacing': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/object-property-newline': 'error',
|
||||||
|
'@stylistic/one-var-declaration-per-line': 'error',
|
||||||
|
'@stylistic/operator-linebreak': [
|
||||||
|
'error',
|
||||||
|
'before'
|
||||||
|
],
|
||||||
|
'@stylistic/padded-blocks': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'blocks': 'never',
|
||||||
|
'classes': 'always',
|
||||||
|
'switches': 'never'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
// Padding lines. The most in-depth part of this config
|
||||||
|
'@stylistic/padding-line-between-statements': [
|
||||||
|
'error',
|
||||||
|
// Variables, Constants
|
||||||
|
{
|
||||||
|
'blankLine': 'never',
|
||||||
|
'prev': 'var',
|
||||||
|
'next': 'var'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'never',
|
||||||
|
'prev': 'let',
|
||||||
|
'next': 'let'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'never',
|
||||||
|
'prev': 'const',
|
||||||
|
'next': 'const'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'var',
|
||||||
|
'next': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'cjs-import',
|
||||||
|
'class',
|
||||||
|
'const',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'import',
|
||||||
|
'let',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'with'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'let',
|
||||||
|
'next': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'cjs-import',
|
||||||
|
'class',
|
||||||
|
'const',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'import',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'while',
|
||||||
|
'with'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'const',
|
||||||
|
'next': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'cjs-import',
|
||||||
|
'class',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'import',
|
||||||
|
'let',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'while',
|
||||||
|
'with'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// Import
|
||||||
|
{
|
||||||
|
'blankLine': 'never',
|
||||||
|
'prev': 'import',
|
||||||
|
'next': 'import'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'never',
|
||||||
|
'prev': 'cjs-import',
|
||||||
|
'next': 'cjs-import'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'class',
|
||||||
|
'const',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'let',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'while',
|
||||||
|
'with'
|
||||||
|
],
|
||||||
|
'next': 'cjs-import'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'cjs-import',
|
||||||
|
'next': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'class',
|
||||||
|
'const',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'let',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'while',
|
||||||
|
'with'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'class',
|
||||||
|
'const',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'let',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'while',
|
||||||
|
'with'
|
||||||
|
],
|
||||||
|
'next': 'import'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'import',
|
||||||
|
'next': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'class',
|
||||||
|
'const',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'let',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'while',
|
||||||
|
'with'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// If
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'if'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'if',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// For
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'for'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'for',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// While
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'while'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'while',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Functions
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'function',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Block Statements
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'block-like'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'block-like',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Switch
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'switch'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'switch',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Try-Catch
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'try'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'try',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Throw
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'throw'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'throw',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Return
|
||||||
|
{
|
||||||
|
'blankLine': 'never',
|
||||||
|
'prev': 'return',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'return'
|
||||||
|
},
|
||||||
|
// Export
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'export'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'export',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'cjs-export'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'cjs-export',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Classes
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'class'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'class',
|
||||||
|
'next': '*'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/quote-props': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/quotes': [
|
||||||
|
'error',
|
||||||
|
'single'
|
||||||
|
],
|
||||||
|
'@stylistic/rest-spread-spacing': [
|
||||||
|
'error',
|
||||||
|
'never'
|
||||||
|
],
|
||||||
|
'@stylistic/semi': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/semi-spacing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'before': false,
|
||||||
|
'after': true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/semi-style': [
|
||||||
|
'error',
|
||||||
|
'last'
|
||||||
|
],
|
||||||
|
'@stylistic/space-before-blocks': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/space-before-function-paren': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/space-in-parens': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/space-infix-ops': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'int32Hint': false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/space-unary-ops': 'error',
|
||||||
|
'@stylistic/spaced-comment': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/switch-colon-spacing': 'error',
|
||||||
|
'@stylistic/template-curly-spacing': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/template-tag-spacing': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/type-generic-spacing': 'error',
|
||||||
|
'@stylistic/type-named-tuple-spacing': 'error',
|
||||||
|
'@stylistic/wrap-iife': [
|
||||||
|
'error',
|
||||||
|
'inside'
|
||||||
|
],
|
||||||
|
'@stylistic/wrap-regex': 'error',
|
||||||
|
'@stylistic/ts/type-annotation-spacing': 'error'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @type {import('eslint').Linter.Config} */
|
||||||
|
export default tseslint.config(
|
||||||
|
// Base JavaScript rules
|
||||||
|
eslint.configs.recommended,
|
||||||
|
tseslint.configs.recommended,
|
||||||
|
style,
|
||||||
|
|
||||||
|
// Vue support (including TS and JSX inside SFCs)
|
||||||
|
{
|
||||||
|
'files': [ '**/*.vue' ],
|
||||||
|
'languageOptions': {
|
||||||
|
'sourceType': 'module',
|
||||||
|
'ecmaVersion': 'latest',
|
||||||
|
'globals': globals.browser,
|
||||||
|
'parserOptions': {
|
||||||
|
'parser': tseslint.parser
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'plugins': {
|
||||||
|
'vue': vue,
|
||||||
|
'@stylistic': stylistic,
|
||||||
|
'@stylistic/js': stylistic,
|
||||||
|
'@stylistic/ts': stylistic,
|
||||||
|
'@typescript-eslint': typescript
|
||||||
|
},
|
||||||
|
'extends': [
|
||||||
|
eslint.configs.recommended,
|
||||||
|
...vue.configs['flat/recommended']
|
||||||
|
],
|
||||||
|
'rules': {
|
||||||
|
...typescript.configs.recommended.rules,
|
||||||
|
...style.rules,
|
||||||
|
|
||||||
|
// Vue specific rules
|
||||||
|
'@stylistic/indent': 'off',
|
||||||
|
'vue/html-indent': [
|
||||||
|
'error',
|
||||||
|
4
|
||||||
|
],
|
||||||
|
'vue/html-comment-indent': [
|
||||||
|
'error',
|
||||||
|
4
|
||||||
|
],
|
||||||
|
'vue/script-indent': [
|
||||||
|
'error',
|
||||||
|
4,
|
||||||
|
{
|
||||||
|
'baseIndent': 1,
|
||||||
|
'switchCase': 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'vue/html-self-closing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'html': {
|
||||||
|
'void': 'never',
|
||||||
|
'normal': 'never',
|
||||||
|
'component': 'always'
|
||||||
|
},
|
||||||
|
'svg': 'always',
|
||||||
|
'math': 'never'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'vue/max-attributes-per-line': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'singleline': 3,
|
||||||
|
'multiline': 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
const app = require( './dist/app.js' ).default;
|
||||||
|
app.run();
|
||||||
Generated
-788
@@ -1,788 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "backend",
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {
|
|
||||||
"": {
|
|
||||||
"dependencies": {
|
|
||||||
"body-parser": "^1.20.2",
|
|
||||||
"express": "^4.18.2",
|
|
||||||
"express-session": "^1.17.3",
|
|
||||||
"express-static": "^1.2.6",
|
|
||||||
"serve-favicon": "^2.5.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/accepts": {
|
|
||||||
"version": "1.3.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
|
||||||
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
|
||||||
"dependencies": {
|
|
||||||
"mime-types": "~2.1.34",
|
|
||||||
"negotiator": "0.6.3"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/array-flatten": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
|
||||||
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
|
|
||||||
},
|
|
||||||
"node_modules/body-parser": {
|
|
||||||
"version": "1.20.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
|
|
||||||
"integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==",
|
|
||||||
"dependencies": {
|
|
||||||
"bytes": "3.1.2",
|
|
||||||
"content-type": "~1.0.5",
|
|
||||||
"debug": "2.6.9",
|
|
||||||
"depd": "2.0.0",
|
|
||||||
"destroy": "1.2.0",
|
|
||||||
"http-errors": "2.0.0",
|
|
||||||
"iconv-lite": "0.4.24",
|
|
||||||
"on-finished": "2.4.1",
|
|
||||||
"qs": "6.11.0",
|
|
||||||
"raw-body": "2.5.2",
|
|
||||||
"type-is": "~1.6.18",
|
|
||||||
"unpipe": "1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8",
|
|
||||||
"npm": "1.2.8000 || >= 1.4.16"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/bytes": {
|
|
||||||
"version": "3.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
|
||||||
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/call-bind": {
|
|
||||||
"version": "1.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz",
|
|
||||||
"integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"function-bind": "^1.1.2",
|
|
||||||
"get-intrinsic": "^1.2.1",
|
|
||||||
"set-function-length": "^1.1.1"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/content-disposition": {
|
|
||||||
"version": "0.5.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
|
||||||
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"safe-buffer": "5.2.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/content-type": {
|
|
||||||
"version": "1.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
|
||||||
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cookie": {
|
|
||||||
"version": "0.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
|
|
||||||
"integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cookie-signature": {
|
|
||||||
"version": "1.0.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
|
||||||
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
|
|
||||||
},
|
|
||||||
"node_modules/debug": {
|
|
||||||
"version": "2.6.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
|
||||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
|
||||||
"dependencies": {
|
|
||||||
"ms": "2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/define-data-property": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz",
|
|
||||||
"integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"get-intrinsic": "^1.2.1",
|
|
||||||
"gopd": "^1.0.1",
|
|
||||||
"has-property-descriptors": "^1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/depd": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/destroy": {
|
|
||||||
"version": "1.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
|
||||||
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8",
|
|
||||||
"npm": "1.2.8000 || >= 1.4.16"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ee-first": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
|
||||||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
|
||||||
},
|
|
||||||
"node_modules/encodeurl": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
|
||||||
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/escape-html": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
|
||||||
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
|
|
||||||
},
|
|
||||||
"node_modules/etag": {
|
|
||||||
"version": "1.8.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
|
||||||
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/express": {
|
|
||||||
"version": "4.18.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
|
|
||||||
"integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"accepts": "~1.3.8",
|
|
||||||
"array-flatten": "1.1.1",
|
|
||||||
"body-parser": "1.20.1",
|
|
||||||
"content-disposition": "0.5.4",
|
|
||||||
"content-type": "~1.0.4",
|
|
||||||
"cookie": "0.5.0",
|
|
||||||
"cookie-signature": "1.0.6",
|
|
||||||
"debug": "2.6.9",
|
|
||||||
"depd": "2.0.0",
|
|
||||||
"encodeurl": "~1.0.2",
|
|
||||||
"escape-html": "~1.0.3",
|
|
||||||
"etag": "~1.8.1",
|
|
||||||
"finalhandler": "1.2.0",
|
|
||||||
"fresh": "0.5.2",
|
|
||||||
"http-errors": "2.0.0",
|
|
||||||
"merge-descriptors": "1.0.1",
|
|
||||||
"methods": "~1.1.2",
|
|
||||||
"on-finished": "2.4.1",
|
|
||||||
"parseurl": "~1.3.3",
|
|
||||||
"path-to-regexp": "0.1.7",
|
|
||||||
"proxy-addr": "~2.0.7",
|
|
||||||
"qs": "6.11.0",
|
|
||||||
"range-parser": "~1.2.1",
|
|
||||||
"safe-buffer": "5.2.1",
|
|
||||||
"send": "0.18.0",
|
|
||||||
"serve-static": "1.15.0",
|
|
||||||
"setprototypeof": "1.2.0",
|
|
||||||
"statuses": "2.0.1",
|
|
||||||
"type-is": "~1.6.18",
|
|
||||||
"utils-merge": "1.0.1",
|
|
||||||
"vary": "~1.1.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.10.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/express-session": {
|
|
||||||
"version": "1.17.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz",
|
|
||||||
"integrity": "sha512-4+otWXlShYlG1Ma+2Jnn+xgKUZTMJ5QD3YvfilX3AcocOAbIkVylSWEklzALe/+Pu4qV6TYBj5GwOBFfdKqLBw==",
|
|
||||||
"dependencies": {
|
|
||||||
"cookie": "0.4.2",
|
|
||||||
"cookie-signature": "1.0.6",
|
|
||||||
"debug": "2.6.9",
|
|
||||||
"depd": "~2.0.0",
|
|
||||||
"on-headers": "~1.0.2",
|
|
||||||
"parseurl": "~1.3.3",
|
|
||||||
"safe-buffer": "5.2.1",
|
|
||||||
"uid-safe": "~2.1.5"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/express-session/node_modules/cookie": {
|
|
||||||
"version": "0.4.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz",
|
|
||||||
"integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/express-static": {
|
|
||||||
"version": "1.2.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/express-static/-/express-static-1.2.6.tgz",
|
|
||||||
"integrity": "sha512-pmp8fSe+bCxGCTk5+X6HzIF2APYMvrAq3Y7sT/WOELc0JZZxJhMTVgCbxcoUgMRBSqnQ9EfTw/Uv3J1ONoIAuA==",
|
|
||||||
"dependencies": {
|
|
||||||
"mime2": "latest"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"express-static": "bin/server.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/express/node_modules/body-parser": {
|
|
||||||
"version": "1.20.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
|
|
||||||
"integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
|
|
||||||
"dependencies": {
|
|
||||||
"bytes": "3.1.2",
|
|
||||||
"content-type": "~1.0.4",
|
|
||||||
"debug": "2.6.9",
|
|
||||||
"depd": "2.0.0",
|
|
||||||
"destroy": "1.2.0",
|
|
||||||
"http-errors": "2.0.0",
|
|
||||||
"iconv-lite": "0.4.24",
|
|
||||||
"on-finished": "2.4.1",
|
|
||||||
"qs": "6.11.0",
|
|
||||||
"raw-body": "2.5.1",
|
|
||||||
"type-is": "~1.6.18",
|
|
||||||
"unpipe": "1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8",
|
|
||||||
"npm": "1.2.8000 || >= 1.4.16"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/express/node_modules/raw-body": {
|
|
||||||
"version": "2.5.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
|
|
||||||
"integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
|
|
||||||
"dependencies": {
|
|
||||||
"bytes": "3.1.2",
|
|
||||||
"http-errors": "2.0.0",
|
|
||||||
"iconv-lite": "0.4.24",
|
|
||||||
"unpipe": "1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/finalhandler": {
|
|
||||||
"version": "1.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
|
|
||||||
"integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
|
|
||||||
"dependencies": {
|
|
||||||
"debug": "2.6.9",
|
|
||||||
"encodeurl": "~1.0.2",
|
|
||||||
"escape-html": "~1.0.3",
|
|
||||||
"on-finished": "2.4.1",
|
|
||||||
"parseurl": "~1.3.3",
|
|
||||||
"statuses": "2.0.1",
|
|
||||||
"unpipe": "~1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/forwarded": {
|
|
||||||
"version": "0.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
|
||||||
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/fresh": {
|
|
||||||
"version": "0.5.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
|
||||||
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/function-bind": {
|
|
||||||
"version": "1.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
|
||||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/get-intrinsic": {
|
|
||||||
"version": "1.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz",
|
|
||||||
"integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==",
|
|
||||||
"dependencies": {
|
|
||||||
"function-bind": "^1.1.2",
|
|
||||||
"has-proto": "^1.0.1",
|
|
||||||
"has-symbols": "^1.0.3",
|
|
||||||
"hasown": "^2.0.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/gopd": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
|
|
||||||
"dependencies": {
|
|
||||||
"get-intrinsic": "^1.1.3"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/has-property-descriptors": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==",
|
|
||||||
"dependencies": {
|
|
||||||
"get-intrinsic": "^1.2.2"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/has-proto": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/has-symbols": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
|
||||||
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/hasown": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==",
|
|
||||||
"dependencies": {
|
|
||||||
"function-bind": "^1.1.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/http-errors": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"depd": "2.0.0",
|
|
||||||
"inherits": "2.0.4",
|
|
||||||
"setprototypeof": "1.2.0",
|
|
||||||
"statuses": "2.0.1",
|
|
||||||
"toidentifier": "1.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/iconv-lite": {
|
|
||||||
"version": "0.4.24",
|
|
||||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
|
||||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
|
||||||
"dependencies": {
|
|
||||||
"safer-buffer": ">= 2.1.2 < 3"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.10.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/inherits": {
|
|
||||||
"version": "2.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
|
||||||
},
|
|
||||||
"node_modules/ipaddr.js": {
|
|
||||||
"version": "1.9.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
|
||||||
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/media-typer": {
|
|
||||||
"version": "0.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
|
||||||
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/merge-descriptors": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
|
|
||||||
},
|
|
||||||
"node_modules/methods": {
|
|
||||||
"version": "1.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
|
||||||
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mime": {
|
|
||||||
"version": "1.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
|
||||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
|
||||||
"bin": {
|
|
||||||
"mime": "cli.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mime-db": {
|
|
||||||
"version": "1.52.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
|
||||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mime-types": {
|
|
||||||
"version": "2.1.35",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
|
||||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
|
||||||
"dependencies": {
|
|
||||||
"mime-db": "1.52.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mime2": {
|
|
||||||
"version": "0.0.11",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime2/-/mime2-0.0.11.tgz",
|
|
||||||
"integrity": "sha512-Ch599Y8U4vUgG9AaQgLEnIdXRRLoZPfjAdWFDLYePBEJS1nsS43H2pzbZn0u8lkbYx+yInuKxLsUEgM3fa9ZLQ=="
|
|
||||||
},
|
|
||||||
"node_modules/ms": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
|
||||||
},
|
|
||||||
"node_modules/negotiator": {
|
|
||||||
"version": "0.6.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
|
||||||
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/object-inspect": {
|
|
||||||
"version": "1.13.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
|
|
||||||
"integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/on-finished": {
|
|
||||||
"version": "2.4.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
|
||||||
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
|
||||||
"dependencies": {
|
|
||||||
"ee-first": "1.1.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/on-headers": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
|
|
||||||
"integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/parseurl": {
|
|
||||||
"version": "1.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
|
||||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/path-to-regexp": {
|
|
||||||
"version": "0.1.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
|
||||||
"integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
|
|
||||||
},
|
|
||||||
"node_modules/proxy-addr": {
|
|
||||||
"version": "2.0.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
|
||||||
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
|
||||||
"dependencies": {
|
|
||||||
"forwarded": "0.2.0",
|
|
||||||
"ipaddr.js": "1.9.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/qs": {
|
|
||||||
"version": "6.11.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
|
|
||||||
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
|
|
||||||
"dependencies": {
|
|
||||||
"side-channel": "^1.0.4"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.6"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/random-bytes": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/range-parser": {
|
|
||||||
"version": "1.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
|
||||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/raw-body": {
|
|
||||||
"version": "2.5.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz",
|
|
||||||
"integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==",
|
|
||||||
"dependencies": {
|
|
||||||
"bytes": "3.1.2",
|
|
||||||
"http-errors": "2.0.0",
|
|
||||||
"iconv-lite": "0.4.24",
|
|
||||||
"unpipe": "1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/safe-buffer": {
|
|
||||||
"version": "5.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
|
||||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "patreon",
|
|
||||||
"url": "https://www.patreon.com/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "consulting",
|
|
||||||
"url": "https://feross.org/support"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"node_modules/safer-buffer": {
|
|
||||||
"version": "2.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
|
||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
|
||||||
},
|
|
||||||
"node_modules/send": {
|
|
||||||
"version": "0.18.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
|
|
||||||
"integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
|
|
||||||
"dependencies": {
|
|
||||||
"debug": "2.6.9",
|
|
||||||
"depd": "2.0.0",
|
|
||||||
"destroy": "1.2.0",
|
|
||||||
"encodeurl": "~1.0.2",
|
|
||||||
"escape-html": "~1.0.3",
|
|
||||||
"etag": "~1.8.1",
|
|
||||||
"fresh": "0.5.2",
|
|
||||||
"http-errors": "2.0.0",
|
|
||||||
"mime": "1.6.0",
|
|
||||||
"ms": "2.1.3",
|
|
||||||
"on-finished": "2.4.1",
|
|
||||||
"range-parser": "~1.2.1",
|
|
||||||
"statuses": "2.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/send/node_modules/ms": {
|
|
||||||
"version": "2.1.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
|
||||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
|
||||||
},
|
|
||||||
"node_modules/serve-favicon": {
|
|
||||||
"version": "2.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/serve-favicon/-/serve-favicon-2.5.0.tgz",
|
|
||||||
"integrity": "sha512-FMW2RvqNr03x+C0WxTyu6sOv21oOjkq5j8tjquWccwa6ScNyGFOGJVpuS1NmTVGBAHS07xnSKotgf2ehQmf9iA==",
|
|
||||||
"dependencies": {
|
|
||||||
"etag": "~1.8.1",
|
|
||||||
"fresh": "0.5.2",
|
|
||||||
"ms": "2.1.1",
|
|
||||||
"parseurl": "~1.3.2",
|
|
||||||
"safe-buffer": "5.1.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/serve-favicon/node_modules/ms": {
|
|
||||||
"version": "2.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
|
|
||||||
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
|
|
||||||
},
|
|
||||||
"node_modules/serve-favicon/node_modules/safe-buffer": {
|
|
||||||
"version": "5.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
|
|
||||||
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
|
|
||||||
},
|
|
||||||
"node_modules/serve-static": {
|
|
||||||
"version": "1.15.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
|
|
||||||
"integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
|
|
||||||
"dependencies": {
|
|
||||||
"encodeurl": "~1.0.2",
|
|
||||||
"escape-html": "~1.0.3",
|
|
||||||
"parseurl": "~1.3.3",
|
|
||||||
"send": "0.18.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/set-function-length": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz",
|
|
||||||
"integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"define-data-property": "^1.1.1",
|
|
||||||
"get-intrinsic": "^1.2.1",
|
|
||||||
"gopd": "^1.0.1",
|
|
||||||
"has-property-descriptors": "^1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/setprototypeof": {
|
|
||||||
"version": "1.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
|
||||||
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
|
|
||||||
},
|
|
||||||
"node_modules/side-channel": {
|
|
||||||
"version": "1.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
|
||||||
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
|
|
||||||
"dependencies": {
|
|
||||||
"call-bind": "^1.0.0",
|
|
||||||
"get-intrinsic": "^1.0.2",
|
|
||||||
"object-inspect": "^1.9.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/statuses": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/toidentifier": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/type-is": {
|
|
||||||
"version": "1.6.18",
|
|
||||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
|
||||||
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
|
||||||
"dependencies": {
|
|
||||||
"media-typer": "0.3.0",
|
|
||||||
"mime-types": "~2.1.24"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/uid-safe": {
|
|
||||||
"version": "2.1.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz",
|
|
||||||
"integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==",
|
|
||||||
"dependencies": {
|
|
||||||
"random-bytes": "~1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/unpipe": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/utils-merge": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/vary": {
|
|
||||||
"version": "1.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
|
||||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+23
-5
@@ -1,9 +1,27 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"body-parser": "^1.20.2",
|
"@janishutz/login-sdk-server": "^1.4.0",
|
||||||
"express": "^4.18.2",
|
"@janishutz/login-sdk-server-stubs": "^1.4.0",
|
||||||
"express-session": "^1.17.3",
|
"@janishutz/store-sdk": "^1.2.1",
|
||||||
"express-static": "^1.2.6",
|
"body-parser": "^2.3.0",
|
||||||
"serve-favicon": "^2.5.0"
|
"cors": "^2.8.6",
|
||||||
|
"express": "^5.2.1",
|
||||||
|
"express-session": "^1.19.0",
|
||||||
|
"jsonwebtoken": "^9.0.3",
|
||||||
|
"typescript": "^6.0.3"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^10.0.1",
|
||||||
|
"@stylistic/eslint-plugin": "^5.10.0",
|
||||||
|
"@types/body-parser": "^1.19.6",
|
||||||
|
"@types/cors": "^2.8.19",
|
||||||
|
"@types/express": "^5.0.6",
|
||||||
|
"@types/express-session": "^1.19.0",
|
||||||
|
"@types/jsonwebtoken": "^9.0.10",
|
||||||
|
"@types/node": "^26.2.0",
|
||||||
|
"eslint": "^10.9.0",
|
||||||
|
"eslint-plugin-vue": "^10.10.0",
|
||||||
|
"globals": "^17.11.0",
|
||||||
|
"typescript-eslint": "^8.67.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
import {
|
||||||
|
getLoginSdk,
|
||||||
|
getStoreSdk
|
||||||
|
} from './sdk';
|
||||||
|
import {
|
||||||
|
Config
|
||||||
|
} from './dtype/config';
|
||||||
|
import devtoken from './routes/devtoken';
|
||||||
|
import express from 'express';
|
||||||
|
import fs from 'fs';
|
||||||
|
import logger from './logger';
|
||||||
|
import path from 'path';
|
||||||
|
import room from './routes/room';
|
||||||
|
import user from './routes/user';
|
||||||
|
|
||||||
|
const run = () => {
|
||||||
|
// FIXME: Use DB instead of memory optionally
|
||||||
|
const sdkConfig = JSON.parse( fs.readFileSync( path.join(
|
||||||
|
__dirname,
|
||||||
|
'/../config/sdk.config.testing.json'
|
||||||
|
) ).toString() );
|
||||||
|
const config = JSON.parse( fs.readFileSync( path.join(
|
||||||
|
__dirname,
|
||||||
|
'/../config/config.json'
|
||||||
|
) ).toString() ) as Config;
|
||||||
|
const foss = config.mode !== 'hosted';
|
||||||
|
const sdk = getLoginSdk( foss );
|
||||||
|
const storeSdk = getStoreSdk( foss );
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
app.use( logger.routeLogging() );
|
||||||
|
|
||||||
|
// Load id.janishutz.com SDK and allow signing in
|
||||||
|
sdk.setUp(
|
||||||
|
{
|
||||||
|
'prod': false,
|
||||||
|
'service': {
|
||||||
|
'serviceID': sdkConfig[ 'name' ],
|
||||||
|
'serviceToken': sdkConfig[ 'token' ]
|
||||||
|
},
|
||||||
|
'user-agent': sdkConfig[ 'ua' ],
|
||||||
|
'sessionType': 'memory',
|
||||||
|
'frontendURL': config.webUrl,
|
||||||
|
'corsWhitelist': [ config.webUrl ],
|
||||||
|
'recheckTimeout': 300 * 1000,
|
||||||
|
'advancedVerification': 'sdk'
|
||||||
|
},
|
||||||
|
app,
|
||||||
|
async () => {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
async ( uid: string ) => {
|
||||||
|
fs.writeFileSync( path.join( __dirname, '/data/', uid ), '{}' );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
async () => {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
async () => {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Load store sdk
|
||||||
|
const storeConfig = JSON.parse( fs.readFileSync( path.join(
|
||||||
|
__dirname,
|
||||||
|
'/../config/store-sdk.config.testing.json'
|
||||||
|
) ).toString() );
|
||||||
|
|
||||||
|
storeSdk.configure( storeConfig );
|
||||||
|
|
||||||
|
app.get( '/', ( _request: express.Request, response: express.Response ) => {
|
||||||
|
response.redirect( config.webUrl ?? 'https://music.janishutz.com' );
|
||||||
|
} );
|
||||||
|
|
||||||
|
// TODO: Need way for frontend to get the connection type for shares
|
||||||
|
|
||||||
|
|
||||||
|
// Load extra routes
|
||||||
|
devtoken.routes( app, foss );
|
||||||
|
room.routes( app, foss, config );
|
||||||
|
user.routes( app, foss );
|
||||||
|
|
||||||
|
|
||||||
|
app.use( ( _request: express.Request, response: express.Response ) => {
|
||||||
|
response.sendStatus( 404 );
|
||||||
|
} );
|
||||||
|
|
||||||
|
const PORT = process.env.PORT || 8080;
|
||||||
|
|
||||||
|
app.listen( PORT );
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
run
|
||||||
|
};
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import {
|
||||||
|
CorsOptions
|
||||||
|
} from 'cors';
|
||||||
|
import cors from 'cors';
|
||||||
|
|
||||||
|
let corsWhitelist: string[] = [];
|
||||||
|
|
||||||
|
const configure = ( whitelist: string[] ) => {
|
||||||
|
corsWhitelist = whitelist;
|
||||||
|
};
|
||||||
|
|
||||||
|
const middleware = ( rest: boolean = false ) => {
|
||||||
|
return cors( genCorsOpts( rest ) );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the options for the CORS library
|
||||||
|
* @param rest - [OPTIONAL] Whether to allow REST requests or not
|
||||||
|
* @returns CORS options object that can be used for the cors library
|
||||||
|
*/
|
||||||
|
const genCorsOpts = ( rest: boolean = false ): CorsOptions => {
|
||||||
|
const corsOpts: CorsOptions = {
|
||||||
|
'credentials': true,
|
||||||
|
'optionsSuccessStatus': 200,
|
||||||
|
'origin': ( origin, cb ) => {
|
||||||
|
const status = blockREST( origin! );
|
||||||
|
|
||||||
|
cb( null, status );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if ( rest ) {
|
||||||
|
corsOpts[ 'origin' ] = ( origin, cb ) => {
|
||||||
|
const status = allowREST( origin! );
|
||||||
|
|
||||||
|
cb( null, status );
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return corsOpts;
|
||||||
|
};
|
||||||
|
|
||||||
|
const blockREST = ( origin: string ): boolean => {
|
||||||
|
return corsWhitelist.includes( origin );
|
||||||
|
};
|
||||||
|
|
||||||
|
const allowREST = ( origin: string ): boolean => {
|
||||||
|
return blockREST( origin ) || !origin;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
genCorsOpts,
|
||||||
|
configure,
|
||||||
|
middleware
|
||||||
|
};
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
export interface Config {
|
||||||
|
'mode': 'foss' | 'hosted';
|
||||||
|
'clientMode': 'sse' | 'poll';
|
||||||
|
'webUrl': string;
|
||||||
|
}
|
||||||
Vendored
+55
@@ -0,0 +1,55 @@
|
|||||||
|
export interface UserPlaylistFile {
|
||||||
|
'version': '1',
|
||||||
|
'userid': string,
|
||||||
|
'playlists': Playlist[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Playlist {
|
||||||
|
'name': string;
|
||||||
|
'songs': PlaylistSongs;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PlaylistSongs = Song[];
|
||||||
|
|
||||||
|
export interface Song {
|
||||||
|
/**
|
||||||
|
* Where the song can be found
|
||||||
|
*/
|
||||||
|
'source': 'local' | 'applemusic';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier for the song so it can be found again (such as Apple Music ID or URL for playback)
|
||||||
|
*/
|
||||||
|
'identifier': string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Any additional identifiers (such as filename, etc) to associate.
|
||||||
|
* Even if this is not used, set this value if local files are needed
|
||||||
|
*/
|
||||||
|
'additional-identifier'?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional info, such as dance type to be displayed on remote screens
|
||||||
|
*/
|
||||||
|
'additional-info': string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The artist of the song
|
||||||
|
*/
|
||||||
|
'artist': string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the song
|
||||||
|
*/
|
||||||
|
'name': string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The cover image as a URL
|
||||||
|
*/
|
||||||
|
'artwork': string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Song duration
|
||||||
|
*/
|
||||||
|
'duration': number;
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
import express from 'express';
|
||||||
|
import {
|
||||||
|
writeFile
|
||||||
|
} from 'node:fs';
|
||||||
|
|
||||||
|
const log = ( ...msg: unknown[] ) => {
|
||||||
|
output( 'log', 'UNKNOWN', ...msg );
|
||||||
|
};
|
||||||
|
|
||||||
|
const info = ( ...msg: unknown[] ) => {
|
||||||
|
output( 'info', 'UNKNOWN', ...msg );
|
||||||
|
};
|
||||||
|
|
||||||
|
const debug = ( ...msg: unknown[] ) => {
|
||||||
|
output( 'debug', 'UNKNOWN', ...msg );
|
||||||
|
};
|
||||||
|
|
||||||
|
const warn = ( ...msg: unknown[] ) => {
|
||||||
|
output( 'warn', 'UNKNOWN', ...msg );
|
||||||
|
};
|
||||||
|
|
||||||
|
const error = ( ...msg: unknown[] ) => {
|
||||||
|
output( 'error', 'UNKNOWN', ...msg );
|
||||||
|
};
|
||||||
|
|
||||||
|
const fatal = ( ...msg: unknown[] ) => {
|
||||||
|
output( 'fatal', 'UNKNOWN', ...msg );
|
||||||
|
};
|
||||||
|
|
||||||
|
const routeLogging = () => {
|
||||||
|
return ( request: express.Request, _response: express.Response, next: express.NextFunction ) => {
|
||||||
|
output( 'info', 'ROUTER', request.originalUrl, 'from', request.headers['user-agent'] ?? 'No UA' );
|
||||||
|
next();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
let loc = 'stderr';
|
||||||
|
let lev = 0;
|
||||||
|
type LogLevel = 'debug' | 'info' | 'log' | 'warn' | 'error' | 'fatal';
|
||||||
|
const levels = [
|
||||||
|
'debug',
|
||||||
|
'info',
|
||||||
|
'log',
|
||||||
|
'warn',
|
||||||
|
'error',
|
||||||
|
'fatal'
|
||||||
|
];
|
||||||
|
|
||||||
|
const configure = ( location: 'stderr' | 'file', minLevel: LogLevel, file?: string ) => {
|
||||||
|
if ( location === 'file' && !file ) {
|
||||||
|
throw new Error( 'File parameter required when location is "file"' );
|
||||||
|
}
|
||||||
|
|
||||||
|
loc = location === 'stderr' ? 'stderr' : ( file ?? 'musicplayer.log' );
|
||||||
|
lev = levels.indexOf( minLevel );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const logfile: string[] = [];
|
||||||
|
|
||||||
|
const output = ( level: LogLevel, caller: string, ...message: unknown[] ) => {
|
||||||
|
if ( levels.indexOf( level ) < lev ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const msg = message.join( ' ' );
|
||||||
|
const out = `[${ level.toUpperCase() }] (${ new Date().toISOString() }) in ${ caller }: ${ msg }`;
|
||||||
|
|
||||||
|
if ( loc === 'stderr' ) {
|
||||||
|
console.error( out );
|
||||||
|
} else {
|
||||||
|
logfile.push( out );
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let isSaving = false;
|
||||||
|
let waitingOnSave = false;
|
||||||
|
|
||||||
|
const save = () => {
|
||||||
|
if ( isSaving ) {
|
||||||
|
waitingOnSave = true;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isSaving = true;
|
||||||
|
writeFile( loc, JSON.stringify( logfile ), err => {
|
||||||
|
if ( err )
|
||||||
|
console.error( '[LOGGER] Failed to save with error ' + err );
|
||||||
|
|
||||||
|
if ( waitingOnSave ) {
|
||||||
|
waitingOnSave = false;
|
||||||
|
isSaving = false;
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
isSaving = false;
|
||||||
|
} );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
log,
|
||||||
|
info,
|
||||||
|
debug,
|
||||||
|
warn,
|
||||||
|
error,
|
||||||
|
fatal,
|
||||||
|
configure,
|
||||||
|
routeLogging
|
||||||
|
};
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
import {
|
||||||
|
Client,
|
||||||
|
Room,
|
||||||
|
RoomStore
|
||||||
|
} from './room';
|
||||||
|
import {
|
||||||
|
PlaylistSongs
|
||||||
|
} from '../../dtype/file';
|
||||||
|
import {
|
||||||
|
Response
|
||||||
|
} from 'express';
|
||||||
|
|
||||||
|
const rooms: RoomStore = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The room to get
|
||||||
|
* @param room - The name of the room to get
|
||||||
|
* @returns The room, or undefined if it is not present
|
||||||
|
*/
|
||||||
|
const get = ( room: string ): Room | undefined => {
|
||||||
|
return rooms[room];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name - The name of the room to create
|
||||||
|
* @param uid - The ID of the user
|
||||||
|
*/
|
||||||
|
const create = ( name: string, uid: string ) => {
|
||||||
|
if ( rooms[ name ] ) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
rooms[ name ] = {
|
||||||
|
'clients': [],
|
||||||
|
'trackingClients': [],
|
||||||
|
'owner': uid,
|
||||||
|
'playlist': {
|
||||||
|
'playlist': [],
|
||||||
|
'lastUpdate': new Date().getTime()
|
||||||
|
},
|
||||||
|
'state': {
|
||||||
|
'index': 0,
|
||||||
|
'lastUpdate': new Date().getTime(),
|
||||||
|
'playing': false,
|
||||||
|
'start': new Date().getTime()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a listening client to a room
|
||||||
|
* @param roomName - The room ID this client should belong to
|
||||||
|
* @param id - The ID of the client
|
||||||
|
* @param kind - The type of client that is to be removed
|
||||||
|
* @param response - The express response object
|
||||||
|
* @returns true if successful, false otherwise
|
||||||
|
*/
|
||||||
|
const addClient = ( roomName: string, id: string, kind: 'client' | 'trackingClient', response: Response ) => {
|
||||||
|
if ( !rooms[roomName] ) return false;
|
||||||
|
|
||||||
|
const room = rooms[roomName][kind + 's' as 'clients' | 'trackingClients'] as Client[];
|
||||||
|
|
||||||
|
room.push( {
|
||||||
|
'response': response,
|
||||||
|
'id': id
|
||||||
|
} );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a listening client by its ID
|
||||||
|
* @param roomName - The room ID this client belongs to
|
||||||
|
* @param id - The ID of the client
|
||||||
|
* @param kind - The type of client that is to be removed
|
||||||
|
* @returns true if successful, false otherwise
|
||||||
|
*/
|
||||||
|
const removeClient = ( roomName: string, id: string, kind: 'client' | 'trackingClient' ) => {
|
||||||
|
if ( !rooms[roomName] ) return false;
|
||||||
|
|
||||||
|
const room = rooms[roomName][kind + 's' as 'clients' | 'trackingClients'] as Client[];
|
||||||
|
const idx = room.findIndex( client => client.id === id );
|
||||||
|
|
||||||
|
if ( idx < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
room.splice( idx, 1 );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the room and disconnect all clients
|
||||||
|
* @param name - The name of the room
|
||||||
|
* @param uid - The name of the owner of the room
|
||||||
|
*/
|
||||||
|
const close = ( name: string, uid: string ) => {
|
||||||
|
if ( !rooms[name] || rooms[name].owner !== uid ) return false;
|
||||||
|
|
||||||
|
rooms[name].clients.forEach( client => client.response.send( 'data: closed\n\n' ) );
|
||||||
|
delete rooms[name];
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the state of the specified room
|
||||||
|
* @param room - The room to update the state for
|
||||||
|
* @param uid - The UserID of the user that created the room (i.e. the owner)
|
||||||
|
* @param playing - Set to true if the player is playing currently
|
||||||
|
* @param index - The current playback index
|
||||||
|
* @param start - The timestamp where playback of the current song started
|
||||||
|
* @returns true if update succeeded
|
||||||
|
*/
|
||||||
|
const updateState = ( room: string, uid: string, playing: boolean, index: number, start: number ) => {
|
||||||
|
if ( !rooms[room] || rooms[room].owner !== uid ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
rooms[room].state = {
|
||||||
|
'playing': playing,
|
||||||
|
'index': index,
|
||||||
|
'lastUpdate': new Date().getTime(),
|
||||||
|
'start': start
|
||||||
|
};
|
||||||
|
|
||||||
|
return sendUpdate( room, 'state' );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the playlist of the specified room
|
||||||
|
* @param room - The room to update the state for
|
||||||
|
* @param uid - The UserID of the user that created the room (i.e. the owner)
|
||||||
|
* @param playlist - The playlist that is currently playing
|
||||||
|
* @returns true if update succeeded
|
||||||
|
*/
|
||||||
|
const updatePlaylist = ( room: string, uid: string, playlist: PlaylistSongs ) => {
|
||||||
|
if ( !rooms[room] || rooms[room].owner !== uid ) return false;
|
||||||
|
|
||||||
|
rooms[room].playlist = {
|
||||||
|
'playlist': playlist,
|
||||||
|
'lastUpdate': new Date().getTime()
|
||||||
|
};
|
||||||
|
|
||||||
|
return sendUpdate( room, 'playlist' );
|
||||||
|
};
|
||||||
|
|
||||||
|
const sendUpdate = ( room: string, kind: 'state' | 'playlist' ) => {
|
||||||
|
const roomObject = rooms[room];
|
||||||
|
|
||||||
|
if ( !roomObject ) return false;
|
||||||
|
|
||||||
|
roomObject.clients.forEach( client => client.response.write( `data: json:${ JSON.stringify( {
|
||||||
|
'type': kind,
|
||||||
|
'data': roomObject[kind]
|
||||||
|
} ) }\n\n` ) );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send an update from the trackking system to all admin clients
|
||||||
|
* @param room - The room to send it to
|
||||||
|
* @param update - The update to send
|
||||||
|
*/
|
||||||
|
const sendTrackingUpdate = ( room: string, update: string ) => {
|
||||||
|
if ( !rooms[room] ) return false;
|
||||||
|
|
||||||
|
rooms[room].trackingClients.forEach( client => client.response.write( `data: ${ update }\n\n` ) );
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
get,
|
||||||
|
create,
|
||||||
|
close,
|
||||||
|
updateState,
|
||||||
|
updatePlaylist,
|
||||||
|
sendTrackingUpdate,
|
||||||
|
addClient,
|
||||||
|
removeClient
|
||||||
|
};
|
||||||
Vendored
+32
@@ -0,0 +1,32 @@
|
|||||||
|
import {
|
||||||
|
PlaylistSongs
|
||||||
|
} from '../../dtype/file';
|
||||||
|
import {
|
||||||
|
Response
|
||||||
|
} from 'express';
|
||||||
|
|
||||||
|
export interface Client {
|
||||||
|
'id': string;
|
||||||
|
'response': Response;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Room {
|
||||||
|
'playlist': {
|
||||||
|
'lastUpdate': number;
|
||||||
|
'playlist': PlaylistSongs;
|
||||||
|
}
|
||||||
|
'state': {
|
||||||
|
'index': number;
|
||||||
|
'start': number;
|
||||||
|
'playing': boolean;
|
||||||
|
'lastUpdate': number;
|
||||||
|
};
|
||||||
|
'owner': string;
|
||||||
|
'clients': Client[];
|
||||||
|
'trackingClients': Client[];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RoomStore {
|
||||||
|
[id: string]: Room
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import {
|
||||||
|
Config
|
||||||
|
} from '../../dtype/config';
|
||||||
|
import express from 'express';
|
||||||
|
import {
|
||||||
|
generateToken
|
||||||
|
} from '../../token';
|
||||||
|
import rooms from '.';
|
||||||
|
|
||||||
|
export const sseMiddleware = ( kind: 'client' | 'trackingClient', config?: Config ) => {
|
||||||
|
return ( request: express.Request, response: express.Response ) => {
|
||||||
|
if ( typeof request.params.id !== 'string' )
|
||||||
|
return response.sendStatus( 400 );
|
||||||
|
|
||||||
|
const room = rooms.get( request.params.id );
|
||||||
|
|
||||||
|
if ( !room ) return response.sendStatus( 404 );
|
||||||
|
|
||||||
|
response.writeHead( 200, {
|
||||||
|
'Content-Type': 'text/event-stream',
|
||||||
|
'Cache-Control': 'no-cache',
|
||||||
|
'Connection': 'keep-alive'
|
||||||
|
} );
|
||||||
|
response.status( 200 );
|
||||||
|
response.flushHeaders();
|
||||||
|
|
||||||
|
if ( kind === 'trackingClient' || config?.clientMode === 'poll' )
|
||||||
|
response.write( 'data: use-poll\n\n' );
|
||||||
|
else
|
||||||
|
response.write( 'data: connected\n\n' );
|
||||||
|
|
||||||
|
const token = generateToken( 20 );
|
||||||
|
|
||||||
|
rooms.addClient( request.params.id, token, kind, response );
|
||||||
|
|
||||||
|
request.on( 'close', () => {
|
||||||
|
rooms.removeClient( request.params.id as string, token, kind );
|
||||||
|
} );
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import {
|
||||||
|
readFile,
|
||||||
|
stat,
|
||||||
|
writeFile
|
||||||
|
} from 'node:fs';
|
||||||
|
import {
|
||||||
|
UserPlaylistFile
|
||||||
|
} from '../../dtype/file';
|
||||||
|
import path from 'node:path';
|
||||||
|
|
||||||
|
export const getUserFile = async ( uid: string ): Promise<UserPlaylistFile> => {
|
||||||
|
return new Promise( ( resolve, reject ) => {
|
||||||
|
readFile( getUserFilePath( uid ), ( err, data ) => {
|
||||||
|
if ( err ) return reject( err );
|
||||||
|
|
||||||
|
resolve( JSON.parse( String( data ) ) as UserPlaylistFile );
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
};
|
||||||
|
|
||||||
|
const createUserFile = async ( uid: string ): Promise<void> => {
|
||||||
|
writeUserFile( uid, {
|
||||||
|
'playlists': [],
|
||||||
|
'userid': uid,
|
||||||
|
'version': '1'
|
||||||
|
} );
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getUserFilePath = ( uid: string ): string => {
|
||||||
|
return path.join( __dirname, '/../../../data/', uid + '.json' );
|
||||||
|
};
|
||||||
|
|
||||||
|
export const testUserFileExists = async ( uid: string ): Promise<boolean> => {
|
||||||
|
return new Promise( resolve => {
|
||||||
|
stat( getUserFilePath( uid ), err => {
|
||||||
|
if ( err ) return resolve( false );
|
||||||
|
|
||||||
|
resolve( true );
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
};
|
||||||
|
|
||||||
|
export const writeUserFile = async ( uid: string, file: UserPlaylistFile ) => {
|
||||||
|
writeFile( getUserFilePath( uid ), JSON.stringify( file ), err => {
|
||||||
|
if ( err ) return Promise.reject( err );
|
||||||
|
else Promise.resolve();
|
||||||
|
} );
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
getUserFilePath,
|
||||||
|
getUserFile,
|
||||||
|
writeUserFile,
|
||||||
|
testUserFileExists,
|
||||||
|
createUserFile
|
||||||
|
};
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import {
|
||||||
|
getLoginSdk,
|
||||||
|
getStoreSdk
|
||||||
|
} from '../../sdk';
|
||||||
|
import express from 'express';
|
||||||
|
|
||||||
|
const cache: {
|
||||||
|
[key: string]: boolean
|
||||||
|
} = {};
|
||||||
|
|
||||||
|
export const getOwnershipManager = ( foss: boolean ) => {
|
||||||
|
const storeSdk = getStoreSdk( foss );
|
||||||
|
const sdk = getLoginSdk( foss );
|
||||||
|
|
||||||
|
const getOwned = async ( request: express.Request ) => {
|
||||||
|
const uid = sdk.getUID( request )!;
|
||||||
|
|
||||||
|
if ( cache[ uid ] ) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
const now = new Date().getTime();
|
||||||
|
|
||||||
|
if ( ( await storeSdk.getSubscriptions( uid ) ).findIndex(
|
||||||
|
sub => ( sub.id === 'com.janishutz.MusicPlayer.subscription' || sub.id === 'com.janishutz.MusicPlayer.subscription-month' ) && sub.expires - now > 0
|
||||||
|
) > -1 ) {
|
||||||
|
cache[ uid ] = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const middleware = () => {
|
||||||
|
return async ( request: express.Request, response: express.Response, next: express.NextFunction ) => {
|
||||||
|
if ( !await getOwned( request ) ) response.sendStatus( 402 );
|
||||||
|
else next();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
getOwned,
|
||||||
|
middleware
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import corsManager from '../corsManager';
|
||||||
|
import express from 'express';
|
||||||
|
import fs from 'fs';
|
||||||
|
import {
|
||||||
|
getLoginSdk
|
||||||
|
} from '../sdk';
|
||||||
|
import {
|
||||||
|
getOwnershipManager
|
||||||
|
} from '../manager/users/ownership';
|
||||||
|
import jwt from 'jsonwebtoken';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
const routes = ( app: express.Application, foss: boolean ) => {
|
||||||
|
const sdk = getLoginSdk( foss );
|
||||||
|
const privateKey = fs.readFileSync( path.join(
|
||||||
|
__dirname,
|
||||||
|
'/../config/apple_private_key.p8'
|
||||||
|
) ).toString();
|
||||||
|
const musicApiConfig = JSON.parse( fs.readFileSync( path.join(
|
||||||
|
__dirname,
|
||||||
|
'/../config/apple-music-api.config.secret.json'
|
||||||
|
) ).toString() );
|
||||||
|
const ownership = getOwnershipManager( foss );
|
||||||
|
|
||||||
|
app.get(
|
||||||
|
'/dev-token',
|
||||||
|
corsManager.middleware( false ),
|
||||||
|
sdk.loginCheck(),
|
||||||
|
ownership.middleware(),
|
||||||
|
( _request: express.Request, response: express.Response ) => {
|
||||||
|
// sign dev token
|
||||||
|
const now = new Date().getTime();
|
||||||
|
const tomorrow = now + ( 24 * 3600 * 1000 );
|
||||||
|
const jwtToken = jwt.sign( {
|
||||||
|
'iss': musicApiConfig.teamID,
|
||||||
|
'iat': Math.floor( now / 1000 ),
|
||||||
|
'exp': Math.floor( tomorrow / 1000 )
|
||||||
|
}, privateKey, {
|
||||||
|
'algorithm': 'ES256',
|
||||||
|
'keyid': musicApiConfig.keyID
|
||||||
|
} );
|
||||||
|
|
||||||
|
response.send( jwtToken );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
routes
|
||||||
|
};
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import {
|
||||||
|
Config
|
||||||
|
} from '../../dtype/config';
|
||||||
|
import express from 'express';
|
||||||
|
import {
|
||||||
|
getLoginSdk
|
||||||
|
} from '../../sdk';
|
||||||
|
import {
|
||||||
|
getOwnershipManager
|
||||||
|
} from '../../manager/users/ownership';
|
||||||
|
import rooms from '../../manager/rooms';
|
||||||
|
import tracking from './tracking';
|
||||||
|
import update from './update';
|
||||||
|
|
||||||
|
const routes = ( app: express.Application, foss: boolean, config: Config ) => {
|
||||||
|
const sdk = getLoginSdk( foss );
|
||||||
|
const ownership = getOwnershipManager( foss );
|
||||||
|
|
||||||
|
tracking.routes( app, foss );
|
||||||
|
update.routes( app, foss, config );
|
||||||
|
|
||||||
|
app.get(
|
||||||
|
'/room/create',
|
||||||
|
sdk.loginCheck(),
|
||||||
|
ownership.middleware(),
|
||||||
|
( request: express.Request, response: express.Response ) => {
|
||||||
|
if ( !request.query.room || !( /^[a-zA-Z0-9-]{3,20}/ ).test( String( request.query.room ) ) ) return response.sendStatus( 400 );
|
||||||
|
|
||||||
|
if ( rooms.create( String( request.query.room ), sdk.getUID( request )! ) )
|
||||||
|
response.sendStatus( 200 );
|
||||||
|
else
|
||||||
|
response.sendStatus( 409 );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
app.get(
|
||||||
|
'/room/:id/close',
|
||||||
|
sdk.loginCheck(),
|
||||||
|
( request: express.Request, response: express.Response ) => {
|
||||||
|
if ( typeof request.params.room !== 'string' ) return response.sendStatus( 400 );
|
||||||
|
|
||||||
|
if ( rooms.close( String( request.query.room ), sdk.getUID( request )! ) )
|
||||||
|
response.sendStatus( 200 );
|
||||||
|
else
|
||||||
|
response.sendStatus( 500 );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
routes
|
||||||
|
};
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import corsManager from '../../corsManager';
|
||||||
|
import express from 'express';
|
||||||
|
import {
|
||||||
|
getLoginSdk
|
||||||
|
} from '../../sdk';
|
||||||
|
import rooms from '../../manager/rooms';
|
||||||
|
import {
|
||||||
|
sseMiddleware
|
||||||
|
} from '../../manager/rooms/sse';
|
||||||
|
|
||||||
|
const tackingUpdate = ( message: string ) => {
|
||||||
|
return ( request: express.Request, response: express.Response ) => {
|
||||||
|
if ( typeof request.params.id === 'string' ) {
|
||||||
|
if ( rooms.sendTrackingUpdate( request.params.id, message ) )
|
||||||
|
response.sendStatus( 200 );
|
||||||
|
else
|
||||||
|
response.sendStatus( 500 );
|
||||||
|
} else
|
||||||
|
response.sendStatus( 400 );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const routes = ( app: express.Application, foss: boolean ) => {
|
||||||
|
const sdk = getLoginSdk( foss );
|
||||||
|
|
||||||
|
app.get(
|
||||||
|
'/room/:id/tracking/exit',
|
||||||
|
corsManager.middleware( false ),
|
||||||
|
tackingUpdate( 'exit' )
|
||||||
|
);
|
||||||
|
|
||||||
|
app.get(
|
||||||
|
'/room/:id/tracking/ping',
|
||||||
|
corsManager.middleware( false ),
|
||||||
|
tackingUpdate( 'ping' )
|
||||||
|
);
|
||||||
|
|
||||||
|
app.get(
|
||||||
|
'/room/:id/admin',
|
||||||
|
corsManager.middleware( false ),
|
||||||
|
sdk.loginCheck(),
|
||||||
|
sseMiddleware( 'trackingClient' )
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
routes
|
||||||
|
};
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
import {
|
||||||
|
Config
|
||||||
|
} from '../../dtype/config';
|
||||||
|
import bodyParser from 'body-parser';
|
||||||
|
import corsManager from '../../corsManager';
|
||||||
|
import express from 'express';
|
||||||
|
import {
|
||||||
|
getLoginSdk
|
||||||
|
} from '../../sdk';
|
||||||
|
import logger from '../../logger';
|
||||||
|
import rooms from '../../manager/rooms';
|
||||||
|
import {
|
||||||
|
sseMiddleware
|
||||||
|
} from '../../manager/rooms/sse';
|
||||||
|
|
||||||
|
const routes = ( app: express.Application, foss: boolean, config: Config ) => {
|
||||||
|
const sdk = getLoginSdk( foss );
|
||||||
|
|
||||||
|
// FIXME: Here, if not in sse mode, simply close the connection after sending 'poll'
|
||||||
|
app.get( '/room/:id/connect', corsManager.middleware( false ), sseMiddleware( 'client', config ) );
|
||||||
|
|
||||||
|
app.get( '/room/:id/poll', corsManager.middleware( false ), ( request: express.Request, response: express.Response ) => {
|
||||||
|
if ( typeof request.params.id !== 'string' )
|
||||||
|
return response.sendStatus( 400 );
|
||||||
|
|
||||||
|
const room = rooms.get( request.params.id );
|
||||||
|
|
||||||
|
if ( !room ) response.sendStatus( 404 );
|
||||||
|
|
||||||
|
const lastRequest = parseInt( String( request.query.last ) ) ?? 0;
|
||||||
|
|
||||||
|
response.send(
|
||||||
|
JSON.stringify( {
|
||||||
|
'state': room?.state,
|
||||||
|
'playlist': ( lastRequest < room!.playlist!.lastUpdate || isNaN( lastRequest ) ) ? room!.playlist.playlist : undefined
|
||||||
|
} )
|
||||||
|
);
|
||||||
|
} );
|
||||||
|
|
||||||
|
app.options( '/room/:id/update/playlist', corsManager.middleware( false ) );
|
||||||
|
app.post(
|
||||||
|
'/room/:id/update/playlist',
|
||||||
|
corsManager.middleware( false ),
|
||||||
|
sdk.loginCheck(),
|
||||||
|
bodyParser.json(),
|
||||||
|
( request: express.Request, response: express.Response ) => {
|
||||||
|
if ( typeof request.params.id !== 'string' )
|
||||||
|
return response.sendStatus( 400 );
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ( rooms.updatePlaylist(
|
||||||
|
request.params.id,
|
||||||
|
sdk.getUID( request )!,
|
||||||
|
request.body.playlist ?? []
|
||||||
|
) )
|
||||||
|
response.sendStatus( 200 );
|
||||||
|
else
|
||||||
|
response.sendStatus( 400 );
|
||||||
|
} catch ( err ) {
|
||||||
|
logger.error( 'Failed sending updated playlists with error', err );
|
||||||
|
response.sendStatus( 500 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
app.options( '/room/:id/update/state', corsManager.middleware( false ) );
|
||||||
|
app.post(
|
||||||
|
'/room/:id/update/state',
|
||||||
|
corsManager.middleware( false ),
|
||||||
|
sdk.loginCheck(),
|
||||||
|
bodyParser.json(),
|
||||||
|
( request: express.Request, response: express.Response ) => {
|
||||||
|
if ( typeof request.params.id !== 'string' ) {
|
||||||
|
return response.sendStatus( 400 );
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ( rooms.updateState(
|
||||||
|
request.params.id,
|
||||||
|
sdk.getUID( request )!,
|
||||||
|
request.body.playing ?? false,
|
||||||
|
request.body.index ?? -1,
|
||||||
|
request.body.start ?? new Date().getTime()
|
||||||
|
) )
|
||||||
|
response.sendStatus( 200 );
|
||||||
|
else
|
||||||
|
response.sendStatus( 400 );
|
||||||
|
} catch ( err ) {
|
||||||
|
logger.error( 'Failed sending updated state with error', err );
|
||||||
|
response.sendStatus( 500 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
routes
|
||||||
|
};
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
import {
|
||||||
|
Playlist,
|
||||||
|
UserPlaylistFile
|
||||||
|
} from '../../dtype/file';
|
||||||
|
import {
|
||||||
|
getUserFile,
|
||||||
|
writeUserFile
|
||||||
|
} from '../../manager/users';
|
||||||
|
import bodyParser from 'body-parser';
|
||||||
|
import express from 'express';
|
||||||
|
import {
|
||||||
|
getLoginSdk
|
||||||
|
} from '../../sdk';
|
||||||
|
import {
|
||||||
|
getOwnershipManager
|
||||||
|
} from '../../manager/users/ownership';
|
||||||
|
import logger from '../../logger';
|
||||||
|
|
||||||
|
const routes = ( app: express.Application, foss: boolean ) => {
|
||||||
|
const sdk = getLoginSdk( foss );
|
||||||
|
const ownership = getOwnershipManager( foss );
|
||||||
|
|
||||||
|
app.get( '/user/owned', sdk.loginCheck(), async ( request: express.Request, response: express.Response ) => {
|
||||||
|
if ( await ownership.getOwned( request ) )
|
||||||
|
response.send( true );
|
||||||
|
else
|
||||||
|
response.send( true );
|
||||||
|
} );
|
||||||
|
|
||||||
|
app.get(
|
||||||
|
'/user/playlists',
|
||||||
|
sdk.loginCheck(),
|
||||||
|
async ( request: express.Request, response: express.Response ) => {
|
||||||
|
try {
|
||||||
|
const playlists = await getUserFile( sdk.getUID( request )! );
|
||||||
|
|
||||||
|
response.send( JSON.stringify( playlists.playlists ) );
|
||||||
|
} catch ( e ) {
|
||||||
|
logger.error( 'Failed retrieving user file with error', e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
app.post(
|
||||||
|
'/user/playlists',
|
||||||
|
sdk.loginCheck(),
|
||||||
|
ownership.middleware(),
|
||||||
|
bodyParser.json(),
|
||||||
|
async ( request: express.Request, response: express.Response ) => {
|
||||||
|
try {
|
||||||
|
const contents: UserPlaylistFile = {
|
||||||
|
'playlists': request.body as Playlist[],
|
||||||
|
'userid': sdk.getUID( request )!,
|
||||||
|
'version': '1'
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
await writeUserFile( contents.userid, contents );
|
||||||
|
response.sendStatus( 200 );
|
||||||
|
} catch ( e ) {
|
||||||
|
logger.error( 'Failed updating user playlists', e );
|
||||||
|
response.sendStatus( 500 );
|
||||||
|
}
|
||||||
|
} catch ( e ) {
|
||||||
|
logger.error( 'Failed retrieving user file with error', e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
routes
|
||||||
|
};
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import loginSdk from '@janishutz/login-sdk-server';
|
||||||
|
import loginSdkStub from '@janishutz/login-sdk-server-stubs';
|
||||||
|
import storeSdk from '@janishutz/store-sdk';
|
||||||
|
import storeSdkStub from './store-sdk-stub';
|
||||||
|
|
||||||
|
export const getLoginSdk = ( foss: boolean ) => {
|
||||||
|
if ( foss ) return loginSdkStub;
|
||||||
|
else return loginSdk;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getStoreSdk = ( foss: boolean ) => {
|
||||||
|
if ( foss ) return storeSdkStub;
|
||||||
|
else return storeSdk;
|
||||||
|
};
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
interface StoreSDKConfig {
|
||||||
|
'backendURL': string;
|
||||||
|
'signingSecret': string;
|
||||||
|
'name': string;
|
||||||
|
'loglevel': 'debug' | 'info' | 'log' | 'warn' | 'error' | 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SubscriptionData {
|
||||||
|
'id': string;
|
||||||
|
'status': string;
|
||||||
|
'expires': number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
const getSubscriptions = async ( _uid: string ): Promise<SubscriptionData[]> => {
|
||||||
|
return [ {
|
||||||
|
'id': 'com.janishutz.MusicPlayer.subscription',
|
||||||
|
'expires': new Date().getTime() + 200000,
|
||||||
|
'status': 'active'
|
||||||
|
} ];
|
||||||
|
};
|
||||||
|
|
||||||
|
const configure = ( config: StoreSDKConfig ) => {
|
||||||
|
console.log( config );
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
getSubscriptions,
|
||||||
|
configure
|
||||||
|
};
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import crypto from 'node:crypto';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a token for e.g. login, etc
|
||||||
|
* @param length - The number of characters of the token
|
||||||
|
* @returns The generated token
|
||||||
|
*/
|
||||||
|
export const generateToken = ( length: number ): string => {
|
||||||
|
let token = '';
|
||||||
|
|
||||||
|
const min = 45;
|
||||||
|
const max = 122;
|
||||||
|
|
||||||
|
for ( let i = 0; i < length; i++ ) {
|
||||||
|
const buf = new Uint8Array( 1 );
|
||||||
|
|
||||||
|
crypto.getRandomValues( buf );
|
||||||
|
let randomNumber = Math.floor( ( buf[ 0 ] / 256 * ( max - min ) ) + min );
|
||||||
|
|
||||||
|
while (
|
||||||
|
( 58 < randomNumber && randomNumber < 63 )
|
||||||
|
|| ( 90 < randomNumber && randomNumber < 95 )
|
||||||
|
|| ( 95 < randomNumber && randomNumber < 97 )
|
||||||
|
) {
|
||||||
|
const buf = new Uint8Array( 1 );
|
||||||
|
|
||||||
|
crypto.getRandomValues( buf );
|
||||||
|
randomNumber = Math.floor( ( buf[ 0 ] / 256 * ( max - min ) ) + min );
|
||||||
|
}
|
||||||
|
|
||||||
|
token += String.fromCharCode( randomNumber );
|
||||||
|
}
|
||||||
|
|
||||||
|
return token;
|
||||||
|
};
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"allowJs": true,
|
||||||
|
"target": "ES6",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"types": [
|
||||||
|
"node"
|
||||||
|
],
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"./src/**/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Authenticate - Fancy Remote Display</title>
|
|
||||||
<style>
|
|
||||||
.aligner {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 100vh;
|
|
||||||
width: 100vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
html, body {
|
|
||||||
background-color: rgb(41, 41, 41);
|
|
||||||
color: white;
|
|
||||||
margin: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding: 0;
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
form {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
#key {
|
|
||||||
padding: 1vh;
|
|
||||||
font-size: 120%;
|
|
||||||
border: none;
|
|
||||||
border-radius: 50px;
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 5vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
#submit {
|
|
||||||
padding: 20px;
|
|
||||||
background-color: rgb(1, 1, 88);
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 50px;
|
|
||||||
transition: all 1s;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 120%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#submit:hover {
|
|
||||||
background-color: rgb(1, 1, 120);
|
|
||||||
border-radius: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="aligner">
|
|
||||||
<h1>Authenticate - Fancy Remote Display</h1>
|
|
||||||
<form action="/fancy/auth" method="post">
|
|
||||||
<label for="key" style="font-size: 120%;">Authentication Key</label>
|
|
||||||
<input type="text" name="key" id="key" style="margin-bottom: 1vh;">
|
|
||||||
<input type="submit" value="Authenticate" id="submit">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
.background {
|
|
||||||
position: fixed;
|
|
||||||
left: -50vw;
|
|
||||||
width: 200vw;
|
|
||||||
height: 200vw;
|
|
||||||
top: -50vw;
|
|
||||||
z-index: -1;
|
|
||||||
filter: blur(10px);
|
|
||||||
background: conic-gradient( blue, green, red, blue );
|
|
||||||
animation: gradientAnim 10s infinite linear;
|
|
||||||
background-position: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.beat, .beat-manual {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
background-color: rgba( 0, 0, 0, 0.15 );
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.beat {
|
|
||||||
animation: beatAnim 0.6s infinite linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes beatAnim {
|
|
||||||
0% {
|
|
||||||
background-color: rgba( 0, 0, 0, 0.2 );
|
|
||||||
}
|
|
||||||
20% {
|
|
||||||
background-color: rgba( 0, 0, 0, 0 );
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
background-color: rgba( 0, 0, 0, 0.2 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes gradientAnim {
|
|
||||||
from {
|
|
||||||
transform: rotate( 0deg );
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: rotate( 360deg );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,208 +0,0 @@
|
|||||||
.material-symbols-outlined {
|
|
||||||
font-variation-settings:
|
|
||||||
'FILL' 0,
|
|
||||||
'wght' 400,
|
|
||||||
'GRAD' 0,
|
|
||||||
'opsz' 24
|
|
||||||
}
|
|
||||||
|
|
||||||
body, html {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing-symbols {
|
|
||||||
position: absolute;
|
|
||||||
left: 10vw;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: row;
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
background-color: rgba( 0, 0, 0, 0.6 );
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing-symbols-wrapper {
|
|
||||||
width: 4vw;
|
|
||||||
height: 5vw;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing-bar {
|
|
||||||
height: 60%;
|
|
||||||
background-color: white;
|
|
||||||
width: 10%;
|
|
||||||
border-radius: 50px;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bar-1 {
|
|
||||||
animation: music-playing 0.9s infinite ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bar-2 {
|
|
||||||
animation: music-playing 0.9s infinite ease-in-out;
|
|
||||||
animation-delay: 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bar-3 {
|
|
||||||
animation: music-playing 0.9s infinite ease-in-out;
|
|
||||||
animation-delay: 0.6s;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes music-playing {
|
|
||||||
0% {
|
|
||||||
transform: scaleY( 1 );
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
transform: scaleY( 0.5 );
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: scaleY( 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list-wrapper {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
width: 80%;
|
|
||||||
margin: 2px;
|
|
||||||
padding: 1vh;
|
|
||||||
border: 1px white solid;
|
|
||||||
background-color: rgba( 0, 0, 0, 0.4 );
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-details-wrapper {
|
|
||||||
margin: 0;
|
|
||||||
display: block;
|
|
||||||
margin-left: 10px;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list .song-image {
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
font-size: 5vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pause-icon {
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
font-size: 5vw !important;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.current-song-wrapper {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 55vh;
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: 0.5%;
|
|
||||||
margin-top: 0.25%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.current-song {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
margin-top: 1vh;
|
|
||||||
padding: 1vh;
|
|
||||||
text-align: center;
|
|
||||||
background-color: rgba( 0, 0, 0, 0.4 );
|
|
||||||
}
|
|
||||||
|
|
||||||
.fancy-view-song-art {
|
|
||||||
height: 30vh;
|
|
||||||
width: 30vh;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
font-size: 30vh !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#app {
|
|
||||||
background-color: rgba( 0, 0, 0, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
#progress, #progress::-webkit-progress-bar {
|
|
||||||
background-color: rgba(45, 28, 145);
|
|
||||||
color: rgba(45, 28, 145);
|
|
||||||
width: 30vw;
|
|
||||||
border: none;
|
|
||||||
border-radius: 0px;
|
|
||||||
accent-color: white;
|
|
||||||
-webkit-appearance: none;
|
|
||||||
appearance: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#progress::-moz-progress-bar {
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
#progress::-webkit-progress-value {
|
|
||||||
background-color: white !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode-selector-wrapper {
|
|
||||||
opacity: 0;
|
|
||||||
position: fixed;
|
|
||||||
right: 0.5%;
|
|
||||||
top: 0.5%;
|
|
||||||
padding: 0.5%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode-selector-wrapper:hover {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dancing-style {
|
|
||||||
font-size: 250%;
|
|
||||||
margin: 0;
|
|
||||||
font-weight: bolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info {
|
|
||||||
position: fixed;
|
|
||||||
font-size: 12px;
|
|
||||||
transform: rotate(270deg);
|
|
||||||
left: -150px;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
top: 50%;
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=7">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
||||||
<title>Showcase - MusicPlayerV2</title>
|
|
||||||
<link rel="stylesheet" href="/fancy/showcase.css">
|
|
||||||
<link rel="stylesheet" href="/fancy/backgroundAnim.css">
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="info">Designed and developed by Janis Hutz <a href="https://janishutz.com" target="_blank" style="text-decoration: none; color: white;">https://janishutz.com</a></div>
|
|
||||||
<div class="content" id="app">
|
|
||||||
<div v-if="hasLoaded" style="width: 100%">
|
|
||||||
<div class="current-song-wrapper">
|
|
||||||
<span class="material-symbols-outlined fancy-view-song-art" v-if="!playingSong.hasCoverArt">music_note</span>
|
|
||||||
<img v-else-if="playingSong.hasCoverArt && playingSong.coverArtOrigin === 'api'" :src="playingSong.coverArtURL" class="fancy-view-song-art" id="current-image" crossorigin="anonymous">
|
|
||||||
<img v-else :src="'/getSongCover?filename=' + playingSong.filename" class="fancy-view-song-art" id="current-image">
|
|
||||||
<div class="current-song">
|
|
||||||
<progress max="1000" id="progress" :value="progressBar"></progress>
|
|
||||||
<h1>{{ playingSong.title }}</h1>
|
|
||||||
<p class="dancing-style" v-if="playingSong.dancingStyle">{{ playingSong.dancingStyle }}</p>
|
|
||||||
<p>{{ playingSong.artist }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="mode-selector-wrapper">
|
|
||||||
<select v-model="visualizationSettings" @change="setVisualization()">
|
|
||||||
<option value="mic">Microphone (Mic access required)</option>
|
|
||||||
<option value="bpm">BPM (might not be 100% accurate)</option>
|
|
||||||
<option value="off">No visualization except background</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="song-list-wrapper">
|
|
||||||
<div v-for="song in songQueue" class="song-list">
|
|
||||||
<span class="material-symbols-outlined song-image" v-if="!song.hasCoverArt && ( playingSong.filename !== song.filename || isPlaying )">music_note</span>
|
|
||||||
<img v-else-if="song.hasCoverArt && ( playingSong.filename !== song.filename || isPlaying ) && song.coverArtOrigin === 'api'" :src="song.coverArtURL" class="song-image">
|
|
||||||
<img v-else-if="song.hasCoverArt && ( playingSong.filename !== song.filename || isPlaying ) && song.coverArtOrigin !== 'api'" :src="'/getSongCover?filename=' + song.filename" class="song-image">
|
|
||||||
<div v-if="playingSong.filename === song.filename && isPlaying" class="playing-symbols">
|
|
||||||
<div class="playing-symbols-wrapper">
|
|
||||||
<div class="playing-bar" id="bar-1"></div>
|
|
||||||
<div class="playing-bar" id="bar-2"></div>
|
|
||||||
<div class="playing-bar" id="bar-3"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span class="material-symbols-outlined pause-icon" v-if="!isPlaying && playingSong.filename === song.filename">pause</span>
|
|
||||||
<div class="song-details-wrapper">
|
|
||||||
<h3>{{ song.title }}</h3>
|
|
||||||
<p>{{ song.artist }}</p>
|
|
||||||
</div>
|
|
||||||
<div class="time-until">
|
|
||||||
{{ getTimeUntil( song ) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <img :src="" alt=""> -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<h1>Loading...</h1>
|
|
||||||
</div>
|
|
||||||
<div class="background" id="background">
|
|
||||||
<div class="beat"></div>
|
|
||||||
<div class="beat-manual"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
|
||||||
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/color-thief/2.3.0/color-thief.umd.js"></script>
|
|
||||||
<script src="/fancy/showcase.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,361 +0,0 @@
|
|||||||
// eslint-disable-next-line no-undef
|
|
||||||
const { createApp } = Vue;
|
|
||||||
|
|
||||||
createApp( {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hasLoaded: false,
|
|
||||||
songs: [],
|
|
||||||
playingSong: {},
|
|
||||||
isPlaying: false,
|
|
||||||
pos: 0,
|
|
||||||
queuePos: 0,
|
|
||||||
colourPalette: [],
|
|
||||||
progressBar: 0,
|
|
||||||
timeTracker: null,
|
|
||||||
visualizationSettings: 'mic',
|
|
||||||
micAnalyzer: null,
|
|
||||||
beatDetected: false,
|
|
||||||
colorThief: null,
|
|
||||||
lastDispatch: new Date().getTime() - 5000,
|
|
||||||
isReconnecting: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
songQueue() {
|
|
||||||
let ret = [];
|
|
||||||
let pos = 0;
|
|
||||||
for ( let song in this.songs ) {
|
|
||||||
if ( pos >= this.queuePos ) {
|
|
||||||
ret.push( this.songs[ song ] );
|
|
||||||
}
|
|
||||||
pos += 1;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
},
|
|
||||||
getTimeUntil() {
|
|
||||||
return ( song ) => {
|
|
||||||
let timeRemaining = 0;
|
|
||||||
for ( let i = this.queuePos; i < Object.keys( this.songs ).length - 1; i++ ) {
|
|
||||||
if ( this.songs[ i ] == song ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
timeRemaining += parseInt( this.songs[ i ].duration );
|
|
||||||
}
|
|
||||||
if ( this.isPlaying ) {
|
|
||||||
if ( timeRemaining === 0 ) {
|
|
||||||
return 'Currently playing';
|
|
||||||
} else {
|
|
||||||
return 'Playing in less than ' + Math.ceil( timeRemaining / 60 - this.pos / 60 ) + 'min';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ( timeRemaining === 0 ) {
|
|
||||||
return 'Plays next';
|
|
||||||
} else {
|
|
||||||
return 'Playing less than ' + Math.ceil( timeRemaining / 60 - this.pos / 60 ) + 'min after starting to play';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
startTimeTracker () {
|
|
||||||
this.timeTracker = setInterval( () => {
|
|
||||||
this.pos = ( new Date().getTime() - this.playingSong.startTime ) / 1000 + this.oldPos;
|
|
||||||
this.progressBar = ( this.pos / this.playingSong.duration ) * 1000;
|
|
||||||
if ( isNaN( this.progressBar ) ) {
|
|
||||||
this.progressBar = 0;
|
|
||||||
}
|
|
||||||
}, 100 );
|
|
||||||
},
|
|
||||||
stopTimeTracker () {
|
|
||||||
clearInterval( this.timeTracker );
|
|
||||||
this.oldPos = this.pos;
|
|
||||||
},
|
|
||||||
getImageData() {
|
|
||||||
return new Promise( ( resolve, reject ) => {
|
|
||||||
if ( this.playingSong.hasCoverArt ) {
|
|
||||||
setTimeout( () => {
|
|
||||||
const img = document.getElementById( 'current-image' );
|
|
||||||
if ( img.complete ) {
|
|
||||||
resolve( this.colorThief.getPalette( img ) );
|
|
||||||
} else {
|
|
||||||
img.addEventListener( 'load', () => {
|
|
||||||
resolve( this.colorThief.getPalette( img ) );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
}, 500 );
|
|
||||||
} else {
|
|
||||||
reject( 'no image' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
connect() {
|
|
||||||
this.colorThief = new ColorThief();
|
|
||||||
let source = new EventSource( '/clientDisplayNotifier', { withCredentials: true } );
|
|
||||||
source.onmessage = ( e ) => {
|
|
||||||
let data;
|
|
||||||
try {
|
|
||||||
data = JSON.parse( e.data );
|
|
||||||
} catch ( err ) {
|
|
||||||
data = { 'type': e.data };
|
|
||||||
}
|
|
||||||
if ( data.type === 'basics' ) {
|
|
||||||
this.isPlaying = data.data.isPlaying ?? false;
|
|
||||||
this.playingSong = data.data.playingSong ?? {};
|
|
||||||
this.songs = data.data.songQueue ?? [];
|
|
||||||
this.pos = data.data.pos ?? 0;
|
|
||||||
this.oldPos = data.data.pos ?? 0;
|
|
||||||
this.progressBar = this.pos / this.playingSong.duration * 1000;
|
|
||||||
this.queuePos = data.data.queuePos ?? 0;
|
|
||||||
this.getImageData().then( palette => {
|
|
||||||
this.colourPalette = palette;
|
|
||||||
this.handleBackground();
|
|
||||||
} ).catch( () => {
|
|
||||||
this.colourPalette = [ { 'r': 255, 'g': 0, 'b': 0 }, { 'r': 0, 'g': 255, 'b': 0 }, { 'r': 0, 'g': 0, 'b': 255 } ];
|
|
||||||
this.handleBackground();
|
|
||||||
} );
|
|
||||||
} else if ( data.type === 'pos' ) {
|
|
||||||
this.pos = data.data;
|
|
||||||
this.oldPos = data.data;
|
|
||||||
this.progressBar = data.data / this.playingSong.duration * 1000;
|
|
||||||
} else if ( data.type === 'isPlaying' ) {
|
|
||||||
this.isPlaying = data.data;
|
|
||||||
this.handleBackground();
|
|
||||||
} else if ( data.type === 'songQueue' ) {
|
|
||||||
this.songs = data.data;
|
|
||||||
} else if ( data.type === 'playingSong' ) {
|
|
||||||
this.playingSong = data.data;
|
|
||||||
this.getImageData().then( palette => {
|
|
||||||
this.colourPalette = palette;
|
|
||||||
this.handleBackground();
|
|
||||||
} ).catch( () => {
|
|
||||||
this.colourPalette = [ [ 255, 0, 0 ], [ 0, 255, 0 ], [ 0, 0, 255 ] ];
|
|
||||||
this.handleBackground();
|
|
||||||
} );
|
|
||||||
} else if ( data.type === 'queuePos' ) {
|
|
||||||
this.queuePos = data.data;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
source.onopen = () => {
|
|
||||||
this.isReconnecting = false;
|
|
||||||
this.hasLoaded = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
let self = this;
|
|
||||||
|
|
||||||
source.addEventListener( 'error', function( e ) {
|
|
||||||
if ( e.eventPhase == EventSource.CLOSED ) source.close();
|
|
||||||
|
|
||||||
if ( e.target.readyState == EventSource.CLOSED ) {
|
|
||||||
console.log( 'disconnected' );
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Notify about disconnect
|
|
||||||
setTimeout( () => {
|
|
||||||
if ( !self.isReconnecting ) {
|
|
||||||
self.isReconnecting = true;
|
|
||||||
self.tryReconnect();
|
|
||||||
}
|
|
||||||
}, 1000 );
|
|
||||||
}, false );
|
|
||||||
},
|
|
||||||
tryReconnect() {
|
|
||||||
const int = setInterval( () => {
|
|
||||||
if ( !this.isReconnecting ) {
|
|
||||||
clearInterval( int );
|
|
||||||
} else {
|
|
||||||
connectToSSESource();
|
|
||||||
}
|
|
||||||
}, 1000 );
|
|
||||||
},
|
|
||||||
handleBackground() {
|
|
||||||
let colourDetails = [];
|
|
||||||
let colours = [];
|
|
||||||
let differentEnough = true;
|
|
||||||
if ( this.colourPalette[ 0 ] ) {
|
|
||||||
for ( let i in this.colourPalette ) {
|
|
||||||
for ( let colour in colourDetails ) {
|
|
||||||
const colourDiff = ( Math.abs( colourDetails[ colour ][ 0 ] - this.colourPalette[ i ][ 0 ] ) / 255
|
|
||||||
+ Math.abs( colourDetails[ colour ][ 1 ] - this.colourPalette[ i ][ 1 ] ) / 255
|
|
||||||
+ Math.abs( colourDetails[ colour ][ 2 ] - this.colourPalette[ i ][ 2 ] ) / 255 ) / 3 * 100;
|
|
||||||
if ( colourDiff > 15 ) {
|
|
||||||
differentEnough = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( differentEnough ) {
|
|
||||||
colourDetails.push( this.colourPalette[ i ] );
|
|
||||||
colours.push( 'rgb(' + this.colourPalette[ i ][ 0 ] + ',' + this.colourPalette[ i ][ 1 ] + ',' + this.colourPalette[ i ][ 2 ] + ')' );
|
|
||||||
}
|
|
||||||
differentEnough = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let outColours = 'conic-gradient(';
|
|
||||||
if ( colours.length < 3 ) {
|
|
||||||
for ( let i = 0; i < 3; i++ ) {
|
|
||||||
if ( colours[ i ] ) {
|
|
||||||
outColours += colours[ i ] + ',';
|
|
||||||
} else {
|
|
||||||
if ( i === 0 ) {
|
|
||||||
outColours += 'blue,';
|
|
||||||
} else if ( i === 1 ) {
|
|
||||||
outColours += 'green,';
|
|
||||||
} else if ( i === 2 ) {
|
|
||||||
outColours += 'red,';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ( colours.length < 11 ) {
|
|
||||||
for ( let i in colours ) {
|
|
||||||
outColours += colours[ i ] + ',';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for ( let i = 0; i < 10; i++ ) {
|
|
||||||
outColours += colours[ i ] + ',';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
outColours += colours[ 0 ] ?? 'blue' + ')';
|
|
||||||
|
|
||||||
$( '#background' ).css( 'background', outColours );
|
|
||||||
this.setVisualization();
|
|
||||||
},
|
|
||||||
setVisualization () {
|
|
||||||
if ( Object.keys( this.playingSong ).length > 0 ) {
|
|
||||||
if ( this.visualizationSettings === 'bpm' ) {
|
|
||||||
if ( this.playingSong.bpm && this.isPlaying ) {
|
|
||||||
$( '.beat' ).show();
|
|
||||||
$( '.beat' ).css( 'animation-duration', 60 / this.playingSong.bpm );
|
|
||||||
$( '.beat' ).css( 'animation-delay', this.pos % ( 60 / this.playingSong.bpm * this.pos ) + this.playingSong.bpmOffset - ( 60 / this.playingSong.bpm * this.pos / 2 ) );
|
|
||||||
} else {
|
|
||||||
$( '.beat' ).hide();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
clearInterval( this.micAnalyzer );
|
|
||||||
} catch ( err ) {}
|
|
||||||
} else if ( this.visualizationSettings === 'off' ) {
|
|
||||||
$( '.beat' ).hide();
|
|
||||||
try {
|
|
||||||
clearInterval( this.micAnalyzer );
|
|
||||||
} catch ( err ) {}
|
|
||||||
} else if ( this.visualizationSettings === 'mic' ) {
|
|
||||||
$( '.beat-manual' ).hide();
|
|
||||||
try {
|
|
||||||
clearInterval( this.micAnalyzer );
|
|
||||||
} catch ( err ) {}
|
|
||||||
this.micAudioHandler();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log( 'not playing yet' );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
micAudioHandler () {
|
|
||||||
const audioContext = new ( window.AudioContext || window.webkitAudioContext )();
|
|
||||||
const analyser = audioContext.createAnalyser();
|
|
||||||
analyser.fftSize = 256;
|
|
||||||
const bufferLength = analyser.frequencyBinCount;
|
|
||||||
const dataArray = new Uint8Array( bufferLength );
|
|
||||||
|
|
||||||
navigator.mediaDevices.getUserMedia( { audio: true } ).then( ( stream ) => {
|
|
||||||
const mic = audioContext.createMediaStreamSource( stream );
|
|
||||||
mic.connect( analyser );
|
|
||||||
analyser.getByteFrequencyData( dataArray );
|
|
||||||
let prevSpectrum = null;
|
|
||||||
let threshold = 10; // Adjust as needed
|
|
||||||
this.beatDetected = false;
|
|
||||||
this.micAnalyzer = setInterval( () => {
|
|
||||||
analyser.getByteFrequencyData( dataArray );
|
|
||||||
// Convert the frequency data to a numeric array
|
|
||||||
const currentSpectrum = Array.from( dataArray );
|
|
||||||
|
|
||||||
if ( prevSpectrum ) {
|
|
||||||
// Calculate the spectral flux
|
|
||||||
const flux = this.calculateSpectralFlux( prevSpectrum, currentSpectrum );
|
|
||||||
|
|
||||||
if ( flux > threshold && !this.beatDetected ) {
|
|
||||||
// Beat detected
|
|
||||||
this.beatDetected = true;
|
|
||||||
this.animateBeat();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
prevSpectrum = currentSpectrum;
|
|
||||||
}, 20 );
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
animateBeat () {
|
|
||||||
$( '.beat-manual' ).stop();
|
|
||||||
const duration = Math.ceil( 60 / ( this.playingSong.bpm ?? 180 ) * 500 ) - 50;
|
|
||||||
$( '.beat-manual' ).fadeIn( 50 );
|
|
||||||
setTimeout( () => {
|
|
||||||
$( '.beat-manual' ).fadeOut( duration );
|
|
||||||
setTimeout( () => {
|
|
||||||
$( '.beat-manual' ).stop();
|
|
||||||
this.beatDetected = false;
|
|
||||||
}, duration );
|
|
||||||
}, 50 );
|
|
||||||
},
|
|
||||||
calculateSpectralFlux( prevSpectrum, currentSpectrum ) {
|
|
||||||
let flux = 0;
|
|
||||||
|
|
||||||
for ( let i = 0; i < prevSpectrum.length; i++ ) {
|
|
||||||
const diff = currentSpectrum[ i ] - prevSpectrum[ i ];
|
|
||||||
flux += Math.max( 0, diff );
|
|
||||||
}
|
|
||||||
|
|
||||||
return flux;
|
|
||||||
},
|
|
||||||
notifier() {
|
|
||||||
if ( parseInt( this.lastDispatch ) + 5000 < new Date().getTime() ) {
|
|
||||||
|
|
||||||
}
|
|
||||||
Notification.requestPermission();
|
|
||||||
|
|
||||||
console.warn( '[ notifier ]: Status is now enabled \n\n-> Any leaving or tampering with the website will send a notification to the host' );
|
|
||||||
// Detect if window is currently in focus
|
|
||||||
window.onblur = () => {
|
|
||||||
this.sendNotification( 'blur' );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Detect if browser window becomes hidden (also with blur event)
|
|
||||||
document.onvisibilitychange = () => {
|
|
||||||
if ( document.visibilityState === 'hidden' ) {
|
|
||||||
this.sendNotification( 'visibility' );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
sendNotification( notification ) {
|
|
||||||
let fetchOptions = {
|
|
||||||
method: 'post',
|
|
||||||
body: JSON.stringify( { 'type': notification } ),
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'charset': 'utf-8'
|
|
||||||
},
|
|
||||||
};
|
|
||||||
fetch( '/clientStatusUpdate', fetchOptions ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
|
|
||||||
new Notification( 'YOU ARE UNDER SURVEILLANCE', {
|
|
||||||
body: 'Please return to the original webpage immediately!',
|
|
||||||
requireInteraction: true,
|
|
||||||
} )
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.connect();
|
|
||||||
this.notifier();
|
|
||||||
// if ( this.visualizationSettings === 'mic' ) {
|
|
||||||
// this.micAudioHandler();
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
isPlaying( value ) {
|
|
||||||
if ( value ) {
|
|
||||||
this.startTimeTracker();
|
|
||||||
} else {
|
|
||||||
this.stopTimeTracker();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} ).mount( '#app' );
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=7">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
||||||
<title>Showcase - MusicPlayerV2</title>
|
|
||||||
<link rel="stylesheet" href="/showcase.css">
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="info">Designed and developed by Janis Hutz <a href="https://janishutz.com" target="_blank" style="text-decoration: none; color: white;">https://janishutz.com</a></div>
|
|
||||||
<div class="content loading" id="loading">
|
|
||||||
<h1>Loading...</h1>
|
|
||||||
<p>Please wait</p>
|
|
||||||
</div>
|
|
||||||
<div class="content" id="app">
|
|
||||||
<div v-if="hasLoaded" style="width: 100%">
|
|
||||||
<div class="current-song-wrapper">
|
|
||||||
<span class="material-symbols-outlined fancy-view-song-art" v-if="!playingSong.hasCoverArt || playingSong.coverArtOrigin !== 'api'">music_note</span>
|
|
||||||
<img v-else-if="playingSong.hasCoverArt && playingSong.coverArtOrigin === 'api'" :src="playingSong.coverArtURL" class="fancy-view-song-art" id="current-image" crossorigin="anonymous">
|
|
||||||
<div class="current-song">
|
|
||||||
<progress max="1000" id="progress" :value="progressBar"></progress>
|
|
||||||
<h1>{{ playingSong.title }}</h1>
|
|
||||||
<p class="dancing-style" v-if="playingSong.dancingStyle">{{ playingSong.dancingStyle }}</p>
|
|
||||||
<p>{{ playingSong.artist }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="song-list-wrapper">
|
|
||||||
<div v-for="song in songQueue" class="song-list">
|
|
||||||
<div class="song-details-wrapper">
|
|
||||||
<h3>{{ song.title }}</h3>
|
|
||||||
<p>{{ song.artist }}</p>
|
|
||||||
</div>
|
|
||||||
<div class="time-until">
|
|
||||||
{{ getTimeUntil( song ) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <img :src="" alt=""> -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<h1>Loading...</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
|
||||||
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/color-thief/2.3.0/color-thief.umd.js"></script>
|
|
||||||
<script src="/showcase.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
.material-symbols-outlined {
|
|
||||||
font-variation-settings:
|
|
||||||
'FILL' 0,
|
|
||||||
'wght' 400,
|
|
||||||
'GRAD' 0,
|
|
||||||
'opsz' 24
|
|
||||||
}
|
|
||||||
|
|
||||||
body, html {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
color: white;
|
|
||||||
background-color: rgb(29, 29, 29);
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
width: 100%;
|
|
||||||
display: none;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loaded {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading {
|
|
||||||
display: flex;
|
|
||||||
height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing-symbols {
|
|
||||||
position: absolute;
|
|
||||||
left: 10vw;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: row;
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
background-color: rgba( 0, 0, 0, 0.6 );
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing-symbols-wrapper {
|
|
||||||
width: 4vw;
|
|
||||||
height: 5vw;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list-wrapper {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
margin-bottom: 5%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
width: 80%;
|
|
||||||
margin: 2px;
|
|
||||||
padding: 1vh;
|
|
||||||
border: 1px white solid;
|
|
||||||
background-color: rgba( 0, 0, 0, 0.4 );
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-details-wrapper {
|
|
||||||
margin: 0;
|
|
||||||
display: block;
|
|
||||||
margin-left: 10px;
|
|
||||||
margin-right: auto;
|
|
||||||
width: 65%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list .song-image {
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
font-size: 5vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pause-icon {
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
font-size: 5vw !important;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.current-song-wrapper {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: 2%;
|
|
||||||
margin-top: 1%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.current-song {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
margin-top: 1vh;
|
|
||||||
padding: 1vh;
|
|
||||||
max-width: 80%;
|
|
||||||
text-align: center;
|
|
||||||
background-color: rgba( 0, 0, 0, 0.4 );
|
|
||||||
}
|
|
||||||
|
|
||||||
.fancy-view-song-art {
|
|
||||||
height: 30vh;
|
|
||||||
width: 30vh;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
font-size: 30vh !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#app {
|
|
||||||
background-color: rgba( 0, 0, 0, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
#progress, #progress::-webkit-progress-bar {
|
|
||||||
background-color: rgba(45, 28, 145);
|
|
||||||
color: rgba(45, 28, 145);
|
|
||||||
width: 30vw;
|
|
||||||
border: none;
|
|
||||||
border-radius: 0px;
|
|
||||||
accent-color: white;
|
|
||||||
-webkit-appearance: none;
|
|
||||||
appearance: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#progress::-moz-progress-bar {
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
#progress::-webkit-progress-value {
|
|
||||||
background-color: white !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode-selector-wrapper {
|
|
||||||
opacity: 0;
|
|
||||||
position: fixed;
|
|
||||||
right: 0.5%;
|
|
||||||
top: 0.5%;
|
|
||||||
padding: 0.5%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode-selector-wrapper:hover {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dancing-style {
|
|
||||||
font-size: 250%;
|
|
||||||
margin: 0;
|
|
||||||
font-weight: bolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info {
|
|
||||||
position: fixed;
|
|
||||||
font-size: 12px;
|
|
||||||
transform: rotate(270deg);
|
|
||||||
left: -150px;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
top: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.time-until {
|
|
||||||
width: 30%;
|
|
||||||
text-align: end;
|
|
||||||
}
|
|
||||||
@@ -1,159 +0,0 @@
|
|||||||
// eslint-disable-next-line no-undef
|
|
||||||
const { createApp } = Vue;
|
|
||||||
|
|
||||||
createApp( {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hasLoaded: false,
|
|
||||||
songs: [],
|
|
||||||
playingSong: {},
|
|
||||||
isPlaying: false,
|
|
||||||
pos: 0,
|
|
||||||
queuePos: 0,
|
|
||||||
colourPalette: [],
|
|
||||||
progressBar: 0,
|
|
||||||
timeTracker: null,
|
|
||||||
isReconnecting: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
songQueue() {
|
|
||||||
let ret = [];
|
|
||||||
let pos = 0;
|
|
||||||
for ( let song in this.songs ) {
|
|
||||||
if ( pos >= this.queuePos ) {
|
|
||||||
ret.push( this.songs[ song ] );
|
|
||||||
}
|
|
||||||
pos += 1;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
},
|
|
||||||
getTimeUntil() {
|
|
||||||
return ( song ) => {
|
|
||||||
let timeRemaining = 0;
|
|
||||||
for ( let i = this.queuePos; i < Object.keys( this.songs ).length; i++ ) {
|
|
||||||
if ( this.songs[ i ] == song ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
timeRemaining += parseInt( this.songs[ i ].duration );
|
|
||||||
}
|
|
||||||
if ( this.isPlaying ) {
|
|
||||||
if ( timeRemaining === 0 ) {
|
|
||||||
return 'Currently playing';
|
|
||||||
} else {
|
|
||||||
return 'Playing in less than ' + Math.ceil( timeRemaining / 60 - this.pos / 60 ) + 'min';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ( timeRemaining === 0 ) {
|
|
||||||
return 'Plays next';
|
|
||||||
} else {
|
|
||||||
return 'Playing less than ' + Math.ceil( timeRemaining / 60 - this.pos / 60 ) + 'min after starting to play';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
startTimeTracker () {
|
|
||||||
try {
|
|
||||||
clearInterval( this.timeTracker );
|
|
||||||
} catch ( err ) {}
|
|
||||||
this.timeTracker = setInterval( () => {
|
|
||||||
this.pos = ( new Date().getTime() - this.playingSong.startTime ) / 1000 + this.oldPos;
|
|
||||||
this.progressBar = ( this.pos / this.playingSong.duration ) * 1000;
|
|
||||||
if ( isNaN( this.progressBar ) ) {
|
|
||||||
this.progressBar = 0;
|
|
||||||
}
|
|
||||||
}, 100 );
|
|
||||||
},
|
|
||||||
stopTimeTracker () {
|
|
||||||
clearInterval( this.timeTracker );
|
|
||||||
this.oldPos = this.pos;
|
|
||||||
},
|
|
||||||
connect() {
|
|
||||||
let source = new EventSource( '/clientDisplayNotifier', { withCredentials: true } );
|
|
||||||
source.onmessage = ( e ) => {
|
|
||||||
let data;
|
|
||||||
try {
|
|
||||||
data = JSON.parse( e.data );
|
|
||||||
} catch ( err ) {
|
|
||||||
data = { 'type': e.data };
|
|
||||||
}
|
|
||||||
if ( data.type === 'basics' ) {
|
|
||||||
this.isPlaying = data.data.isPlaying ?? false;
|
|
||||||
this.playingSong = data.data.playingSong ?? {};
|
|
||||||
this.songs = data.data.songQueue ?? [];
|
|
||||||
this.pos = data.data.pos ?? 0;
|
|
||||||
this.oldPos = data.data.pos ?? 0;
|
|
||||||
this.progressBar = this.pos / this.playingSong.duration * 1000;
|
|
||||||
this.queuePos = data.data.queuePos ?? 0;
|
|
||||||
} else if ( data.type === 'pos' ) {
|
|
||||||
this.pos = data.data;
|
|
||||||
this.oldPos = data.data;
|
|
||||||
this.progressBar = data.data / this.playingSong.duration * 1000;
|
|
||||||
} else if ( data.type === 'isPlaying' ) {
|
|
||||||
this.isPlaying = data.data;
|
|
||||||
} else if ( data.type === 'songQueue' ) {
|
|
||||||
this.songs = data.data;
|
|
||||||
} else if ( data.type === 'playingSong' ) {
|
|
||||||
this.playingSong = data.data;
|
|
||||||
} else if ( data.type === 'queuePos' ) {
|
|
||||||
this.queuePos = data.data;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
source.onopen = () => {
|
|
||||||
this.isReconnecting = false;
|
|
||||||
this.hasLoaded = true;
|
|
||||||
if ( document.fonts.status === 'loaded' ) {
|
|
||||||
document.getElementById( 'loading' ).classList.remove( 'loading' );
|
|
||||||
document.getElementById( 'app' ).classList.add( 'loaded' );
|
|
||||||
} else {
|
|
||||||
document.fonts.onloadingdone = () => {
|
|
||||||
document.getElementById( 'loading' ).classList.remove( 'loading' );
|
|
||||||
document.getElementById( 'app' ).classList.add( 'loaded' );
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
let self = this;
|
|
||||||
|
|
||||||
source.addEventListener( 'error', function( e ) {
|
|
||||||
if ( e.eventPhase == EventSource.CLOSED ) source.close();
|
|
||||||
|
|
||||||
if ( e.target.readyState == EventSource.CLOSED ) {
|
|
||||||
console.log( 'disconnected' );
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout( () => {
|
|
||||||
if ( !self.isReconnecting ) {
|
|
||||||
self.isReconnecting = true;
|
|
||||||
self.tryReconnect();
|
|
||||||
}
|
|
||||||
}, 1000 );
|
|
||||||
}, false );
|
|
||||||
},
|
|
||||||
tryReconnect() {
|
|
||||||
const int = setInterval( () => {
|
|
||||||
if ( !this.isReconnecting ) {
|
|
||||||
clearInterval( int );
|
|
||||||
} else {
|
|
||||||
connectToSSESource();
|
|
||||||
}
|
|
||||||
}, 1000 );
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.connect();
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
isPlaying( value ) {
|
|
||||||
if ( value ) {
|
|
||||||
this.startTimeTracker();
|
|
||||||
} else {
|
|
||||||
this.stopTimeTracker();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} ).mount( '#app' );
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
> 1%
|
|
||||||
last 2 versions
|
|
||||||
not dead
|
|
||||||
not ie 11
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
.DS_Store
|
|
||||||
node_modules
|
|
||||||
/dist
|
|
||||||
|
|
||||||
|
|
||||||
# local env files
|
|
||||||
.env.local
|
|
||||||
.env.*.local
|
|
||||||
|
|
||||||
# Log files
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
pnpm-debug.log*
|
|
||||||
|
|
||||||
# Editor directories and files
|
|
||||||
.idea
|
|
||||||
.vscode
|
|
||||||
*.suo
|
|
||||||
*.ntvs*
|
|
||||||
*.njsproj
|
|
||||||
*.sln
|
|
||||||
*.sw?
|
|
||||||
|
|
||||||
#Electron-builder output
|
|
||||||
/dist_electron
|
|
||||||
test
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# musicplayerv2
|
|
||||||
|
|
||||||
## Project setup
|
|
||||||
```
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
### Compiles and hot-reloads for development
|
|
||||||
```
|
|
||||||
npm run serve
|
|
||||||
```
|
|
||||||
|
|
||||||
### Compiles and minifies for production
|
|
||||||
```
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
### Customize configuration
|
|
||||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
presets: [
|
|
||||||
'@vue/cli-plugin-babel/preset'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es5",
|
|
||||||
"module": "esnext",
|
|
||||||
"baseUrl": "./",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"paths": {
|
|
||||||
"@/*": [
|
|
||||||
"src/*"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"lib": [
|
|
||||||
"esnext",
|
|
||||||
"dom",
|
|
||||||
"dom.iterable",
|
|
||||||
"scripthost"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Generated
-26497
File diff suppressed because it is too large
Load Diff
@@ -1,56 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "musicplayerv2",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"maintainers": [
|
|
||||||
"Janis Hutz <development@janishutz.com>"
|
|
||||||
],
|
|
||||||
"description": "A music player",
|
|
||||||
"homepage": "https://janishutz.com/projects/musicplayerv2",
|
|
||||||
"author": {
|
|
||||||
"name": "Janis Hutz",
|
|
||||||
"email": "development@janishutz.com",
|
|
||||||
"url": "https://janishutz.com"
|
|
||||||
},
|
|
||||||
"license": "GPL-3.0-or-later",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/simplePCBuilding/musicplayerv2/issues"
|
|
||||||
},
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"serve": "vue-cli-service serve",
|
|
||||||
"build": "vue-cli-service build",
|
|
||||||
"electron:build": "vue-cli-service electron:build",
|
|
||||||
"electron:serve": "vue-cli-service electron:serve",
|
|
||||||
"postinstall": "electron-builder install-app-deps",
|
|
||||||
"postuninstall": "electron-builder install-app-deps"
|
|
||||||
},
|
|
||||||
"main": "background.js",
|
|
||||||
"dependencies": {
|
|
||||||
"axios": "^1.6.1",
|
|
||||||
"core-js": "^3.8.3",
|
|
||||||
"cors": "^2.8.5",
|
|
||||||
"csv-parser": "^3.0.0",
|
|
||||||
"electron-squirrel-startup": "^1.0.0",
|
|
||||||
"eventsource": "^2.0.2",
|
|
||||||
"express-session": "^1.17.3",
|
|
||||||
"ip": "^1.1.8",
|
|
||||||
"jquery": "^3.7.1",
|
|
||||||
"json-beautify": "^1.1.1",
|
|
||||||
"jsonwebtoken": "^9.0.2",
|
|
||||||
"music-metadata": "^7.13.0",
|
|
||||||
"node-fetch": "^2.7.0",
|
|
||||||
"node-musickit-api": "^2.1.1",
|
|
||||||
"realtime-bpm-analyzer": "^3.2.1",
|
|
||||||
"vue": "^3.2.13",
|
|
||||||
"vue-router": "^4.0.3",
|
|
||||||
"web-audio-beat-detector": "^8.1.55"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@vue/cli-plugin-babel": "~5.0.0",
|
|
||||||
"@vue/cli-plugin-router": "~5.0.0",
|
|
||||||
"@vue/cli-service": "~5.0.0",
|
|
||||||
"electron": "^13.0.0",
|
|
||||||
"electron-devtools-installer": "^3.1.0",
|
|
||||||
"vue-cli-plugin-electron-builder": "~2.1.1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/* fallback */
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Material Symbols Outlined';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 100 700;
|
|
||||||
src: url(/iconFont.woff2) format('woff2');
|
|
||||||
}
|
|
||||||
|
|
||||||
.material-symbols-outlined {
|
|
||||||
font-family: 'Material Symbols Outlined';
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
font-size: 24px;
|
|
||||||
line-height: 1;
|
|
||||||
letter-spacing: normal;
|
|
||||||
text-transform: none;
|
|
||||||
display: inline-block;
|
|
||||||
white-space: nowrap;
|
|
||||||
word-wrap: normal;
|
|
||||||
direction: ltr;
|
|
||||||
-moz-font-feature-settings: 'liga';
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
Binary file not shown.
@@ -1,19 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
||||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
|
||||||
<link rel="stylesheet" href="/icon-font.css" />
|
|
||||||
<script src="/jquery.min.js"></script>
|
|
||||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<noscript>
|
|
||||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> 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>
|
|
||||||
Vendored
-2
File diff suppressed because one or more lines are too long
@@ -1,177 +0,0 @@
|
|||||||
<template>
|
|
||||||
<router-view v-slot="{ Component, route }">
|
|
||||||
<transition :name="route.meta.transition || 'fade'" mode="out-in">
|
|
||||||
<component :is="Component" />
|
|
||||||
</transition>
|
|
||||||
</router-view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
:root, :root.light {
|
|
||||||
--primary-color: #2c3e50;
|
|
||||||
--accent-background: rgb(30, 30, 82);
|
|
||||||
--secondary-color: white;
|
|
||||||
--background-color: white;
|
|
||||||
--popup-color: rgb(224, 224, 224);
|
|
||||||
--accent-color: #42b983;
|
|
||||||
--hover-color: rgb(165, 165, 165);
|
|
||||||
--accent-background-hover: rgb(124, 140, 236);
|
|
||||||
--overlay-color: rgba(0, 0, 0, 0.7);
|
|
||||||
--border-color: rgb(100, 100, 100);
|
|
||||||
--highlight-backdrop: rgb(143, 134, 192);
|
|
||||||
--hint-color: rgb(174, 210, 221);
|
|
||||||
--PI: 3.14159265358979;
|
|
||||||
}
|
|
||||||
|
|
||||||
:root.dark {
|
|
||||||
--primary-color: white;
|
|
||||||
--accent-background: rgb(56, 56, 112);
|
|
||||||
--secondary-color: white;
|
|
||||||
--background-color: rgb(32, 32, 32);
|
|
||||||
--popup-color: rgb(58, 58, 58);
|
|
||||||
--accent-color: #42b983;
|
|
||||||
--hover-color: rgb(83, 83, 83);
|
|
||||||
--accent-background-hover: #4380a8;
|
|
||||||
--overlay-color: rgba(104, 104, 104, 0.575);
|
|
||||||
--border-color: rgb(190, 190, 190);
|
|
||||||
--highlight-backdrop: rgb(85, 63, 207);
|
|
||||||
--hint-color: rgb(88, 91, 110);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media ( prefers-color-scheme: dark ) {
|
|
||||||
:root {
|
|
||||||
--primary-color: white;
|
|
||||||
--accent-background: rgb(56, 56, 112);
|
|
||||||
--secondary-color: white;
|
|
||||||
--background-color: rgb(32, 32, 32);
|
|
||||||
--popup-color: rgb(58, 58, 58);
|
|
||||||
--accent-color: #42b983;
|
|
||||||
--hover-color: rgb(83, 83, 83);
|
|
||||||
--accent-background-hover: #4380a8;
|
|
||||||
--overlay-color: rgba(104, 104, 104, 0.575);
|
|
||||||
--border-color: rgb(190, 190, 190);
|
|
||||||
--highlight-backdrop: rgb(85, 63, 207);
|
|
||||||
--hint-color: rgb(88, 91, 110);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
::selection {
|
|
||||||
background-color: var( --highlight-backdrop );
|
|
||||||
color: var( --secondary-color );
|
|
||||||
}
|
|
||||||
|
|
||||||
#themeSelector {
|
|
||||||
background-color: rgba( 0, 0, 0, 0 );
|
|
||||||
color: var( --primary-color );
|
|
||||||
font-size: 130%;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
html,
|
|
||||||
body {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: var( --background-color );
|
|
||||||
color: var( --primary-color );
|
|
||||||
}
|
|
||||||
|
|
||||||
#app {
|
|
||||||
transition: 0.5s;
|
|
||||||
background-color: var( --background-color );
|
|
||||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
text-align: center;
|
|
||||||
color: var( --primary-color );
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
nav {
|
|
||||||
padding: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
nav a {
|
|
||||||
font-weight: bold;
|
|
||||||
color: var( --primary-color );
|
|
||||||
}
|
|
||||||
|
|
||||||
nav a.router-link-exact-active {
|
|
||||||
color: #42b983;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scale-enter-active,
|
|
||||||
.scale-leave-active {
|
|
||||||
transition: all 0.5s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scale-enter-from,
|
|
||||||
.scale-leave-to {
|
|
||||||
opacity: 0;
|
|
||||||
transform: scale(0.9);
|
|
||||||
}
|
|
||||||
|
|
||||||
.fade-enter-active,
|
|
||||||
.fade-leave-active {
|
|
||||||
transition: opacity 0.4s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fade-enter-from,
|
|
||||||
.fade-leave-to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.material-symbols-outlined {
|
|
||||||
font-variation-settings:
|
|
||||||
'FILL' 0,
|
|
||||||
'wght' 400,
|
|
||||||
'GRAD' 0,
|
|
||||||
'opsz' 48
|
|
||||||
}
|
|
||||||
|
|
||||||
.clr-open {
|
|
||||||
border: black solid 1px !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'app',
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
theme: '',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
changeTheme () {
|
|
||||||
if ( this.theme === '☼' ) {
|
|
||||||
document.documentElement.classList.remove( 'dark' );
|
|
||||||
document.documentElement.classList.add( 'light' );
|
|
||||||
localStorage.setItem( 'theme', '☽' );
|
|
||||||
this.theme = '☽';
|
|
||||||
} else if ( this.theme === '☽' ) {
|
|
||||||
document.documentElement.classList.remove( 'light' );
|
|
||||||
document.documentElement.classList.add( 'dark' );
|
|
||||||
localStorage.setItem( 'theme', '☼' );
|
|
||||||
this.theme = '☼';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created () {
|
|
||||||
this.theme = localStorage.getItem( 'theme' ) ?? '';
|
|
||||||
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches || this.theme === '☼' ) {
|
|
||||||
document.documentElement.classList.add( 'dark' );
|
|
||||||
this.theme = '☼';
|
|
||||||
} else {
|
|
||||||
document.documentElement.classList.add( 'light' );
|
|
||||||
this.theme = '☽';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,382 +0,0 @@
|
|||||||
const express = require( 'express' );
|
|
||||||
let app = express();
|
|
||||||
const path = require( 'path' );
|
|
||||||
const cors = require( 'cors' );
|
|
||||||
const fs = require( 'fs' );
|
|
||||||
const bodyParser = require( 'body-parser' );
|
|
||||||
const dialog = require( 'electron' ).dialog;
|
|
||||||
const session = require( 'express-session' );
|
|
||||||
const indexer = require( './indexer.js' );
|
|
||||||
const axios = require( 'axios' );
|
|
||||||
const ip = require( 'ip' );
|
|
||||||
const jwt = require( 'jsonwebtoken' );
|
|
||||||
const shell = require( 'electron' ).shell;
|
|
||||||
const beautify = require( 'json-beautify' );
|
|
||||||
const EventSource = require( 'eventsource' );
|
|
||||||
|
|
||||||
|
|
||||||
app.use( bodyParser.urlencoded( { extended: false } ) );
|
|
||||||
app.use( bodyParser.json() );
|
|
||||||
app.use( cors() );
|
|
||||||
app.use( session( {
|
|
||||||
secret: 'aeogetwöfaöow0ofö034eö8ptqw39eöavfui786uqew9t0ez9eauigwöfqewoöaiq938w0c8p9awöäf9¨äüöe',
|
|
||||||
saveUninitialized: true,
|
|
||||||
resave: false,
|
|
||||||
} ) );
|
|
||||||
|
|
||||||
const conf = JSON.parse( fs.readFileSync( path.join( __dirname + '/config/config.json' ) ) );
|
|
||||||
|
|
||||||
// TODO: Import from config
|
|
||||||
const remoteURL = conf.connectionURL ?? 'http://localhost:3000';
|
|
||||||
let hasConnected = false;
|
|
||||||
|
|
||||||
const connect = () => {
|
|
||||||
if ( authKey !== '' && conf.doConnect ) {
|
|
||||||
axios.post( remoteURL + '/connect', { 'authKey': authKey } ).then( res => {
|
|
||||||
if ( res.status === 200 ) {
|
|
||||||
console.log( '[ BACKEND INTEGRATION ] Connection successful' );
|
|
||||||
hasConnected = true;
|
|
||||||
} else {
|
|
||||||
console.error( '[ BACKEND INTEGRATION ] Connection error occurred' );
|
|
||||||
}
|
|
||||||
} ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
connectToSSESource();
|
|
||||||
return 'connecting';
|
|
||||||
} else {
|
|
||||||
return 'noAuthKey';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let isSSEAuth = false;
|
|
||||||
let sessionToken = '';
|
|
||||||
let errorCount = 0;
|
|
||||||
let isReconnecting = false;
|
|
||||||
|
|
||||||
const connectToSSESource = () => {
|
|
||||||
if ( isSSEAuth ) {
|
|
||||||
let source = new EventSource( remoteURL + '/mainNotifier', {
|
|
||||||
https: true,
|
|
||||||
withCredentials: true,
|
|
||||||
headers: {
|
|
||||||
'Cookie': sessionToken
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
source.onmessage = ( e ) => {
|
|
||||||
let data;
|
|
||||||
try {
|
|
||||||
data = JSON.parse( e.data );
|
|
||||||
} catch ( err ) {
|
|
||||||
data = { 'type': e.data };
|
|
||||||
}
|
|
||||||
if ( data.type === 'blur' ) {
|
|
||||||
sendClientUpdate( data.type, data.ip );
|
|
||||||
} else if ( data.type === 'visibility' ) {
|
|
||||||
sendClientUpdate( data.type, data.ip );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
source.onopen = () => {
|
|
||||||
isReconnecting = false;
|
|
||||||
console.log( '[ BACKEND INTEGRATION ] Connection to notifier successful' );
|
|
||||||
};
|
|
||||||
|
|
||||||
source.addEventListener( 'error', function( e ) {
|
|
||||||
if ( e.eventPhase == EventSource.CLOSED ) source.close();
|
|
||||||
|
|
||||||
setTimeout( () => {
|
|
||||||
if ( !isReconnecting ) {
|
|
||||||
isReconnecting = true;
|
|
||||||
console.log( '[ BACKEND INTEGRATION ] Disconnected from notifier, reconnecting...' );
|
|
||||||
tryReconnect();
|
|
||||||
}
|
|
||||||
}, 1000 );
|
|
||||||
}, false );
|
|
||||||
} else {
|
|
||||||
axios.post( remoteURL + '/authSSE', { 'authKey': authKey } ).then( res => {
|
|
||||||
if ( res.status == 200 ) {
|
|
||||||
sessionToken = res.headers[ 'set-cookie' ][ 0 ].slice( 0, res.headers[ 'set-cookie' ][ 0 ].indexOf( ';' ) );
|
|
||||||
isSSEAuth = true;
|
|
||||||
connectToSSESource();
|
|
||||||
} else {
|
|
||||||
connectToSSESource();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const tryReconnect = () => {
|
|
||||||
const int = setInterval( () => {
|
|
||||||
if ( !isReconnecting ) {
|
|
||||||
clearInterval( int );
|
|
||||||
} else {
|
|
||||||
if ( errorCount > 5 ) {
|
|
||||||
isSSEAuth = false;
|
|
||||||
errorCount = 0;
|
|
||||||
} else {
|
|
||||||
errorCount += 1;
|
|
||||||
}
|
|
||||||
connectToSSESource();
|
|
||||||
}
|
|
||||||
}, 1000 );
|
|
||||||
}
|
|
||||||
|
|
||||||
let authKey = conf.authKey ?? '';
|
|
||||||
|
|
||||||
connect();
|
|
||||||
|
|
||||||
|
|
||||||
let connectedClients = {};
|
|
||||||
let changedStatus = [];
|
|
||||||
|
|
||||||
let currentDetails = {
|
|
||||||
'songQueue': [],
|
|
||||||
'playingSong': {},
|
|
||||||
'pos': 0,
|
|
||||||
'isPlaying': false,
|
|
||||||
'queuePos': 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
let connectedMain = {};
|
|
||||||
// TODO: Add backend integration
|
|
||||||
|
|
||||||
require( './appleMusicRoutes.js' )( app );
|
|
||||||
|
|
||||||
app.get( '/', ( request, response ) => {
|
|
||||||
response.sendFile( path.join( __dirname + '/client/showcase.html' ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/getLocalIP', ( req, res ) => {
|
|
||||||
res.send( ip.address() );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/useAppleMusic', ( req, res ) => {
|
|
||||||
shell.openExternal( 'http://localhost:8081/apple-music' );
|
|
||||||
res.send( 'ok' );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/openSongs', ( req, res ) => {
|
|
||||||
// res.send( '{ "data": [ "/home/janis/Music/KB2022" ] }' );
|
|
||||||
// res.send( '{ "data": [ "/mnt/storage/SORTED/Music/audio/KB2022" ] }' );
|
|
||||||
res.send( { 'data': dialog.showOpenDialogSync( { properties: [ 'openDirectory' ], title: 'Open music library folder' } ) } );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/showcase.js', ( req, res ) => {
|
|
||||||
res.sendFile( path.join( __dirname + '/client/showcase.js' ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/showcase.css', ( req, res ) => {
|
|
||||||
res.sendFile( path.join( __dirname + '/client/showcase.css' ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/backgroundAnim.css', ( req, res ) => {
|
|
||||||
res.sendFile( path.join( __dirname + '/client/backgroundAnim.css' ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/clientDisplayNotifier', ( req, res ) => {
|
|
||||||
res.writeHead( 200, {
|
|
||||||
'Content-Type': 'text/event-stream',
|
|
||||||
'Cache-Control': 'no-cache',
|
|
||||||
'Connection': 'keep-alive',
|
|
||||||
} );
|
|
||||||
res.status( 200 );
|
|
||||||
res.flushHeaders();
|
|
||||||
let det = { 'type': 'basics', 'data': currentDetails };
|
|
||||||
res.write( `data: ${ JSON.stringify( det ) }\n\n` );
|
|
||||||
connectedClients[ req.session.id ] = res;
|
|
||||||
req.on( 'close', () => {
|
|
||||||
connectedClients.splice( Object.keys( connectedClients ).indexOf( req.session.id ), 1 );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/mainNotifier', ( req, res ) => {
|
|
||||||
const ipRetrieved = req.headers[ 'x-forwarded-for' ];
|
|
||||||
const ip = ipRetrieved ? ipRetrieved.split( /, / )[ 0 ] : req.connection.remoteAddress;
|
|
||||||
if ( ip === '::ffff:127.0.0.1' || ip === '::1' ) {
|
|
||||||
res.writeHead( 200, {
|
|
||||||
'Content-Type': 'text/event-stream',
|
|
||||||
'Cache-Control': 'no-cache',
|
|
||||||
'Connection': 'keep-alive',
|
|
||||||
} );
|
|
||||||
res.status( 200 );
|
|
||||||
res.flushHeaders();
|
|
||||||
let det = { 'type': 'basics' };
|
|
||||||
res.write( `data: ${ JSON.stringify( det ) }\n\n` );
|
|
||||||
connectedMain = res;
|
|
||||||
} else {
|
|
||||||
res.send( 'wrong' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
const sendUpdate = ( update ) => {
|
|
||||||
if ( update === 'pos' ) {
|
|
||||||
currentDetails[ 'playingSong' ][ 'startTime' ] = new Date().getTime();
|
|
||||||
for ( let client in connectedClients ) {
|
|
||||||
connectedClients[ client ].write( 'data: ' + JSON.stringify( { 'type': 'playingSong', 'data': currentDetails[ 'playingSong' ] } ) + '\n\n' );
|
|
||||||
connectedClients[ client ].write( 'data: ' + JSON.stringify( { 'type': 'pos', 'data': currentDetails[ 'pos' ] } ) + '\n\n' );
|
|
||||||
}
|
|
||||||
} else if ( update === 'playingSong' ) {
|
|
||||||
if ( !currentDetails[ 'playingSong' ] ) {
|
|
||||||
currentDetails[ 'playingSong' ] = {};
|
|
||||||
}
|
|
||||||
currentDetails[ 'playingSong' ][ 'startTime' ] = new Date().getTime();
|
|
||||||
for ( let client in connectedClients ) {
|
|
||||||
connectedClients[ client ].write( 'data: ' + JSON.stringify( { 'type': 'pos', 'data': currentDetails[ 'pos' ] } ) + '\n\n' );
|
|
||||||
}
|
|
||||||
} else if ( update === 'isPlaying' ) {
|
|
||||||
currentDetails[ 'playingSong' ][ 'startTime' ] = new Date().getTime();
|
|
||||||
for ( let client in connectedClients ) {
|
|
||||||
connectedClients[ client ].write( 'data: ' + JSON.stringify( { 'type': 'playingSong', 'data': currentDetails[ 'playingSong' ] } ) + '\n\n' );
|
|
||||||
connectedClients[ client ].write( 'data: ' + JSON.stringify( { 'type': 'pos', 'data': currentDetails[ 'pos' ] } ) + '\n\n' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( let client in connectedClients ) {
|
|
||||||
connectedClients[ client ].write( 'data: ' + JSON.stringify( { 'type': update, 'data': currentDetails[ update ] } ) + '\n\n' );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if connected and if not, try to authenticate with data from authKey file
|
|
||||||
|
|
||||||
if ( hasConnected ) {
|
|
||||||
if ( update === 'isPlaying' ) {
|
|
||||||
axios.post( remoteURL + '/statusUpdate', { 'type': 'playingSong', 'data': currentDetails[ 'playingSong' ], 'authKey': authKey } ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
|
|
||||||
axios.post( remoteURL + '/statusUpdate', { 'type': 'pos', 'data': currentDetails[ 'pos' ], 'authKey': authKey } ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
} else if ( update === 'pos' ) {
|
|
||||||
axios.post( remoteURL + '/statusUpdate', { 'type': 'playingSong', 'data': currentDetails[ 'playingSong' ], 'authKey': authKey } ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
|
|
||||||
axios.post( remoteURL + '/statusUpdate', { 'type': 'pos', 'data': currentDetails[ 'pos' ], 'authKey': authKey } ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
axios.post( remoteURL + '/statusUpdate', { 'type': update, 'data': currentDetails[ update ], 'authKey': authKey } ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
} else {
|
|
||||||
connect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const allowedTypes = [ 'playingSong', 'isPlaying', 'songQueue', 'pos', 'queuePos' ];
|
|
||||||
app.post( '/statusUpdate', ( req, res ) => {
|
|
||||||
if ( allowedTypes.includes( req.body.type ) ) {
|
|
||||||
currentDetails[ req.body.type ] = req.body.data;
|
|
||||||
changedStatus.push( req.body.type );
|
|
||||||
sendUpdate( req.body.type );
|
|
||||||
res.send( 'ok' );
|
|
||||||
} else {
|
|
||||||
res.status( 400 ).send( 'ERR_UNKNOWN_TYPE' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
// STATUS UPDATE from the client display to send to main ui
|
|
||||||
// Send update if page is closed
|
|
||||||
const allowedMainUpdates = [ 'blur', 'visibility' ];
|
|
||||||
app.post( '/clientStatusUpdate', ( req, res ) => {
|
|
||||||
if ( allowedMainUpdates.includes( req.body.type ) ) {
|
|
||||||
const ipRetrieved = req.headers[ 'x-forwarded-for' ];
|
|
||||||
const ip = ipRetrieved ? ipRetrieved.split( /, / )[ 0 ] : req.connection.remoteAddress;
|
|
||||||
sendClientUpdate( req.body.type, ip );
|
|
||||||
res.send( 'ok' );
|
|
||||||
} else {
|
|
||||||
res.status( 400 ).send( 'ERR_UNKNOWN_TYPE' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
const sendClientUpdate = ( update, ip ) => {
|
|
||||||
try {
|
|
||||||
connectedMain.write( 'data: ' + JSON.stringify( { 'type': update, 'ip': ip } ) + '\n\n' );
|
|
||||||
} catch ( err ) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
app.get( '/indexDirs', ( req, res ) => {
|
|
||||||
if ( req.query.dir ) {
|
|
||||||
indexer.index( req ).then( dirIndex => {
|
|
||||||
res.send( dirIndex );
|
|
||||||
} ).catch( err => {
|
|
||||||
if ( err === 'ERR_DIR_NOT_FOUND' ) {
|
|
||||||
res.status( 404 ).send( 'ERR_DIR_NOT_FOUND' );
|
|
||||||
} else {
|
|
||||||
res.status( 500 ).send( 'unable to process' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
} else {
|
|
||||||
res.status( 400 ).send( 'ERR_REQ_INCOMPLETE' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/loadPlaylist', ( req, res ) => {
|
|
||||||
const selFile = dialog.showOpenDialogSync( { properties: [ 'openFile' ], title: 'Open file with playlist' } )[ 0 ];
|
|
||||||
res.send( { 'data': JSON.parse( fs.readFileSync( selFile ) ), 'path': selFile } );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/getMetadata', async ( req, res ) => {
|
|
||||||
res.send( await indexer.analyzeFile( req.query.file ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.post( '/savePlaylist', ( req, res ) => {
|
|
||||||
fs.writeFileSync( dialog.showSaveDialogSync( {
|
|
||||||
properties: [ 'createDirectory' ],
|
|
||||||
title: 'Save the playlist as a json file',
|
|
||||||
filters: [
|
|
||||||
{
|
|
||||||
extensions: [ 'json' ],
|
|
||||||
name: 'JSON files',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
defaultPath: 'songs.json'
|
|
||||||
} ), beautify( req.body, null, 2, 50 ) );
|
|
||||||
res.send( 'ok' );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/getSongCover', ( req, res ) => {
|
|
||||||
if ( req.query.filename ) {
|
|
||||||
if ( indexer.getImages( req.query.filename ) ) {
|
|
||||||
res.send( indexer.getImages( req.query.filename ) );
|
|
||||||
} else {
|
|
||||||
res.status( 404 ).send( 'No cover image for this file' );
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
res.status( 400 ).send( 'ERR_REQ_INCOMPLETE' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/getSongFile', ( req, res ) => {
|
|
||||||
if ( req.query.filename ) {
|
|
||||||
res.sendFile( req.query.filename );
|
|
||||||
} else {
|
|
||||||
res.status( 400 ).send( 'ERR_REQ_INCOMPLETE' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
|
|
||||||
app.get( '/getAppleMusicDevToken', ( req, res ) => {
|
|
||||||
// sign dev token
|
|
||||||
const privateKey = fs.readFileSync( path.join( __dirname + '/config/apple_private_key.p8' ) ).toString();
|
|
||||||
// TODO: Remove secret
|
|
||||||
const config = JSON.parse( fs.readFileSync( path.join( __dirname + '/config/apple-music-api.config.json' ) ) );
|
|
||||||
const jwtToken = jwt.sign( {}, privateKey, {
|
|
||||||
algorithm: "ES256",
|
|
||||||
expiresIn: "180d",
|
|
||||||
issuer: config.teamID,
|
|
||||||
header: {
|
|
||||||
alg: "ES256",
|
|
||||||
kid: config.keyID
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
res.send( jwtToken );
|
|
||||||
} );
|
|
||||||
|
|
||||||
|
|
||||||
app.use( ( request, response, next ) => {
|
|
||||||
response.sendFile( path.join( __dirname + '' ) )
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.listen( 8081 );
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
/*
|
|
||||||
* MusicPlayerV2 - appleMusicRoutes.js
|
|
||||||
*
|
|
||||||
* Created by Janis Hutz 11/14/2023, Licensed under the GPL V3 License
|
|
||||||
* https://janishutz.com, development@janishutz.com
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
const path = require( 'path' );
|
|
||||||
const fs = require( 'fs' );
|
|
||||||
const csv = require( 'csv-parser' );
|
|
||||||
const dialog = require( 'electron' ).dialog;
|
|
||||||
|
|
||||||
const analyzeFile = ( filepath ) => {
|
|
||||||
return new Promise( ( resolve, reject ) => {
|
|
||||||
if ( filepath.includes( '.csv' ) ) {
|
|
||||||
// This will assume that line #1 will be song #1 in the file list
|
|
||||||
// (when sorted by name)
|
|
||||||
let results = {};
|
|
||||||
let pos = 0;
|
|
||||||
fs.createReadStream( filepath )
|
|
||||||
.pipe( csv() )
|
|
||||||
.on( 'data', ( data ) => {
|
|
||||||
results[ pos ] = data;
|
|
||||||
pos += 1;
|
|
||||||
} ).on( 'end', () => {
|
|
||||||
resolve( results );
|
|
||||||
} );
|
|
||||||
} else if ( filepath.includes( '.json' ) ) {
|
|
||||||
resolve( JSON.parse( fs.readFileSync( filepath ) ) );
|
|
||||||
} else {
|
|
||||||
reject( 'NO_CSV_OR_JSON_FILE' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = ( app ) => {
|
|
||||||
app.get( '/apple-music', ( req, res ) => {
|
|
||||||
res.sendFile( path.join( __dirname + '/client/appleMusic/index.html' ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/apple-music/helpers/:file', ( req, res ) => {
|
|
||||||
res.sendFile( path.join( __dirname + '/client/appleMusic/' + req.params.file ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/icon-font.css', ( req, res ) => {
|
|
||||||
res.sendFile( path.join( __dirname + '/client/icon-font.css' ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/iconFont.woff2', ( req, res ) => {
|
|
||||||
res.sendFile( path.join( __dirname + '/client/iconFont.woff2' ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/logo.png', ( req, res ) => {
|
|
||||||
res.sendFile( path.join( __dirname + '/client/logo.png' ) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
app.get( '/apple-music/getAdditionalData', ( req, res ) => {
|
|
||||||
const filepath = dialog.showOpenDialogSync( {
|
|
||||||
properties: [ 'openFile' ],
|
|
||||||
title: 'Open file with additional data on the songs',
|
|
||||||
filters: [
|
|
||||||
{
|
|
||||||
name: 'All supported files (.csv, .json)',
|
|
||||||
extensions: [ 'csv', 'json' ],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'JSON',
|
|
||||||
extensions: [ 'json' ],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'CSV',
|
|
||||||
extensions: [ 'csv' ],
|
|
||||||
}
|
|
||||||
],
|
|
||||||
} )[ 0 ];
|
|
||||||
analyzeFile( filepath ).then( analyzedFile => {
|
|
||||||
res.send( analyzedFile );
|
|
||||||
} ).catch( () => {
|
|
||||||
res.status( 500 ).send( 'no csv / json file' );
|
|
||||||
} )
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M204-318q-22-38-33-78t-11-82q0-134 93-228t227-94h7l-64-64 56-56 160 160-160 160-56-56 64-64h-7q-100 0-170 70.5T240-478q0 26 6 51t18 49l-60 60ZM481-40 321-200l160-160 56 56-64 64h7q100 0 170-70.5T720-482q0-26-6-51t-18-49l60-60q22 38 33 78t11 82q0 134-93 228t-227 94h-7l64 64-56 56Z"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 386 B |
Binary file not shown.
|
Before Width: | Height: | Size: 582 KiB |
@@ -1,82 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
|
|
||||||
import { app, protocol, BrowserWindow } from 'electron'
|
|
||||||
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
|
|
||||||
import installExtension, { VUEJS3_DEVTOOLS } from 'electron-devtools-installer'
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
|
||||||
|
|
||||||
// Scheme must be registered before the app is ready
|
|
||||||
protocol.registerSchemesAsPrivileged([
|
|
||||||
{ scheme: 'app', privileges: { secure: true, standard: true } }
|
|
||||||
])
|
|
||||||
|
|
||||||
async function createWindow() {
|
|
||||||
// Create the browser window.
|
|
||||||
const win = new BrowserWindow({
|
|
||||||
width: 800,
|
|
||||||
height: 600,
|
|
||||||
webPreferences: {
|
|
||||||
|
|
||||||
// Use pluginOptions.nodeIntegration, leave this alone
|
|
||||||
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
|
|
||||||
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
|
|
||||||
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if (process.env.WEBPACK_DEV_SERVER_URL) {
|
|
||||||
// Load the url of the dev server if in development mode
|
|
||||||
await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
|
|
||||||
if (!process.env.IS_TEST) win.webContents.openDevTools()
|
|
||||||
} else {
|
|
||||||
createProtocol('app')
|
|
||||||
// Load the index.html when not in development
|
|
||||||
win.loadURL('app://./index.html')
|
|
||||||
}
|
|
||||||
require( './app.js' );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Quit when all windows are closed.
|
|
||||||
app.on('window-all-closed', () => {
|
|
||||||
// On macOS it is common for applications and their menu bar
|
|
||||||
// to stay active until the user quits explicitly with Cmd + Q
|
|
||||||
if (process.platform !== 'darwin') {
|
|
||||||
app.quit()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
app.on('activate', () => {
|
|
||||||
// On macOS it's common to re-create a window in the app when the
|
|
||||||
// dock icon is clicked and there are no other windows open.
|
|
||||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
|
||||||
})
|
|
||||||
|
|
||||||
// This method will be called when Electron has finished
|
|
||||||
// initialization and is ready to create browser windows.
|
|
||||||
// Some APIs can only be used after this event occurs.
|
|
||||||
app.on('ready', async () => {
|
|
||||||
if (isDevelopment && !process.env.IS_TEST) {
|
|
||||||
// Install Vue Devtools
|
|
||||||
try {
|
|
||||||
await installExtension(VUEJS3_DEVTOOLS)
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Vue Devtools failed to install:', e.toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
createWindow()
|
|
||||||
})
|
|
||||||
|
|
||||||
// Exit cleanly on request from parent process in development mode.
|
|
||||||
if (isDevelopment) {
|
|
||||||
if (process.platform === 'win32') {
|
|
||||||
process.on('message', (data) => {
|
|
||||||
if (data === 'graceful-exit') {
|
|
||||||
app.quit()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
process.on('SIGTERM', () => {
|
|
||||||
app.quit()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 24.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Artwork" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
||||||
width="361px" height="361px" viewBox="0 0 361 361" style="enable-background:new 0 0 361 361;" xml:space="preserve">
|
|
||||||
<style type="text/css">
|
|
||||||
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:url(#SVGID_1_);}
|
|
||||||
.st1{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;}
|
|
||||||
</style>
|
|
||||||
<g id="Layer_5">
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="180" y1="358.6047" x2="180" y2="7.7586">
|
|
||||||
<stop offset="0" style="stop-color:#FA233B"/>
|
|
||||||
<stop offset="1" style="stop-color:#FB5C74"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path class="st0" d="M360,112.61c0-4.3,0-8.6-0.02-12.9c-0.02-3.62-0.06-7.24-0.16-10.86c-0.21-7.89-0.68-15.84-2.08-23.64
|
|
||||||
c-1.42-7.92-3.75-15.29-7.41-22.49c-3.6-7.07-8.3-13.53-13.91-19.14c-5.61-5.61-12.08-10.31-19.15-13.91
|
|
||||||
c-7.19-3.66-14.56-5.98-22.47-7.41c-7.8-1.4-15.76-1.87-23.65-2.08c-3.62-0.1-7.24-0.14-10.86-0.16C255.99,0,251.69,0,247.39,0
|
|
||||||
H112.61c-4.3,0-8.6,0-12.9,0.02c-3.62,0.02-7.24,0.06-10.86,0.16C80.96,0.4,73,0.86,65.2,2.27c-7.92,1.42-15.28,3.75-22.47,7.41
|
|
||||||
c-7.07,3.6-13.54,8.3-19.15,13.91c-5.61,5.61-10.31,12.07-13.91,19.14c-3.66,7.2-5.99,14.57-7.41,22.49
|
|
||||||
c-1.4,7.8-1.87,15.76-2.08,23.64c-0.1,3.62-0.14,7.24-0.16,10.86C0,104.01,0,108.31,0,112.61v134.77c0,4.3,0,8.6,0.02,12.9
|
|
||||||
c0.02,3.62,0.06,7.24,0.16,10.86c0.21,7.89,0.68,15.84,2.08,23.64c1.42,7.92,3.75,15.29,7.41,22.49c3.6,7.07,8.3,13.53,13.91,19.14
|
|
||||||
c5.61,5.61,12.08,10.31,19.15,13.91c7.19,3.66,14.56,5.98,22.47,7.41c7.8,1.4,15.76,1.87,23.65,2.08c3.62,0.1,7.24,0.14,10.86,0.16
|
|
||||||
c4.3,0.03,8.6,0.02,12.9,0.02h134.77c4.3,0,8.6,0,12.9-0.02c3.62-0.02,7.24-0.06,10.86-0.16c7.89-0.21,15.85-0.68,23.65-2.08
|
|
||||||
c7.92-1.42,15.28-3.75,22.47-7.41c7.07-3.6,13.54-8.3,19.15-13.91c5.61-5.61,10.31-12.07,13.91-19.14
|
|
||||||
c3.66-7.2,5.99-14.57,7.41-22.49c1.4-7.8,1.87-15.76,2.08-23.64c0.1-3.62,0.14-7.24,0.16-10.86c0.03-4.3,0.02-8.6,0.02-12.9V112.61
|
|
||||||
z"/>
|
|
||||||
</g>
|
|
||||||
<g id="Glyph_2_">
|
|
||||||
<g>
|
|
||||||
<path class="st1" d="M254.5,55c-0.87,0.08-8.6,1.45-9.53,1.64l-107,21.59l-0.04,0.01c-2.79,0.59-4.98,1.58-6.67,3
|
|
||||||
c-2.04,1.71-3.17,4.13-3.6,6.95c-0.09,0.6-0.24,1.82-0.24,3.62c0,0,0,109.32,0,133.92c0,3.13-0.25,6.17-2.37,8.76
|
|
||||||
c-2.12,2.59-4.74,3.37-7.81,3.99c-2.33,0.47-4.66,0.94-6.99,1.41c-8.84,1.78-14.59,2.99-19.8,5.01
|
|
||||||
c-4.98,1.93-8.71,4.39-11.68,7.51c-5.89,6.17-8.28,14.54-7.46,22.38c0.7,6.69,3.71,13.09,8.88,17.82
|
|
||||||
c3.49,3.2,7.85,5.63,12.99,6.66c5.33,1.07,11.01,0.7,19.31-0.98c4.42-0.89,8.56-2.28,12.5-4.61c3.9-2.3,7.24-5.37,9.85-9.11
|
|
||||||
c2.62-3.75,4.31-7.92,5.24-12.35c0.96-4.57,1.19-8.7,1.19-13.26l0-116.15c0-6.22,1.76-7.86,6.78-9.08c0,0,88.94-17.94,93.09-18.75
|
|
||||||
c5.79-1.11,8.52,0.54,8.52,6.61l0,79.29c0,3.14-0.03,6.32-2.17,8.92c-2.12,2.59-4.74,3.37-7.81,3.99
|
|
||||||
c-2.33,0.47-4.66,0.94-6.99,1.41c-8.84,1.78-14.59,2.99-19.8,5.01c-4.98,1.93-8.71,4.39-11.68,7.51
|
|
||||||
c-5.89,6.17-8.49,14.54-7.67,22.38c0.7,6.69,3.92,13.09,9.09,17.82c3.49,3.2,7.85,5.56,12.99,6.6c5.33,1.07,11.01,0.69,19.31-0.98
|
|
||||||
c4.42-0.89,8.56-2.22,12.5-4.55c3.9-2.3,7.24-5.37,9.85-9.11c2.62-3.75,4.31-7.92,5.24-12.35c0.96-4.57,1-8.7,1-13.26V64.46
|
|
||||||
C263.54,58.3,260.29,54.5,254.5,55z"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 3.3 KiB |
@@ -1,129 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>MusicPlayerV2</title>
|
|
||||||
<script src="/apple-music/helpers/musickit.js"></script>
|
|
||||||
<link rel="stylesheet" href="/icon-font.css">
|
|
||||||
<link rel="stylesheet" href="/apple-music/helpers/playerStyle.css">
|
|
||||||
<link rel="stylesheet" href="/apple-music/helpers/style.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="app">
|
|
||||||
<div v-if="isShowingWarning" class="warning">
|
|
||||||
<h3>WARNING!</h3>
|
|
||||||
<p>A client display is being tampered with!</p>
|
|
||||||
<p>A desktop notification with a warning has already been dispatched.</p>
|
|
||||||
<button @click="dismissNotification()">Ok</button>
|
|
||||||
|
|
||||||
<div class="flash"></div>
|
|
||||||
</div>
|
|
||||||
<div v-if="isPreparingToPlay" class="preparingToPlay">
|
|
||||||
<span class="material-symbols-outlined loading-spinner">autorenew</span>
|
|
||||||
<h1>Loading player...</h1>
|
|
||||||
</div>
|
|
||||||
<div v-if="!isLoggedIn" class="start-page">
|
|
||||||
<div class="image-wrapper">
|
|
||||||
<img src="/logo.png" alt="Music player icon" id="logo-main">
|
|
||||||
<img src="/apple-music/helpers/appleMusicIcon.svg" alt="Apple Music Icon" id="apple-music-logo">
|
|
||||||
</div>
|
|
||||||
<h1>Apple Music integration</h1>
|
|
||||||
<button @click="logInto()" class="button">Log in</button>
|
|
||||||
</div>
|
|
||||||
<div v-else class="home">
|
|
||||||
<div v-if="!hasSelectedPlaylist" class="song-list-wrapper">
|
|
||||||
<h1>Your playlists</h1>
|
|
||||||
<button class="button" @click="selectPlaylistFromDisk()">Load playlist file from disk</button>
|
|
||||||
<div v-if="!hasLoadedPlaylists" style="display: flex; justify-content: center; align-items: center; flex-direction: column;">
|
|
||||||
<span class="material-symbols-outlined loading-spinner">autorenew</span>
|
|
||||||
<h3>Loading playlists...</h3>
|
|
||||||
</div>
|
|
||||||
<div v-for="playlist in playlists" class="song-list" @click="selectPlaylist( playlist.id )" style="cursor: pointer;">
|
|
||||||
<h3>{{ playlist.title }}</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else class="home">
|
|
||||||
<div class="top-bar">
|
|
||||||
<img src="/logo.png" alt="logo" class="logo">
|
|
||||||
<audio :src="'/getSongFile?filename=' + basePath + '/' + playingSong.filename" preload="metadata" id="audio-player"></audio>
|
|
||||||
<div class="player-wrapper">
|
|
||||||
<div class="player">
|
|
||||||
<div class="controls">
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasFinishedInit ? 'active': 'inactive'" @click="control( 'previous' )">skip_previous</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasFinishedInit ? 'active': 'inactive'" @click="control( 'replay10' )">replay_10</span>
|
|
||||||
<span class="material-symbols-outlined control-icon play-pause" v-if="!isPlaying && hasSelectedPlaylist" @click="control( 'play' )">play_arrow</span>
|
|
||||||
<span class="material-symbols-outlined control-icon play-pause" v-else-if="isPlaying && hasSelectedPlaylist" @click="control( 'pause' )">pause</span>
|
|
||||||
<span class="material-symbols-outlined control-icon play-pause" style="cursor: default;" v-else>play_disabled</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasFinishedInit ? 'active': 'inactive'" @click="control( 'forward10' )">forward_10</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasFinishedInit ? 'active': 'inactive'" @click="control( 'next' )" style="margin-right: 1vw;">skip_next</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasFinishedInit ? 'active': 'inactive'" v-if="!isShuffleEnabled" @click="control( 'shuffleOn' )">shuffle</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasFinishedInit ? 'active': 'inactive'" v-else @click="control( 'shuffleOff' )">shuffle_on</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasFinishedInit ? 'active': 'inactive'" v-if="repeatMode === 'off'" @click="control( 'repeatOne' )">repeat</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasFinishedInit ? 'active': 'inactive'" v-else-if="repeatMode === 'one'" @click="control( 'repeatAll' )">repeat_one_on</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasFinishedInit ? 'active': 'inactive'" v-else-if="repeatMode === 'all'" @click="control( 'repeatOff' )">repeat_on</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasSelectedPlaylist ? 'active': 'inactive'" @click="getAdditionalSongInfo()" title="Load additional song information" style="margin-left: 1vw;">upload</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasSelectedPlaylist ? 'active': 'inactive'" @click="exportCurrentPlaylist()" title="Export current playlist" style="margin-right: 1vw;">ios_share</span>
|
|
||||||
<div class="control-icon" id="settings">
|
|
||||||
<span class="material-symbols-outlined">info</span>
|
|
||||||
<div id="showIP">
|
|
||||||
<h4>IP to connect to:</h4><br>
|
|
||||||
<p>{{ localIP }}:8081</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button @click="search()">S</button>
|
|
||||||
</div>
|
|
||||||
<div class="song-info">
|
|
||||||
<div class="song-info-wrapper">
|
|
||||||
<img v-if="hasFinishedInit" :src="playingSong.coverArtURL" class="image">
|
|
||||||
<span class="material-symbols-outlined image" v-else>music_note</span>
|
|
||||||
<div class="name">
|
|
||||||
<h3>{{ playingSong.title ?? 'No song selected' }}</h3>
|
|
||||||
<p>{{ playingSong.artist }}</p>
|
|
||||||
</div>
|
|
||||||
<div class="image"></div>
|
|
||||||
</div>
|
|
||||||
<div class="playback-pos-info">
|
|
||||||
<div style="margin-right: auto;">{{ playbackPosBeautified }}</div>
|
|
||||||
<div @click="toggleShowMode()" style="cursor: pointer;">{{ durationBeautified }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="slider">
|
|
||||||
<progress id="progress-slider" class="progress-slider" :value="sliderProgress" max="1000" @mousedown="( e ) => { setPos( e ) }"
|
|
||||||
:class="hasFinishedInit ? '' : 'slider-inactive'"></progress>
|
|
||||||
<div v-if="hasFinishedInit" id="slider-knob" @mousedown="( e ) => { startMove( e ) }"
|
|
||||||
:style="'left: ' + ( parseInt( originalPos ) + parseInt( sliderPos ) ) + 'px;'">
|
|
||||||
<div id="slider-knob-style"></div>
|
|
||||||
</div>
|
|
||||||
<div v-else id="slider-knob" class="slider-inactive" style="left: 0;">
|
|
||||||
<div id="slider-knob-style"></div>
|
|
||||||
</div>
|
|
||||||
<div id="drag-support" @mousemove="e => { handleDrag( e ) }" @mouseup="() => { stopMove(); }"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="pool-wrapper">
|
|
||||||
<div style="width: 100%;" class="song-list-wrapper">
|
|
||||||
<div v-for="song in songQueue" class="song-list" :class="[ isPlaying ? ( playingSong.queuePos == song.queuePos ? 'playing': 'not-playing' ) : 'not-playing', !isPlaying && playingSong.filename === song.filename ? 'active-song': undefined ]">
|
|
||||||
<img :src="song.coverArtURL" class="song-image">
|
|
||||||
<div v-if="playingSong.queuePos == song.queuePos && isPlaying" class="playing-symbols">
|
|
||||||
<div class="playing-symbols-wrapper">
|
|
||||||
<div class="playing-bar" id="bar-1"></div>
|
|
||||||
<div class="playing-bar" id="bar-2"></div>
|
|
||||||
<div class="playing-bar" id="bar-3"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span class="material-symbols-outlined play-icon" @click="play( song )">play_arrow</span>
|
|
||||||
<span class="material-symbols-outlined pause-icon" @click="control( 'pause' )">pause</span>
|
|
||||||
<h3>{{ song.title }}</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
|
||||||
<script src="/apple-music/helpers/index.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,720 +0,0 @@
|
|||||||
/*
|
|
||||||
* MusicPlayerV2 - index.js
|
|
||||||
*
|
|
||||||
* Created by Janis Hutz 11/20/2023, Licensed under the GPL V3 License
|
|
||||||
* https://janishutz.com, development@janishutz.com
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Quick side note here: This is terribly ugly code, but I was in a hurry to finish it,
|
|
||||||
so I had no time to clean it up. I will do that at some point -jh
|
|
||||||
*/
|
|
||||||
|
|
||||||
const app = Vue.createApp( {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
musicKit: null,
|
|
||||||
isLoggedIn: false,
|
|
||||||
config: {
|
|
||||||
'devToken': '',
|
|
||||||
'userToken': ''
|
|
||||||
},
|
|
||||||
playlists: {},
|
|
||||||
hasSelectedPlaylist: false,
|
|
||||||
songQueue: {},
|
|
||||||
queuePos: 0,
|
|
||||||
pos: 0,
|
|
||||||
playingSong: {},
|
|
||||||
isPlaying: false,
|
|
||||||
isShuffleEnabled: false,
|
|
||||||
repeatMode: 'off',
|
|
||||||
playbackPosBeautified: '',
|
|
||||||
durationBeautified: '',
|
|
||||||
isShowingRemainingTime: false,
|
|
||||||
localIP: '',
|
|
||||||
hasLoadedPlaylists: false,
|
|
||||||
isPreparingToPlay: false,
|
|
||||||
additionalSongInfo: {},
|
|
||||||
hasFinishedInit: false,
|
|
||||||
isShowingWarning: false,
|
|
||||||
|
|
||||||
// For use with playlists that are partially from apple music and
|
|
||||||
// local drive
|
|
||||||
isUsingCustomPlaylist: false,
|
|
||||||
rawLoadedPlaylistData: {},
|
|
||||||
basePath: '',
|
|
||||||
audioPlayer: null,
|
|
||||||
isReconnecting: false,
|
|
||||||
|
|
||||||
// slider
|
|
||||||
offset: 0,
|
|
||||||
isDragging: false,
|
|
||||||
sliderPos: 0,
|
|
||||||
originalPos: 0,
|
|
||||||
sliderProgress: 0,
|
|
||||||
active: false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
logInto() {
|
|
||||||
if ( !this.musicKit.isAuthorized ) {
|
|
||||||
this.musicKit.authorize().then( () => {
|
|
||||||
this.isLoggedIn = true;
|
|
||||||
this.initMusicKit();
|
|
||||||
} );
|
|
||||||
} else {
|
|
||||||
this.musicKit.authorize().then( () => {
|
|
||||||
this.isLoggedIn = true;
|
|
||||||
this.initMusicKit();
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
initMusicKit () {
|
|
||||||
fetch( '/getAppleMusicDevToken' ).then( res => {
|
|
||||||
if ( res.status === 200 ) {
|
|
||||||
res.text().then( token => {
|
|
||||||
// MusicKit global is now defined
|
|
||||||
MusicKit.configure( {
|
|
||||||
developerToken: token,
|
|
||||||
app: {
|
|
||||||
name: 'MusicPlayer',
|
|
||||||
build: '2'
|
|
||||||
},
|
|
||||||
storefrontId: 'CH',
|
|
||||||
} ).then( () => {
|
|
||||||
this.config.devToken = token;
|
|
||||||
this.musicKit = MusicKit.getInstance();
|
|
||||||
if ( this.musicKit.isAuthorized ) {
|
|
||||||
this.isLoggedIn = true;
|
|
||||||
this.config.userToken = this.musicKit.musicUserToken;
|
|
||||||
}
|
|
||||||
this.musicKit.shuffleMode = MusicKit.PlayerShuffleMode.off;
|
|
||||||
this.apiGetRequest( 'https://api.music.apple.com/v1/me/library/playlists', this.playlistHandler );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
playlistHandler ( data ) {
|
|
||||||
if ( data.status === 'ok' ) {
|
|
||||||
const d = data.data.data;
|
|
||||||
this.playlist = {};
|
|
||||||
for ( let el in d ) {
|
|
||||||
this.playlists[ d[ el ].id ] = {
|
|
||||||
title: d[ el ].attributes.name,
|
|
||||||
id: d[ el ].id,
|
|
||||||
playParams: d[ el ].attributes.playParams,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.hasLoadedPlaylists = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
apiGetRequest( url, callback ) {
|
|
||||||
if ( this.config.devToken != '' && this.config.userToken != '' ) {
|
|
||||||
fetch( url, {
|
|
||||||
method: 'GET',
|
|
||||||
headers: {
|
|
||||||
'Authorization': `Bearer ${ this.config.devToken }`,
|
|
||||||
'Music-User-Token': this.config.userToken
|
|
||||||
}
|
|
||||||
} ).then( res => {
|
|
||||||
if ( res.status === 200 ) {
|
|
||||||
res.json().then( json => {
|
|
||||||
try {
|
|
||||||
callback( { 'status': 'ok', 'data': json } );
|
|
||||||
} catch( err ) {}
|
|
||||||
} );
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
callback( { 'status': 'error', 'error': res.status } );
|
|
||||||
} catch( err ) {}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
} else return false;
|
|
||||||
},
|
|
||||||
getAdditionalSongInfo() {
|
|
||||||
if ( Object.keys( this.additionalSongInfo ).length < 1 ) {
|
|
||||||
fetch( '/apple-music/getAdditionalData' ).then( res => {
|
|
||||||
if ( res.status === 200 ) {
|
|
||||||
res.json().then( json => {
|
|
||||||
this.additionalSongInfo = json;
|
|
||||||
this.handleAdditionalData();
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleAdditionalData () {
|
|
||||||
if ( Object.keys( this.additionalSongInfo ).length > 0 ) {
|
|
||||||
for ( let item in this.songQueue ) {
|
|
||||||
if ( this.additionalSongInfo[ item ] ) {
|
|
||||||
for ( let d in this.additionalSongInfo[ item ] ) {
|
|
||||||
if ( !this.songQueue[ item ][ d ] ) {
|
|
||||||
this.songQueue[ item ][ d ] = this.additionalSongInfo[ item ][ d ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.playingSong = this.songQueue[ this.queuePos ];
|
|
||||||
this.sendUpdate( 'songQueue' );
|
|
||||||
this.sendUpdate( 'playingSong' );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selectPlaylist( id ) {
|
|
||||||
this.isPreparingToPlay = true;
|
|
||||||
this.musicKit.setQueue( { playlist: id } ).then( () => {
|
|
||||||
try {
|
|
||||||
this.loadPlaylist();
|
|
||||||
this.hasSelectedPlaylist = true;
|
|
||||||
this.isPreparingToPlay = false;
|
|
||||||
} catch( err ) {
|
|
||||||
this.hasSelectedPlaylist = false;
|
|
||||||
console.error( err );
|
|
||||||
alert( 'We were unable to play. Please ensure that DRM (yeah sorry it is Apple Music, we cannot do anything about that) is enabled and working' );
|
|
||||||
}
|
|
||||||
} ).catch( err => {
|
|
||||||
console.error( 'ERROR whilst settings Queue', err );
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
handleDrag( e ) {
|
|
||||||
if ( this.isDragging ) {
|
|
||||||
if ( 0 < this.originalPos + e.screenX - this.offset && this.originalPos + e.screenX - this.offset < document.getElementById( 'progress-slider' ).clientWidth - 5 ) {
|
|
||||||
this.sliderPos = e.screenX - this.offset;
|
|
||||||
this.calcProgressPos();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
startMove( e ) {
|
|
||||||
this.offset = e.screenX;
|
|
||||||
this.isDragging = true;
|
|
||||||
document.getElementById( 'drag-support' ).classList.add( 'drag-support-active' );
|
|
||||||
},
|
|
||||||
stopMove() {
|
|
||||||
this.originalPos += parseInt( this.sliderPos );
|
|
||||||
this.isDragging = false;
|
|
||||||
this.offset = 0;
|
|
||||||
this.sliderPos = 0;
|
|
||||||
document.getElementById( 'drag-support' ).classList.remove( 'drag-support-active' );
|
|
||||||
this.calcPlaybackPos();
|
|
||||||
},
|
|
||||||
setPos ( e ) {
|
|
||||||
if ( this.hasSelectedPlaylist ) {
|
|
||||||
this.originalPos = e.offsetX;
|
|
||||||
this.calcProgressPos();
|
|
||||||
this.calcPlaybackPos();
|
|
||||||
if ( this.playingSong.origin === 'apple-music' ) {
|
|
||||||
this.musicKit.seekToTime( this.pos );
|
|
||||||
} else {
|
|
||||||
this.audioPlayer.currentTime = this.pos;
|
|
||||||
}
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
calcProgressPos() {
|
|
||||||
this.sliderProgress = Math.ceil( ( this.originalPos + parseInt( this.sliderPos ) ) / ( document.getElementById( 'progress-slider' ).clientWidth - 5 ) * 1000 );
|
|
||||||
},
|
|
||||||
calcPlaybackPos() {
|
|
||||||
this.pos = Math.round( ( this.originalPos + parseInt( this.sliderPos ) ) / ( document.getElementById( 'progress-slider' ).clientWidth - 5 ) * this.playingSong.duration );
|
|
||||||
},
|
|
||||||
sendUpdate( update ) {
|
|
||||||
let data = {};
|
|
||||||
let up = update;
|
|
||||||
if ( update === 'pos' ) {
|
|
||||||
data = this.pos;
|
|
||||||
} else if ( update === 'playingSong' ) {
|
|
||||||
data = this.playingSong;
|
|
||||||
} else if ( update === 'isPlaying' ) {
|
|
||||||
data = this.isPlaying;
|
|
||||||
} else if ( update === 'songQueue' ) {
|
|
||||||
data = this.songQueue;
|
|
||||||
} else if ( update === 'queuePos' ) {
|
|
||||||
data = this.queuePos;
|
|
||||||
} else if ( update === 'posReset' ) {
|
|
||||||
data = 0;
|
|
||||||
up = 'pos';
|
|
||||||
}
|
|
||||||
let fetchOptions = {
|
|
||||||
method: 'post',
|
|
||||||
body: JSON.stringify( { 'type': up, 'data': data } ),
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'charset': 'utf-8'
|
|
||||||
},
|
|
||||||
};
|
|
||||||
fetch( 'http://localhost:8081/statusUpdate', fetchOptions ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
loadPlaylist() {
|
|
||||||
const songQueue = this.musicKit.queue.items;
|
|
||||||
for ( let item in songQueue ) {
|
|
||||||
this.songQueue[ item ] = {
|
|
||||||
'artist': songQueue[ item ].attributes.artistName,
|
|
||||||
'title': songQueue[ item ].attributes.name,
|
|
||||||
'year': songQueue[ item ].attributes.releaseDate,
|
|
||||||
'genre': songQueue[ item ].attributes.genreNames,
|
|
||||||
'duration': Math.round( songQueue[ item ].attributes.durationInMillis / 1000 ),
|
|
||||||
'filename': songQueue[ item ].id,
|
|
||||||
'coverArtOrigin': 'api',
|
|
||||||
'hasCoverArt': true,
|
|
||||||
'queuePos': item,
|
|
||||||
'origin': 'apple-music',
|
|
||||||
}
|
|
||||||
let url = songQueue[ item ].attributes.artwork.url;
|
|
||||||
url = url.replace( '{w}', songQueue[ item ].attributes.artwork.width );
|
|
||||||
url = url.replace( '{h}', songQueue[ item ].attributes.artwork.height );
|
|
||||||
this.songQueue[ item ][ 'coverArtURL' ] = url;
|
|
||||||
this.handleAdditionalData();
|
|
||||||
this.sendUpdate( 'songQueue' );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
control( action ) {
|
|
||||||
if ( action === 'play' ) {
|
|
||||||
if ( !this.playingSong.origin ) {
|
|
||||||
this.play( this.songQueue[ 0 ] );
|
|
||||||
this.isPlaying = true;
|
|
||||||
} else {
|
|
||||||
if ( this.playingSong.origin === 'apple-music' ) {
|
|
||||||
if( !this.musicKit || !this.isPlaying ) {
|
|
||||||
this.musicKit.play().then( () => {
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
} ).catch( err => {
|
|
||||||
console.log( 'player failed to start' );
|
|
||||||
console.log( err );
|
|
||||||
} );
|
|
||||||
} else {
|
|
||||||
this.musicKit.pause().then( () => {
|
|
||||||
this.musicKit.play().catch( err => {
|
|
||||||
console.log( 'player failed to start' );
|
|
||||||
console.log( err );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
this.audioPlayer.pause();
|
|
||||||
} catch ( err ) {}
|
|
||||||
} else {
|
|
||||||
this.audioPlayer.play();
|
|
||||||
this.musicKit.pause();
|
|
||||||
}
|
|
||||||
this.isPlaying = true;
|
|
||||||
try {
|
|
||||||
clearInterval( this.progressTracker );
|
|
||||||
} catch( err ) {};
|
|
||||||
this.progressTracker = setInterval( () => {
|
|
||||||
if ( this.playingSong.origin === 'apple-music' ) {
|
|
||||||
this.pos = parseInt( this.musicKit.currentPlaybackTime );
|
|
||||||
} else {
|
|
||||||
this.pos = parseInt( this.audioPlayer.currentTime );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( this.pos > this.playingSong.duration - 1 ) {
|
|
||||||
this.control( 'next' );
|
|
||||||
}
|
|
||||||
|
|
||||||
const minuteCount = Math.floor( this.pos / 60 );
|
|
||||||
this.playbackPosBeautified = minuteCount + ':';
|
|
||||||
if ( ( '' + minuteCount ).length === 1 ) {
|
|
||||||
this.playbackPosBeautified = '0' + minuteCount + ':';
|
|
||||||
}
|
|
||||||
const secondCount = Math.floor( this.pos - minuteCount * 60 );
|
|
||||||
if ( ( '' + secondCount ).length === 1 ) {
|
|
||||||
this.playbackPosBeautified += '0' + secondCount;
|
|
||||||
} else {
|
|
||||||
this.playbackPosBeautified += secondCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( this.isShowingRemainingTime ) {
|
|
||||||
const minuteCounts = Math.floor( ( this.playingSong.duration - this.pos ) / 60 );
|
|
||||||
this.durationBeautified = '-' + String( minuteCounts ) + ':';
|
|
||||||
if ( ( '' + minuteCounts ).length === 1 ) {
|
|
||||||
this.durationBeautified = '-0' + minuteCounts + ':';
|
|
||||||
}
|
|
||||||
const secondCounts = Math.floor( ( this.playingSong.duration - this.pos ) - minuteCounts * 60 );
|
|
||||||
if ( ( '' + secondCounts ).length === 1 ) {
|
|
||||||
this.durationBeautified += '0' + secondCounts;
|
|
||||||
} else {
|
|
||||||
this.durationBeautified += secondCounts;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 50 );
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
this.sendUpdate( 'isPlaying' );
|
|
||||||
}
|
|
||||||
} else if ( action === 'pause' ) {
|
|
||||||
if ( this.playingSong.origin === 'apple-music' ) {
|
|
||||||
this.musicKit.pause();
|
|
||||||
} else {
|
|
||||||
this.audioPlayer.pause();
|
|
||||||
}
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
try {
|
|
||||||
clearInterval( this.progressTracker );
|
|
||||||
clearInterval( this.notifier );
|
|
||||||
} catch ( err ) {};
|
|
||||||
this.isPlaying = false;
|
|
||||||
this.sendUpdate( 'isPlaying' );
|
|
||||||
} else if ( action === 'replay10' ) {
|
|
||||||
if ( this.playingSong.origin === 'apple-music' ) {
|
|
||||||
this.musicKit.seekToTime( this.musicKit.currentPlaybackTime > 10 ? this.musicKit.currentPlaybackTime - 10 : 0 );
|
|
||||||
this.pos = this.musicKit.currentPlaybackTime;
|
|
||||||
} else {
|
|
||||||
this.audioPlayer.currentTime = this.audioPlayer.currentTime > 10 ? this.audioPlayer.currentTime - 10 : 0;
|
|
||||||
this.pos = this.audioPlayer.currentTime;
|
|
||||||
}
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
} else if ( action === 'forward10' ) {
|
|
||||||
if ( this.playingSong.origin === 'apple-music' ) {
|
|
||||||
if ( this.musicKit.currentPlaybackTime < ( this.playingSong.duration - 10 ) ) {
|
|
||||||
this.musicKit.seekToTime( this.musicKit.currentPlaybackTime + 10 );
|
|
||||||
this.pos = this.musicKit.currentPlaybackTime;
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
} else {
|
|
||||||
if ( this.repeatMode !== 'one' ) {
|
|
||||||
this.control( 'next' );
|
|
||||||
} else {
|
|
||||||
this.musicKit.seekToTime( 0 );
|
|
||||||
this.pos = this.musicKit.currentPlaybackTime;
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ( this.audioPlayer.currentTime < ( this.playingSong.duration - 10 ) ) {
|
|
||||||
this.audioPlayer.currentTime = this.audioPlayer.currentTime + 10;
|
|
||||||
this.pos = this.audioPlayer.currentTime;
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
} else {
|
|
||||||
if ( this.repeatMode !== 'one' ) {
|
|
||||||
this.control( 'next' );
|
|
||||||
} else {
|
|
||||||
this.audioPlayer.currentTime = 0;
|
|
||||||
this.pos = this.audioPlayer.currentTime;
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ( action === 'reset' ) {
|
|
||||||
clearInterval( this.progressTracker );
|
|
||||||
this.pos = 0;
|
|
||||||
if ( this.playingSong.origin === 'apple-music' ) {
|
|
||||||
this.musicKit.seekToTime( 0 );
|
|
||||||
} else {
|
|
||||||
this.audioPlayer.currentTime = 0;
|
|
||||||
}
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
} else if ( action === 'next' ) {
|
|
||||||
if ( this.queuePos < parseInt( Object.keys( this.songQueue ).length ) - 1 ) {
|
|
||||||
this.queuePos = parseInt( this.queuePos ) + 1;
|
|
||||||
this.play( this.songQueue[ this.queuePos ] );
|
|
||||||
} else {
|
|
||||||
if ( this.repeatMode === 'all' ) {
|
|
||||||
this.queuePos = 0;
|
|
||||||
this.play( this.songQueue[ 0 ] );
|
|
||||||
} else {
|
|
||||||
this.control( 'pause' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ( action === 'previous' ) {
|
|
||||||
if ( this.pos > 3 ) {
|
|
||||||
this.pos = 0;
|
|
||||||
if ( this.isUsingCustomPlaylist ) {
|
|
||||||
this.audioPlayer.currentTime = 0;
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
} else {
|
|
||||||
this.musicKit.seekToTime( 0 ).then( () => {
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
this.control( 'play' );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ( this.queuePos > 0 ) {
|
|
||||||
this.queuePos = parseInt( this.queuePos ) - 1;
|
|
||||||
this.play( this.songQueue[ this.queuePos ] );
|
|
||||||
} else {
|
|
||||||
this.queuePos = parseInt( Object.keys( this.songQueue ).length ) - 1;
|
|
||||||
this.play[ this.songQueue[ this.queuePos ] ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if ( action === 'shuffleOff' ) {
|
|
||||||
// TODO: Make shuffle function
|
|
||||||
this.isShuffleEnabled = false;
|
|
||||||
// this.loadPlaylist();
|
|
||||||
alert( 'not implemented yet' );
|
|
||||||
} else if ( action === 'shuffleOn' ) {
|
|
||||||
this.isShuffleEnabled = true;
|
|
||||||
alert( 'not implemented yet' );
|
|
||||||
// this.loadPlaylist();
|
|
||||||
} else if ( action === 'repeatOne' ) {
|
|
||||||
this.repeatMode = 'one';
|
|
||||||
} else if ( action === 'repeatAll' ) {
|
|
||||||
this.repeatMode = 'all';
|
|
||||||
} else if ( action === 'repeatOff' ) {
|
|
||||||
this.musicKit.repeatMode = MusicKit.PlayerRepeatMode.none;
|
|
||||||
this.repeatMode = 'off';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
play( song, specificID ) {
|
|
||||||
let foundSong = specificID ?? 0;
|
|
||||||
if ( !specificID ) {
|
|
||||||
for ( let s in this.songQueue ) {
|
|
||||||
if ( this.songQueue[ s ] === song ) {
|
|
||||||
foundSong = s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.queuePos = foundSong;
|
|
||||||
this.sendUpdate( 'queuePos' );
|
|
||||||
this.pos = 0;
|
|
||||||
this.sendUpdate( 'posReset' );
|
|
||||||
this.playingSong = song;
|
|
||||||
this.sendUpdate( 'playingSong' );
|
|
||||||
if ( song.origin === 'apple-music' ) {
|
|
||||||
this.musicKit.setQueue( { 'song': song.filename } ).then( () => {
|
|
||||||
setTimeout( () => {
|
|
||||||
this.control( 'play' );
|
|
||||||
}, 500 );
|
|
||||||
} ).catch( ( err ) => {
|
|
||||||
console.log( err );
|
|
||||||
} );
|
|
||||||
} else {
|
|
||||||
setTimeout( () => {
|
|
||||||
this.control( 'play' );
|
|
||||||
}, 500 );
|
|
||||||
}
|
|
||||||
const minuteCounts = Math.floor( ( this.playingSong.duration ) / 60 );
|
|
||||||
this.durationBeautified = String( minuteCounts ) + ':';
|
|
||||||
if ( ( '' + minuteCounts ).length === 1 ) {
|
|
||||||
this.durationBeautified = '0' + minuteCounts + ':';
|
|
||||||
}
|
|
||||||
const secondCounts = Math.floor( ( this.playingSong.duration ) - minuteCounts * 60 );
|
|
||||||
if ( ( '' + secondCounts ).length === 1 ) {
|
|
||||||
this.durationBeautified += '0' + secondCounts;
|
|
||||||
} else {
|
|
||||||
this.durationBeautified += secondCounts;
|
|
||||||
}
|
|
||||||
this.hasFinishedInit = true;
|
|
||||||
},
|
|
||||||
toggleShowMode() {
|
|
||||||
this.isShowingRemainingTime = !this.isShowingRemainingTime;
|
|
||||||
},
|
|
||||||
exportCurrentPlaylist() {
|
|
||||||
let fetchOptions = {
|
|
||||||
method: 'post',
|
|
||||||
body: JSON.stringify( this.songQueue ),
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'charset': 'utf-8'
|
|
||||||
},
|
|
||||||
};
|
|
||||||
fetch( '/savePlaylist', fetchOptions ).then( res => {
|
|
||||||
if ( res.status === 200 ) {
|
|
||||||
console.log( 'saved' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
selectPlaylistFromDisk() {
|
|
||||||
this.isPreparingToPlay = true;
|
|
||||||
let playlistSongs = [];
|
|
||||||
fetch( '/loadPlaylist' ).then( res => {
|
|
||||||
res.json().then( data => {
|
|
||||||
this.rawLoadedPlaylistData = data.data;
|
|
||||||
this.basePath = data.path.slice( 0, data.path.lastIndexOf( '/' ) );
|
|
||||||
for ( let song in this.rawLoadedPlaylistData ) {
|
|
||||||
if ( this.rawLoadedPlaylistData[ song ].origin === 'apple-music' ) {
|
|
||||||
playlistSongs.push( this.rawLoadedPlaylistData[ song ].filename );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.musicKit.setQueue( { songs: playlistSongs } ).then( () => {
|
|
||||||
this.isUsingCustomPlaylist = true;
|
|
||||||
try {
|
|
||||||
this.loadCustomPlaylist();
|
|
||||||
this.hasSelectedPlaylist = true;
|
|
||||||
this.isPreparingToPlay = false;
|
|
||||||
} catch( err ) {
|
|
||||||
this.hasSelectedPlaylist = false;
|
|
||||||
console.error( err );
|
|
||||||
alert( 'We were unable to play. Please ensure that DRM (yeah sorry it is Apple Music, we cannot do anything about that) is enabled and working' );
|
|
||||||
}
|
|
||||||
} ).catch( err => {
|
|
||||||
console.error( 'ERROR whilst settings Queue', err );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
loadCustomPlaylist() {
|
|
||||||
const songQueue = this.musicKit.queue.items;
|
|
||||||
let offset = 0;
|
|
||||||
( async() => {
|
|
||||||
for ( let item in this.rawLoadedPlaylistData ) {
|
|
||||||
if ( this.rawLoadedPlaylistData[ item ].origin === 'apple-music' ) {
|
|
||||||
this.songQueue[ item ] = {
|
|
||||||
'artist': songQueue[ item - offset ].attributes.artistName,
|
|
||||||
'title': songQueue[ item - offset ].attributes.name,
|
|
||||||
'year': songQueue[ item - offset ].attributes.releaseDate,
|
|
||||||
'genre': songQueue[ item - offset ].attributes.genreNames,
|
|
||||||
'duration': Math.round( songQueue[ item - offset ].attributes.durationInMillis / 1000 ),
|
|
||||||
'filename': songQueue[ item - offset ].id,
|
|
||||||
'coverArtOrigin': 'api',
|
|
||||||
'hasCoverArt': true,
|
|
||||||
'queuePos': item,
|
|
||||||
'origin': 'apple-music',
|
|
||||||
'offset': offset,
|
|
||||||
}
|
|
||||||
let url = songQueue[ item - offset ].attributes.artwork.url;
|
|
||||||
url = url.replace( '{w}', songQueue[ item - offset ].attributes.artwork.width );
|
|
||||||
url = url.replace( '{h}', songQueue[ item - offset ].attributes.artwork.height );
|
|
||||||
this.songQueue[ item ][ 'coverArtURL' ] = url;
|
|
||||||
} else {
|
|
||||||
offset += 1;
|
|
||||||
const queryParameters = {
|
|
||||||
term: ( this.rawLoadedPlaylistData[ item ].artist ?? '' ) + ' ' + ( this.rawLoadedPlaylistData[ item ].title ?? '' ),
|
|
||||||
types: [ 'songs' ],
|
|
||||||
};
|
|
||||||
// TODO: Make storefront adjustable
|
|
||||||
const result = await this.musicKit.api.music( '/v1/catalog/ch/search', queryParameters );
|
|
||||||
let json;
|
|
||||||
try {
|
|
||||||
const res = await fetch( '/getMetadata?file=' + this.basePath + '/' + this.rawLoadedPlaylistData[ item ].filename );
|
|
||||||
json = await res.json();
|
|
||||||
} catch( err ) {}
|
|
||||||
if ( result.data ) {
|
|
||||||
if ( result.data.results.songs ) {
|
|
||||||
const dat = result.data.results.songs.data[ 0 ];
|
|
||||||
console.log( json );
|
|
||||||
this.songQueue[ item ] = {
|
|
||||||
'artist': dat.attributes.artistName,
|
|
||||||
'title': dat.attributes.name,
|
|
||||||
'year': dat.attributes.releaseDate,
|
|
||||||
'genre': dat.attributes.genreNames,
|
|
||||||
'duration': json ? Math.round( json.duration ) : undefined,
|
|
||||||
'filename': this.rawLoadedPlaylistData[ item ].filename,
|
|
||||||
'coverArtOrigin': 'api',
|
|
||||||
'hasCoverArt': true,
|
|
||||||
'queuePos': item,
|
|
||||||
'origin': 'local',
|
|
||||||
}
|
|
||||||
let url = dat.attributes.artwork.url;
|
|
||||||
url = url.replace( '{w}', dat.attributes.artwork.width );
|
|
||||||
url = url.replace( '{h}', dat.attributes.artwork.height );
|
|
||||||
this.songQueue[ item ][ 'coverArtURL' ] = url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.handleAdditionalData();
|
|
||||||
this.sendUpdate( 'songQueue' );
|
|
||||||
}
|
|
||||||
} )();
|
|
||||||
setTimeout( () => {
|
|
||||||
this.audioPlayer = document.getElementById( 'audio-player' );
|
|
||||||
}, 1000 );
|
|
||||||
},
|
|
||||||
search() {
|
|
||||||
( async() => {
|
|
||||||
const searchTerm = prompt( 'Enter search term...' )
|
|
||||||
const queryParameters = {
|
|
||||||
term: ( searchTerm ),
|
|
||||||
types: [ 'songs' ],
|
|
||||||
};
|
|
||||||
// TODO: Make storefront adjustable
|
|
||||||
const result = await this.musicKit.api.music( '/v1/catalog/ch/search', queryParameters );
|
|
||||||
console.log( result );
|
|
||||||
} )();
|
|
||||||
},
|
|
||||||
connectToNotifier() {
|
|
||||||
let source = new EventSource( '/mainNotifier', { withCredentials: true } );
|
|
||||||
source.onmessage = ( e ) => {
|
|
||||||
let data;
|
|
||||||
try {
|
|
||||||
data = JSON.parse( e.data );
|
|
||||||
} catch ( err ) {
|
|
||||||
data = { 'type': e.data };
|
|
||||||
}
|
|
||||||
if ( data.type === 'blur' ) {
|
|
||||||
this.isShowingWarning = true;
|
|
||||||
} else if ( data.type === 'visibility' ) {
|
|
||||||
this.isShowingWarning = true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
source.onopen = () => {
|
|
||||||
this.isReconnecting = false;
|
|
||||||
console.log( 'client notifier connected successfully' );
|
|
||||||
};
|
|
||||||
|
|
||||||
let self = this;
|
|
||||||
|
|
||||||
source.addEventListener( 'error', function( e ) {
|
|
||||||
if ( e.eventPhase == EventSource.CLOSED ) source.close();
|
|
||||||
|
|
||||||
if ( e.target.readyState == EventSource.CLOSED ) {
|
|
||||||
setTimeout( () => {
|
|
||||||
if ( !self.isReconnecting ) {
|
|
||||||
console.log( 'disconnected' );
|
|
||||||
console.log( 'reconnecting...' );
|
|
||||||
self.isReconnecting = true;
|
|
||||||
self.tryReconnect();
|
|
||||||
}
|
|
||||||
}, 1000 );
|
|
||||||
}
|
|
||||||
|
|
||||||
}, false );
|
|
||||||
},
|
|
||||||
tryReconnect() {
|
|
||||||
const int = setInterval( () => {
|
|
||||||
if ( !this.isReconnecting ) {
|
|
||||||
clearInterval( int );
|
|
||||||
} else {
|
|
||||||
this.connectToNotifier();
|
|
||||||
}
|
|
||||||
}, 1000 );
|
|
||||||
},
|
|
||||||
dismissNotification() {
|
|
||||||
this.isShowingWarning = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
pos() {
|
|
||||||
if ( !this.isDragging ) {
|
|
||||||
this.sliderProgress = Math.ceil( this.pos / this.playingSong.duration * 1000 + 2 );
|
|
||||||
this.originalPos = Math.ceil( this.pos / this.playingSong.duration * ( document.getElementById( 'progress-slider' ).scrollWidth - 5 ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
document.addEventListener( 'keydown', ( e ) => {
|
|
||||||
if ( e.key === ' ' ) {
|
|
||||||
e.preventDefault();
|
|
||||||
if ( !this.isPlaying ) {
|
|
||||||
this.control( 'play' );
|
|
||||||
} else {
|
|
||||||
this.control( 'pause' );
|
|
||||||
}
|
|
||||||
} else if ( e.key === 'ArrowRight' ) {
|
|
||||||
e.preventDefault();
|
|
||||||
this.control( 'next' );
|
|
||||||
} else if ( e.key === 'ArrowLeft' ) {
|
|
||||||
e.preventDefault();
|
|
||||||
this.control( 'previous' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
if ( !window.MusicKit ) {
|
|
||||||
document.addEventListener( 'musickitloaded', () => {
|
|
||||||
self.initMusicKit();
|
|
||||||
} );
|
|
||||||
} else {
|
|
||||||
this.initMusicKit();
|
|
||||||
}
|
|
||||||
this.connectToNotifier();
|
|
||||||
fetch( '/getLocalIP' ).then( res => {
|
|
||||||
if ( res.status === 200 ) {
|
|
||||||
res.text().then( ip => {
|
|
||||||
this.localIP = ip;
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
} ).mount( '#app' );
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,136 +0,0 @@
|
|||||||
.song-info {
|
|
||||||
background-color: #8e9ced;
|
|
||||||
height: 13vh;
|
|
||||||
width: 50%;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.image {
|
|
||||||
width: 7vh;
|
|
||||||
height: 7vh;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
font-size: 7vh;
|
|
||||||
margin-left: 1vh;
|
|
||||||
margin-top: 1vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.name {
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-info-wrapper {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-info-wrapper h3 {
|
|
||||||
margin: 0;
|
|
||||||
margin-bottom: 0.5vh;
|
|
||||||
margin-top: 1vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.controls {
|
|
||||||
margin-left: 5%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.control-icon {
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 3vh;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.play-pause {
|
|
||||||
font-size: 5vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inactive {
|
|
||||||
color: gray;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.player {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playback-pos-info {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
width: 98%;
|
|
||||||
margin-left: 1%;
|
|
||||||
position: absolute;
|
|
||||||
bottom: 17px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#showIP {
|
|
||||||
background-color: rgb(63, 63, 63);
|
|
||||||
display: none;
|
|
||||||
position: absolute;
|
|
||||||
min-height: 16vh;
|
|
||||||
padding: 2vh;
|
|
||||||
min-width: 20vw;
|
|
||||||
z-index: 10;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
font-size: 70%;
|
|
||||||
border-radius: 5px 10px 10px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#showIP h4, #showIP p {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#settings:hover #showIP {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
#showIP::before {
|
|
||||||
content: " ";
|
|
||||||
position: absolute;
|
|
||||||
bottom: 100%; /* At the bottom of the tooltip */
|
|
||||||
left: 0;
|
|
||||||
margin-left: 3px;
|
|
||||||
border-width: 10px;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: transparent transparent rgb(63, 63, 63) transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Prepare to play */
|
|
||||||
|
|
||||||
.preparingToPlay {
|
|
||||||
background-color: rgba(0, 0, 0, 0.7);
|
|
||||||
width: 100vw;
|
|
||||||
height: 100vh;
|
|
||||||
position: fixed;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-spinner {
|
|
||||||
animation: spin 2s infinite linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
from {
|
|
||||||
transform: rotate( 0deg );
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: rotate( 720deg );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,359 +0,0 @@
|
|||||||
/*
|
|
||||||
* MusicPlayerV2 - style.css
|
|
||||||
*
|
|
||||||
* Created by Janis Hutz 11/14/2023, Licensed under the GPL V3 License
|
|
||||||
* https://janishutz.com, development@janishutz.com
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
body, html {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: rgb(49, 49, 49);
|
|
||||||
font-family: sans-serif;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start page style */
|
|
||||||
.start-page {
|
|
||||||
width: 100%;
|
|
||||||
height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.image-wrapper {
|
|
||||||
height: 50vh;
|
|
||||||
width: 50vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
#logo-main {
|
|
||||||
height: 50vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
#apple-music-logo {
|
|
||||||
height: 10vh;
|
|
||||||
position: relative;
|
|
||||||
bottom: 10vh;
|
|
||||||
left: 41vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button {
|
|
||||||
padding: 20px;
|
|
||||||
background-color: rgb(1, 1, 88);
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 50px;
|
|
||||||
transition: all 1s;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 120%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:hover {
|
|
||||||
background-color: rgb(1, 1, 120);
|
|
||||||
border-radius: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Main style */
|
|
||||||
|
|
||||||
.home {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pool-wrapper {
|
|
||||||
height: 84vh;
|
|
||||||
margin-top: 16vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-bar {
|
|
||||||
top: 0;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
position: fixed;
|
|
||||||
z-index: 8;
|
|
||||||
width: 99%;
|
|
||||||
height: 15vh;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: row;
|
|
||||||
border: white 2px solid;
|
|
||||||
background-color: rgb(49, 49, 49);
|
|
||||||
}
|
|
||||||
|
|
||||||
.player-wrapper {
|
|
||||||
width: 70vw;
|
|
||||||
margin-right: auto;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
height: 13vh;
|
|
||||||
margin-left: 3%;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Media Pool */
|
|
||||||
|
|
||||||
.playing-symbols {
|
|
||||||
position: absolute;
|
|
||||||
left: 10%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: row;
|
|
||||||
margin: 0;
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
background-color: rgba( 0, 0, 0, 0.6 );
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing-symbols-wrapper {
|
|
||||||
width: 4vw;
|
|
||||||
height: 5vw;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing-bar {
|
|
||||||
height: 60%;
|
|
||||||
background-color: white;
|
|
||||||
width: 10%;
|
|
||||||
border-radius: 50px;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bar-1 {
|
|
||||||
animation: music-playing 0.9s infinite ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bar-2 {
|
|
||||||
animation: music-playing 0.9s infinite ease-in-out;
|
|
||||||
animation-delay: 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bar-3 {
|
|
||||||
animation: music-playing 0.9s infinite ease-in-out;
|
|
||||||
animation-delay: 0.6s;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes music-playing {
|
|
||||||
0% {
|
|
||||||
transform: scaleY( 1 );
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
transform: scaleY( 0.5 );
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: scaleY( 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-spinner {
|
|
||||||
animation: spin 2s infinite linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
from {
|
|
||||||
transform: rotate( 0deg );
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: rotate( 720deg );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.media-pool {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-songs {
|
|
||||||
height: 50vh;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list-wrapper {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
width: 80%;
|
|
||||||
margin: 2px;
|
|
||||||
padding: 1vh;
|
|
||||||
border: 1px white solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list h3 {
|
|
||||||
margin: 0;
|
|
||||||
display: block;
|
|
||||||
margin-left: 10px;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list .song-image {
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
font-size: 5vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.play-icon, .pause-icon {
|
|
||||||
display: none;
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
font-size: 5vw;
|
|
||||||
cursor: pointer;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing:hover .pause-icon {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing:hover .playing-symbols {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list:hover .song-image {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.not-playing:hover .play-icon {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.active-song .pause-icon {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.active-song .song-image, .active-song:hover .pause-icon {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Slider */
|
|
||||||
|
|
||||||
.progress-slider {
|
|
||||||
width: 100%;
|
|
||||||
margin: 0;
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
height: 5px;
|
|
||||||
cursor: pointer;
|
|
||||||
background-color: #baf4c9;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress-slider::-webkit-progress-value {
|
|
||||||
background-color: #baf4c9;
|
|
||||||
}
|
|
||||||
|
|
||||||
#slider-knob {
|
|
||||||
height: 20px;
|
|
||||||
width: 10px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: flex-end;
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 2;
|
|
||||||
cursor: grab;
|
|
||||||
}
|
|
||||||
|
|
||||||
#slider-knob-style {
|
|
||||||
background-color: #baf4c9;
|
|
||||||
height: 15px;
|
|
||||||
width: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#drag-support {
|
|
||||||
display: none;
|
|
||||||
opacity: 0;
|
|
||||||
height: 100vh;
|
|
||||||
width: 100vw;
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 10;
|
|
||||||
cursor: grabbing;
|
|
||||||
}
|
|
||||||
|
|
||||||
.drag-support-active {
|
|
||||||
display: block !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.slider-inactive {
|
|
||||||
cursor: default !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.warning {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
width: 40vw;
|
|
||||||
height: 50vh;
|
|
||||||
font-size: 2vh;
|
|
||||||
background-color: rgb(255, 0, 0);
|
|
||||||
color: white;
|
|
||||||
position: fixed;
|
|
||||||
right: 1vh;
|
|
||||||
top: 1vh;
|
|
||||||
flex-direction: column;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
.warning h3 {
|
|
||||||
font-size: 4vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.warning .flash {
|
|
||||||
background-color: rgba(255, 0, 0, 0.4);
|
|
||||||
animation: flashing linear infinite 1s;
|
|
||||||
width: 100vw;
|
|
||||||
height: 100vh;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
position: fixed;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes flashing {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
.background {
|
|
||||||
position: fixed;
|
|
||||||
left: -50vw;
|
|
||||||
width: 200vw;
|
|
||||||
height: 200vw;
|
|
||||||
top: -50vw;
|
|
||||||
z-index: -1;
|
|
||||||
filter: blur(10px);
|
|
||||||
background: conic-gradient( blue, green, red, blue );
|
|
||||||
animation: gradientAnim 10s infinite linear;
|
|
||||||
background-position: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.beat, .beat-manual {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
background-color: rgba( 0, 0, 0, 0.15 );
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.beat {
|
|
||||||
animation: beatAnim 0.6s infinite linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes beatAnim {
|
|
||||||
0% {
|
|
||||||
background-color: rgba( 0, 0, 0, 0.2 );
|
|
||||||
}
|
|
||||||
20% {
|
|
||||||
background-color: rgba( 0, 0, 0, 0 );
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
background-color: rgba( 0, 0, 0, 0.2 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes gradientAnim {
|
|
||||||
from {
|
|
||||||
transform: rotate( 0deg );
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: rotate( 360deg );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/* fallback */
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Material Symbols Outlined';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 100 700;
|
|
||||||
src: url(/iconFont.woff2) format('woff2');
|
|
||||||
}
|
|
||||||
|
|
||||||
.material-symbols-outlined {
|
|
||||||
font-family: 'Material Symbols Outlined';
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
font-size: 24px;
|
|
||||||
line-height: 1;
|
|
||||||
letter-spacing: normal;
|
|
||||||
text-transform: none;
|
|
||||||
display: inline-block;
|
|
||||||
white-space: nowrap;
|
|
||||||
word-wrap: normal;
|
|
||||||
direction: ltr;
|
|
||||||
-moz-font-feature-settings: 'liga';
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 582 KiB |
@@ -1,208 +0,0 @@
|
|||||||
.material-symbols-outlined {
|
|
||||||
font-variation-settings:
|
|
||||||
'FILL' 0,
|
|
||||||
'wght' 400,
|
|
||||||
'GRAD' 0,
|
|
||||||
'opsz' 24
|
|
||||||
}
|
|
||||||
|
|
||||||
body, html {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing-symbols {
|
|
||||||
position: absolute;
|
|
||||||
left: 10vw;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: row;
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
background-color: rgba( 0, 0, 0, 0.6 );
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing-symbols-wrapper {
|
|
||||||
width: 4vw;
|
|
||||||
height: 5vw;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing-bar {
|
|
||||||
height: 60%;
|
|
||||||
background-color: white;
|
|
||||||
width: 10%;
|
|
||||||
border-radius: 50px;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bar-1 {
|
|
||||||
animation: music-playing 0.9s infinite ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bar-2 {
|
|
||||||
animation: music-playing 0.9s infinite ease-in-out;
|
|
||||||
animation-delay: 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bar-3 {
|
|
||||||
animation: music-playing 0.9s infinite ease-in-out;
|
|
||||||
animation-delay: 0.6s;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes music-playing {
|
|
||||||
0% {
|
|
||||||
transform: scaleY( 1 );
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
transform: scaleY( 0.5 );
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: scaleY( 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list-wrapper {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
width: 80%;
|
|
||||||
margin: 2px;
|
|
||||||
padding: 1vh;
|
|
||||||
border: 1px white solid;
|
|
||||||
background-color: rgba( 0, 0, 0, 0.4 );
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-details-wrapper {
|
|
||||||
margin: 0;
|
|
||||||
display: block;
|
|
||||||
margin-left: 10px;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list .song-image {
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
font-size: 5vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pause-icon {
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
font-size: 5vw !important;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.current-song-wrapper {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 55vh;
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: 0.5%;
|
|
||||||
margin-top: 0.25%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.current-song {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
margin-top: 1vh;
|
|
||||||
padding: 1vh;
|
|
||||||
text-align: center;
|
|
||||||
background-color: rgba( 0, 0, 0, 0.4 );
|
|
||||||
}
|
|
||||||
|
|
||||||
.fancy-view-song-art {
|
|
||||||
height: 30vh;
|
|
||||||
width: 30vh;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
font-size: 30vh !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#app {
|
|
||||||
background-color: rgba( 0, 0, 0, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
#progress, #progress::-webkit-progress-bar {
|
|
||||||
background-color: rgba(45, 28, 145);
|
|
||||||
color: rgba(45, 28, 145);
|
|
||||||
width: 30vw;
|
|
||||||
border: none;
|
|
||||||
border-radius: 0px;
|
|
||||||
accent-color: white;
|
|
||||||
-webkit-appearance: none;
|
|
||||||
appearance: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#progress::-moz-progress-bar {
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
#progress::-webkit-progress-value {
|
|
||||||
background-color: white !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode-selector-wrapper {
|
|
||||||
opacity: 0;
|
|
||||||
position: fixed;
|
|
||||||
right: 0.5%;
|
|
||||||
top: 0.5%;
|
|
||||||
padding: 0.5%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode-selector-wrapper:hover {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dancing-style {
|
|
||||||
font-size: 250%;
|
|
||||||
margin: 0;
|
|
||||||
font-weight: bolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info {
|
|
||||||
position: fixed;
|
|
||||||
font-size: 12px;
|
|
||||||
transform: rotate(270deg);
|
|
||||||
left: -150px;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
top: 50%;
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=7">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
||||||
<title>Showcase - MusicPlayerV2</title>
|
|
||||||
<link rel="stylesheet" href="/showcase.css">
|
|
||||||
<link rel="stylesheet" href="/backgroundAnim.css">
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="info">Designed and developed by Janis Hutz <a href="https://janishutz.com" target="_blank" style="text-decoration: none; color: white;">https://janishutz.com</a></div>
|
|
||||||
<div class="content" id="app">
|
|
||||||
<div v-if="hasLoaded" style="width: 100%">
|
|
||||||
<div class="current-song-wrapper">
|
|
||||||
<span class="material-symbols-outlined fancy-view-song-art" v-if="!playingSong.hasCoverArt">music_note</span>
|
|
||||||
<img v-else-if="playingSong.hasCoverArt && playingSong.coverArtOrigin === 'api'" :src="playingSong.coverArtURL" class="fancy-view-song-art" id="current-image" crossorigin="anonymous">
|
|
||||||
<img v-else :src="'/getSongCover?filename=' + playingSong.filename" class="fancy-view-song-art" id="current-image">
|
|
||||||
<div class="current-song">
|
|
||||||
<progress max="1000" id="progress" :value="progressBar"></progress>
|
|
||||||
<h1>{{ playingSong.title }}</h1>
|
|
||||||
<p class="dancing-style" v-if="playingSong.dancingStyle">{{ playingSong.dancingStyle }}</p>
|
|
||||||
<p>{{ playingSong.artist }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="mode-selector-wrapper">
|
|
||||||
<select v-model="visualizationSettings" @change="setVisualization()">
|
|
||||||
<option value="mic">Microphone (Mic access required)</option>
|
|
||||||
<option value="bpm">BPM (might not be 100% accurate)</option>
|
|
||||||
<option value="off">No visualization except background</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="song-list-wrapper">
|
|
||||||
<div v-for="song in songQueue" class="song-list">
|
|
||||||
<span class="material-symbols-outlined song-image" v-if="!song.hasCoverArt && ( playingSong.filename !== song.filename || isPlaying )">music_note</span>
|
|
||||||
<img v-else-if="song.hasCoverArt && ( playingSong.filename !== song.filename || isPlaying ) && song.coverArtOrigin === 'api'" :src="song.coverArtURL" class="song-image">
|
|
||||||
<img v-else-if="song.hasCoverArt && ( playingSong.filename !== song.filename || isPlaying ) && song.coverArtOrigin !== 'api'" :src="'/getSongCover?filename=' + song.filename" class="song-image">
|
|
||||||
<div v-if="playingSong.filename === song.filename && isPlaying" class="playing-symbols">
|
|
||||||
<div class="playing-symbols-wrapper">
|
|
||||||
<div class="playing-bar" id="bar-1"></div>
|
|
||||||
<div class="playing-bar" id="bar-2"></div>
|
|
||||||
<div class="playing-bar" id="bar-3"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span class="material-symbols-outlined pause-icon" v-if="!isPlaying && playingSong.filename === song.filename">pause</span>
|
|
||||||
<div class="song-details-wrapper">
|
|
||||||
<h3>{{ song.title }}</h3>
|
|
||||||
<p>{{ song.artist }}</p>
|
|
||||||
</div>
|
|
||||||
<div class="time-until">
|
|
||||||
{{ getTimeUntil( song ) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <img :src="" alt=""> -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<h1>Loading...</h1>
|
|
||||||
</div>
|
|
||||||
<div class="background" id="background">
|
|
||||||
<div class="beat"></div>
|
|
||||||
<div class="beat-manual"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
|
||||||
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/color-thief/2.3.0/color-thief.umd.js"></script>
|
|
||||||
<script src="/showcase.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,359 +0,0 @@
|
|||||||
// eslint-disable-next-line no-undef
|
|
||||||
const { createApp } = Vue;
|
|
||||||
|
|
||||||
createApp( {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hasLoaded: false,
|
|
||||||
songs: [],
|
|
||||||
playingSong: {},
|
|
||||||
isPlaying: false,
|
|
||||||
pos: 0,
|
|
||||||
queuePos: 0,
|
|
||||||
colourPalette: [],
|
|
||||||
progressBar: 0,
|
|
||||||
timeTracker: null,
|
|
||||||
visualizationSettings: 'mic',
|
|
||||||
micAnalyzer: null,
|
|
||||||
beatDetected: false,
|
|
||||||
colorThief: null,
|
|
||||||
lastDispatch: new Date().getTime() - 5000,
|
|
||||||
isReconnecting: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
songQueue() {
|
|
||||||
let ret = [];
|
|
||||||
let pos = 0;
|
|
||||||
for ( let song in this.songs ) {
|
|
||||||
if ( pos >= this.queuePos ) {
|
|
||||||
ret.push( this.songs[ song ] );
|
|
||||||
}
|
|
||||||
pos += 1;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
},
|
|
||||||
getTimeUntil() {
|
|
||||||
return ( song ) => {
|
|
||||||
let timeRemaining = 0;
|
|
||||||
for ( let i = this.queuePos; i < Object.keys( this.songs ).length - 1; i++ ) {
|
|
||||||
if ( this.songs[ i ] == song ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
timeRemaining += parseInt( this.songs[ i ].duration );
|
|
||||||
}
|
|
||||||
if ( this.isPlaying ) {
|
|
||||||
if ( timeRemaining === 0 ) {
|
|
||||||
return 'Currently playing';
|
|
||||||
} else {
|
|
||||||
return 'Playing in less than ' + Math.ceil( timeRemaining / 60 - this.pos / 60 ) + 'min';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ( timeRemaining === 0 ) {
|
|
||||||
return 'Plays next';
|
|
||||||
} else {
|
|
||||||
return 'Playing less than ' + Math.ceil( timeRemaining / 60 - this.pos / 60 ) + 'min after starting to play';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
startTimeTracker () {
|
|
||||||
this.timeTracker = setInterval( () => {
|
|
||||||
this.pos = ( new Date().getTime() - this.playingSong.startTime ) / 1000 + this.oldPos;
|
|
||||||
this.progressBar = ( this.pos / this.playingSong.duration ) * 1000;
|
|
||||||
if ( isNaN( this.progressBar ) ) {
|
|
||||||
this.progressBar = 0;
|
|
||||||
}
|
|
||||||
}, 100 );
|
|
||||||
},
|
|
||||||
stopTimeTracker () {
|
|
||||||
clearInterval( this.timeTracker );
|
|
||||||
this.oldPos = this.pos;
|
|
||||||
},
|
|
||||||
getImageData() {
|
|
||||||
return new Promise( ( resolve, reject ) => {
|
|
||||||
if ( this.playingSong.hasCoverArt ) {
|
|
||||||
setTimeout( () => {
|
|
||||||
const img = document.getElementById( 'current-image' );
|
|
||||||
if ( img.complete ) {
|
|
||||||
resolve( this.colorThief.getPalette( img ) );
|
|
||||||
} else {
|
|
||||||
img.addEventListener( 'load', () => {
|
|
||||||
resolve( this.colorThief.getPalette( img ) );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
}, 500 );
|
|
||||||
} else {
|
|
||||||
reject( 'no image' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
connect() {
|
|
||||||
this.colorThief = new ColorThief();
|
|
||||||
let source = new EventSource( '/clientDisplayNotifier', { withCredentials: true } );
|
|
||||||
source.onmessage = ( e ) => {
|
|
||||||
let data;
|
|
||||||
try {
|
|
||||||
data = JSON.parse( e.data );
|
|
||||||
} catch ( err ) {
|
|
||||||
data = { 'type': e.data };
|
|
||||||
}
|
|
||||||
if ( data.type === 'basics' ) {
|
|
||||||
this.isPlaying = data.data.isPlaying ?? false;
|
|
||||||
this.playingSong = data.data.playingSong ?? {};
|
|
||||||
this.songs = data.data.songQueue ?? [];
|
|
||||||
this.pos = data.data.pos ?? 0;
|
|
||||||
this.oldPos = data.data.pos ?? 0;
|
|
||||||
this.progressBar = this.pos / this.playingSong.duration * 1000;
|
|
||||||
this.queuePos = data.data.queuePos ?? 0;
|
|
||||||
this.getImageData().then( palette => {
|
|
||||||
this.colourPalette = palette;
|
|
||||||
this.handleBackground();
|
|
||||||
} ).catch( () => {
|
|
||||||
this.colourPalette = [ { 'r': 255, 'g': 0, 'b': 0 }, { 'r': 0, 'g': 255, 'b': 0 }, { 'r': 0, 'g': 0, 'b': 255 } ];
|
|
||||||
this.handleBackground();
|
|
||||||
} );
|
|
||||||
} else if ( data.type === 'pos' ) {
|
|
||||||
this.pos = data.data;
|
|
||||||
this.oldPos = data.data;
|
|
||||||
this.progressBar = data.data / this.playingSong.duration * 1000;
|
|
||||||
} else if ( data.type === 'isPlaying' ) {
|
|
||||||
this.isPlaying = data.data;
|
|
||||||
this.handleBackground();
|
|
||||||
} else if ( data.type === 'songQueue' ) {
|
|
||||||
this.songs = data.data;
|
|
||||||
} else if ( data.type === 'playingSong' ) {
|
|
||||||
this.playingSong = data.data;
|
|
||||||
this.getImageData().then( palette => {
|
|
||||||
this.colourPalette = palette;
|
|
||||||
this.handleBackground();
|
|
||||||
} ).catch( () => {
|
|
||||||
this.colourPalette = [ [ 255, 0, 0 ], [ 0, 255, 0 ], [ 0, 0, 255 ] ];
|
|
||||||
this.handleBackground();
|
|
||||||
} );
|
|
||||||
} else if ( data.type === 'queuePos' ) {
|
|
||||||
this.queuePos = data.data;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
source.onopen = () => {
|
|
||||||
this.isReconnecting = false;
|
|
||||||
this.hasLoaded = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
let self = this;
|
|
||||||
|
|
||||||
source.addEventListener( 'error', function( e ) {
|
|
||||||
if ( e.eventPhase == EventSource.CLOSED ) source.close();
|
|
||||||
|
|
||||||
if ( e.target.readyState == EventSource.CLOSED ) {
|
|
||||||
setTimeout( () => {
|
|
||||||
if ( !self.isReconnecting ) {
|
|
||||||
console.log( 'disconnected' );
|
|
||||||
self.isReconnecting = true;
|
|
||||||
self.tryReconnect();
|
|
||||||
}
|
|
||||||
}, 1000 );
|
|
||||||
}
|
|
||||||
}, false );
|
|
||||||
},
|
|
||||||
tryReconnect() {
|
|
||||||
const int = setInterval( () => {
|
|
||||||
if ( !this.isReconnecting ) {
|
|
||||||
clearInterval( int );
|
|
||||||
} else {
|
|
||||||
this.connect();
|
|
||||||
}
|
|
||||||
}, 1000 );
|
|
||||||
},
|
|
||||||
handleBackground() {
|
|
||||||
let colourDetails = [];
|
|
||||||
let colours = [];
|
|
||||||
let differentEnough = true;
|
|
||||||
if ( this.colourPalette[ 0 ] ) {
|
|
||||||
for ( let i in this.colourPalette ) {
|
|
||||||
for ( let colour in colourDetails ) {
|
|
||||||
const colourDiff = ( Math.abs( colourDetails[ colour ][ 0 ] - this.colourPalette[ i ][ 0 ] ) / 255
|
|
||||||
+ Math.abs( colourDetails[ colour ][ 1 ] - this.colourPalette[ i ][ 1 ] ) / 255
|
|
||||||
+ Math.abs( colourDetails[ colour ][ 2 ] - this.colourPalette[ i ][ 2 ] ) / 255 ) / 3 * 100;
|
|
||||||
if ( colourDiff > 15 ) {
|
|
||||||
differentEnough = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( differentEnough ) {
|
|
||||||
colourDetails.push( this.colourPalette[ i ] );
|
|
||||||
colours.push( 'rgb(' + this.colourPalette[ i ][ 0 ] + ',' + this.colourPalette[ i ][ 1 ] + ',' + this.colourPalette[ i ][ 2 ] + ')' );
|
|
||||||
}
|
|
||||||
differentEnough = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let outColours = 'conic-gradient(';
|
|
||||||
if ( colours.length < 3 ) {
|
|
||||||
for ( let i = 0; i < 3; i++ ) {
|
|
||||||
if ( colours[ i ] ) {
|
|
||||||
outColours += colours[ i ] + ',';
|
|
||||||
} else {
|
|
||||||
if ( i === 0 ) {
|
|
||||||
outColours += 'blue,';
|
|
||||||
} else if ( i === 1 ) {
|
|
||||||
outColours += 'green,';
|
|
||||||
} else if ( i === 2 ) {
|
|
||||||
outColours += 'red,';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ( colours.length < 11 ) {
|
|
||||||
for ( let i in colours ) {
|
|
||||||
outColours += colours[ i ] + ',';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for ( let i = 0; i < 10; i++ ) {
|
|
||||||
outColours += colours[ i ] + ',';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
outColours += colours[ 0 ] ?? 'blue' + ')';
|
|
||||||
|
|
||||||
$( '#background' ).css( 'background', outColours );
|
|
||||||
this.setVisualization();
|
|
||||||
},
|
|
||||||
setVisualization () {
|
|
||||||
if ( Object.keys( this.playingSong ).length > 0 ) {
|
|
||||||
if ( this.visualizationSettings === 'bpm' ) {
|
|
||||||
if ( this.playingSong.bpm && this.isPlaying ) {
|
|
||||||
$( '.beat' ).show();
|
|
||||||
$( '.beat' ).css( 'animation-duration', 60 / this.playingSong.bpm );
|
|
||||||
$( '.beat' ).css( 'animation-delay', this.pos % ( 60 / this.playingSong.bpm * this.pos ) + this.playingSong.bpmOffset - ( 60 / this.playingSong.bpm * this.pos / 2 ) );
|
|
||||||
} else {
|
|
||||||
$( '.beat' ).hide();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
clearInterval( this.micAnalyzer );
|
|
||||||
} catch ( err ) {}
|
|
||||||
} else if ( this.visualizationSettings === 'off' ) {
|
|
||||||
$( '.beat' ).hide();
|
|
||||||
try {
|
|
||||||
clearInterval( this.micAnalyzer );
|
|
||||||
} catch ( err ) {}
|
|
||||||
} else if ( this.visualizationSettings === 'mic' ) {
|
|
||||||
$( '.beat-manual' ).hide();
|
|
||||||
try {
|
|
||||||
clearInterval( this.micAnalyzer );
|
|
||||||
} catch ( err ) {}
|
|
||||||
this.micAudioHandler();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log( 'not playing yet' );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
micAudioHandler () {
|
|
||||||
const audioContext = new ( window.AudioContext || window.webkitAudioContext )();
|
|
||||||
const analyser = audioContext.createAnalyser();
|
|
||||||
analyser.fftSize = 256;
|
|
||||||
const bufferLength = analyser.frequencyBinCount;
|
|
||||||
const dataArray = new Uint8Array( bufferLength );
|
|
||||||
|
|
||||||
navigator.mediaDevices.getUserMedia( { audio: true } ).then( ( stream ) => {
|
|
||||||
const mic = audioContext.createMediaStreamSource( stream );
|
|
||||||
mic.connect( analyser );
|
|
||||||
analyser.getByteFrequencyData( dataArray );
|
|
||||||
let prevSpectrum = null;
|
|
||||||
let threshold = 10; // Adjust as needed
|
|
||||||
this.beatDetected = false;
|
|
||||||
this.micAnalyzer = setInterval( () => {
|
|
||||||
analyser.getByteFrequencyData( dataArray );
|
|
||||||
// Convert the frequency data to a numeric array
|
|
||||||
const currentSpectrum = Array.from( dataArray );
|
|
||||||
|
|
||||||
if ( prevSpectrum ) {
|
|
||||||
// Calculate the spectral flux
|
|
||||||
const flux = this.calculateSpectralFlux( prevSpectrum, currentSpectrum );
|
|
||||||
|
|
||||||
if ( flux > threshold && !this.beatDetected ) {
|
|
||||||
// Beat detected
|
|
||||||
this.beatDetected = true;
|
|
||||||
this.animateBeat();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
prevSpectrum = currentSpectrum;
|
|
||||||
}, 20 );
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
animateBeat () {
|
|
||||||
$( '.beat-manual' ).stop();
|
|
||||||
const duration = Math.ceil( 60 / ( this.playingSong.bpm ?? 180 ) * 500 ) - 50;
|
|
||||||
$( '.beat-manual' ).fadeIn( 50 );
|
|
||||||
setTimeout( () => {
|
|
||||||
$( '.beat-manual' ).fadeOut( duration );
|
|
||||||
setTimeout( () => {
|
|
||||||
$( '.beat-manual' ).stop();
|
|
||||||
this.beatDetected = false;
|
|
||||||
}, duration );
|
|
||||||
}, 50 );
|
|
||||||
},
|
|
||||||
calculateSpectralFlux( prevSpectrum, currentSpectrum ) {
|
|
||||||
let flux = 0;
|
|
||||||
|
|
||||||
for ( let i = 0; i < prevSpectrum.length; i++ ) {
|
|
||||||
const diff = currentSpectrum[ i ] - prevSpectrum[ i ];
|
|
||||||
flux += Math.max( 0, diff );
|
|
||||||
}
|
|
||||||
|
|
||||||
return flux;
|
|
||||||
},
|
|
||||||
notifier() {
|
|
||||||
if ( parseInt( this.lastDispatch ) + 5000 < new Date().getTime() ) {
|
|
||||||
|
|
||||||
}
|
|
||||||
Notification.requestPermission();
|
|
||||||
|
|
||||||
console.warn( '[ notifier ]: Status is now enabled \n\n-> Any leaving or tampering with the website will send a notification to the host' );
|
|
||||||
// Detect if window is currently in focus
|
|
||||||
window.onblur = () => {
|
|
||||||
this.sendNotification( 'blur' );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Detect if browser window becomes hidden (also with blur event)
|
|
||||||
document.onvisibilitychange = () => {
|
|
||||||
if ( document.visibilityState === 'hidden' ) {
|
|
||||||
this.sendNotification( 'visibility' );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
sendNotification( notification ) {
|
|
||||||
let fetchOptions = {
|
|
||||||
method: 'post',
|
|
||||||
body: JSON.stringify( { 'type': notification } ),
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'charset': 'utf-8'
|
|
||||||
},
|
|
||||||
};
|
|
||||||
fetch( '/clientStatusUpdate', fetchOptions ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
|
|
||||||
new Notification( 'YOU ARE UNDER SURVEILLANCE', {
|
|
||||||
body: 'Please return to the original webpage immediately!',
|
|
||||||
requireInteraction: true,
|
|
||||||
} )
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.connect();
|
|
||||||
this.notifier();
|
|
||||||
// if ( this.visualizationSettings === 'mic' ) {
|
|
||||||
// this.micAudioHandler();
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
isPlaying( value ) {
|
|
||||||
if ( value ) {
|
|
||||||
this.startTimeTracker();
|
|
||||||
} else {
|
|
||||||
this.stopTimeTracker();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} ).mount( '#app' );
|
|
||||||
@@ -1,162 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="fancy-view">
|
|
||||||
<span class="material-symbols-outlined fancy-view-song-art" v-if="!song.hasCoverArt">music_note</span>
|
|
||||||
<img v-else-if="song.hasCoverArt && song.coverArtOrigin === 'api'" :src="song.coverArtURL" class="fancy-view-song-art">
|
|
||||||
<img v-else :src="'http://localhost:8081/getSongCover?filename=' + song.filename" class="fancy-view-song-art">
|
|
||||||
<button @click="exit()" id="exit-button"><span class="material-symbols-outlined" style="font-size: 4vh;">close</span></button>
|
|
||||||
<div class="controls-wrapper">
|
|
||||||
<div class="song-info">
|
|
||||||
<h3>{{ song.title }}</h3>
|
|
||||||
<p>{{ song.artist }}</p>
|
|
||||||
</div>
|
|
||||||
<div class="controls">
|
|
||||||
<span class="material-symbols-outlined control-icon" @click="control( 'previous' )">skip_previous</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" @click="control( 'replay10' )">replay_10</span>
|
|
||||||
<span class="material-symbols-outlined control-icon play-pause" v-if="!isPlaying" @click="control( 'play' )">play_arrow</span>
|
|
||||||
<span class="material-symbols-outlined control-icon play-pause" v-else-if="isPlaying" @click="control( 'pause' )">pause</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" @click="control( 'forward10' )">forward_10</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" @click="control( 'next' )">skip_next</span>
|
|
||||||
</div>
|
|
||||||
<div class="slider-wrapper">
|
|
||||||
<sliderView :active="true" :position="playbackPos" :duration="song.duration" @pos="( p ) => { setPos( p ) }"
|
|
||||||
name="fancy" class="slider"></sliderView>
|
|
||||||
<div class="playback-pos-info">
|
|
||||||
<div style="margin-right: auto;">{{ playbackPosBeautified }}</div>
|
|
||||||
<div>{{ durationBeautified }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="shuffle-repeat-wrapper">
|
|
||||||
<span class="material-symbols-outlined control-icon" v-if="!shuffle" @click="control( 'shuffleOn' )">shuffle</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" v-else @click="control( 'shuffleOff' )">shuffle_on</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" v-if="repeatMode === 'off'" @click="control( 'repeatOne' )">repeat</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" v-else-if="repeatMode === 'one'" @click="control( 'repeatAll' )">repeat_one_on</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" v-else-if="repeatMode === 'all'" @click="control( 'repeatOff' )">repeat_on</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
#exit-button {
|
|
||||||
position: fixed;
|
|
||||||
right: 1vw;
|
|
||||||
top: 1vw;
|
|
||||||
background-color: rgba( 0,0,0,0 );
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
color: var( --primary-color );
|
|
||||||
}
|
|
||||||
|
|
||||||
.fancy-view {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
position: fixed;
|
|
||||||
flex-direction: column;
|
|
||||||
z-index: 20;
|
|
||||||
height: 100vh;
|
|
||||||
width: 100vw;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
background-color: var( --background-color );
|
|
||||||
}
|
|
||||||
|
|
||||||
.controls-wrapper {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.slider-wrapper {
|
|
||||||
position: relative;
|
|
||||||
margin-top: 40px;
|
|
||||||
width: 40vh;
|
|
||||||
margin-bottom: 20px
|
|
||||||
}
|
|
||||||
|
|
||||||
.fancy-view-song-art {
|
|
||||||
height: 40vh;
|
|
||||||
width: 40vh;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
font-size: 40vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.controls {
|
|
||||||
width: 50vw;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.control-icon {
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 3vh;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.play-pause {
|
|
||||||
font-size: 5vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playback-pos-info {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
width: 98%;
|
|
||||||
margin-left: 1%;
|
|
||||||
position: absolute;
|
|
||||||
bottom: 17px;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shuffle-repeat-wrapper {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import SliderView from './sliderView.vue';
|
|
||||||
export default {
|
|
||||||
methods: {
|
|
||||||
control ( instruction ) {
|
|
||||||
this.$emit( 'control', instruction );
|
|
||||||
},
|
|
||||||
setPos ( pos ) {
|
|
||||||
this.$emit( 'posUpdate', pos );
|
|
||||||
},
|
|
||||||
exit() {
|
|
||||||
this.$emit( 'control', 'exitFancyView' );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
SliderView,
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
song: {
|
|
||||||
type: Object,
|
|
||||||
},
|
|
||||||
playbackPos: {
|
|
||||||
type: Number,
|
|
||||||
},
|
|
||||||
playbackPosBeautified: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
durationBeautified: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
shuffle: {
|
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
isPlaying: {
|
|
||||||
type: Boolean,
|
|
||||||
},
|
|
||||||
repeatMode: {
|
|
||||||
type: String,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,388 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="media-pool" :style="isShowingFancyView ? 'overflow: hidden;' : ''">
|
|
||||||
<div v-if="hasLoadedSongs" style="width: 100%;" class="song-list-wrapper">
|
|
||||||
<div v-for="song in songQueue" class="song-list" :class="[ isPlaying ? ( currentlyPlaying === song.filename ? 'playing': 'not-playing' ) : 'not-playing', !isPlaying && currentlyPlaying === song.filename ? 'active-song': undefined ]">
|
|
||||||
<span class="material-symbols-outlined song-image" v-if="!song.hasCoverArt">music_note</span>
|
|
||||||
<img v-else-if="song.hasCoverArt && song.coverArtOrigin === 'api'" :src="song.coverArtURL" class="song-image">
|
|
||||||
<img v-else :src="'http://localhost:8081/getSongCover?filename=' + song.filename" class="song-image">
|
|
||||||
<div v-if="currentlyPlaying === song.filename && isPlaying" class="playing-symbols">
|
|
||||||
<div class="playing-symbols-wrapper">
|
|
||||||
<div class="playing-bar" id="bar-1"></div>
|
|
||||||
<div class="playing-bar" id="bar-2"></div>
|
|
||||||
<div class="playing-bar" id="bar-3"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span class="material-symbols-outlined play-icon" @click="play( song )">play_arrow</span>
|
|
||||||
<span class="material-symbols-outlined pause-icon" @click="pause( song )">pause</span>
|
|
||||||
<h3>{{ song.title }}</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else-if="isLoadingSongs" class="no-songs">
|
|
||||||
<h3>Loading songs...</h3>
|
|
||||||
<p>Analyzing metadata...</p>
|
|
||||||
<span class="material-symbols-outlined loading-spinner">autorenew</span>
|
|
||||||
</div>
|
|
||||||
<div v-else-if="errorOccurredLoading" class="no-songs">
|
|
||||||
<h3>This directory does not exist!</h3>
|
|
||||||
<button @click="loadSongs()">Load songs</button>
|
|
||||||
</div>
|
|
||||||
<div v-else class="no-songs">
|
|
||||||
<h3>No songs loaded</h3>
|
|
||||||
<button @click="loadSongs()">Load songs</button>
|
|
||||||
<button @click="useAppleMusic()">Use AppleMusic (opens a web-browser)</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.playing-symbols {
|
|
||||||
position: absolute;
|
|
||||||
left: 10%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: row;
|
|
||||||
margin: 0;
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
background-color: rgba( 0, 0, 0, 0.6 );
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing-symbols-wrapper {
|
|
||||||
width: 4vw;
|
|
||||||
height: 5vw;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing-bar {
|
|
||||||
height: 60%;
|
|
||||||
background-color: white;
|
|
||||||
width: 10%;
|
|
||||||
border-radius: 50px;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bar-1 {
|
|
||||||
animation: music-playing 0.9s infinite ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bar-2 {
|
|
||||||
animation: music-playing 0.9s infinite ease-in-out;
|
|
||||||
animation-delay: 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bar-3 {
|
|
||||||
animation: music-playing 0.9s infinite ease-in-out;
|
|
||||||
animation-delay: 0.6s;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes music-playing {
|
|
||||||
0% {
|
|
||||||
transform: scaleY( 1 );
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
transform: scaleY( 0.5 );
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: scaleY( 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-spinner {
|
|
||||||
animation: spin 2s infinite linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
from {
|
|
||||||
transform: rotate( 0deg );
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: rotate( 720deg );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.media-pool {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-songs {
|
|
||||||
height: 50vh;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list-wrapper {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
width: 80%;
|
|
||||||
margin: 2px;
|
|
||||||
padding: 1vh;
|
|
||||||
border: 1px var( --border-color ) solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list h3 {
|
|
||||||
margin: 0;
|
|
||||||
display: block;
|
|
||||||
margin-left: 10px;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list .song-image {
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
font-size: 5vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.play-icon, .pause-icon {
|
|
||||||
display: none;
|
|
||||||
width: 5vw;
|
|
||||||
height: 5vw;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
font-size: 5vw;
|
|
||||||
cursor: pointer;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing:hover .pause-icon {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playing:hover .playing-symbols {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-list:hover .song-image {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.not-playing:hover .play-icon {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.active-song .pause-icon {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.active-song .song-image, .active-song:hover .pause-icon {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'HomeView',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hasLoadedSongs: false,
|
|
||||||
isLoadingSongs: false,
|
|
||||||
allSongs: [],
|
|
||||||
songQueue: [],
|
|
||||||
loadedDirs: [],
|
|
||||||
allowedFiletypes: [ '.mp3', '.wav' ],
|
|
||||||
currentlyPlaying: '',
|
|
||||||
isPlaying: false,
|
|
||||||
songPos: 0,
|
|
||||||
repeat: false,
|
|
||||||
isShowingFancyView: false,
|
|
||||||
errorOccurredLoading: false,
|
|
||||||
coverArtSetting: 'api',
|
|
||||||
doOverride: false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
update( status ) {
|
|
||||||
if ( status.type === 'playback' ) {
|
|
||||||
this.isPlaying = status.status;
|
|
||||||
} else if ( status.type === 'next' ) {
|
|
||||||
if ( this.songPos < this.songQueue.length - 1 ) {
|
|
||||||
this.songPos += 1;
|
|
||||||
this.queueHandler( 'load' );
|
|
||||||
} else {
|
|
||||||
this.songPos = 0;
|
|
||||||
if ( this.repeat ) {
|
|
||||||
this.queueHandler( 'load' );
|
|
||||||
} else {
|
|
||||||
this.isPlaying = false;
|
|
||||||
this.currentlyPlaying = '';
|
|
||||||
this.$emit( 'com', { 'type': 'startPlayback', 'song': this.songQueue[ 0 ], 'autoplay': false } );
|
|
||||||
this.$emit( 'com', { 'type': 'pause' } );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let fetchOptions = {
|
|
||||||
method: 'post',
|
|
||||||
body: JSON.stringify( { 'type': 'queuePos', 'data': this.songPos } ),
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'charset': 'utf-8'
|
|
||||||
},
|
|
||||||
};
|
|
||||||
fetch( 'http://localhost:8081/statusUpdate', fetchOptions ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
} else if ( status.type === 'previous' ) {
|
|
||||||
if ( this.songPos > 0 ) {
|
|
||||||
this.songPos -= 1;
|
|
||||||
} else {
|
|
||||||
this.songPos = this.songQueue.length - 1;
|
|
||||||
}
|
|
||||||
this.queueHandler( 'load' );
|
|
||||||
} else if ( status.type === 'shuffle' ) {
|
|
||||||
this.queueHandler( 'shuffle' );
|
|
||||||
} else if ( status.type === 'shuffleOff' ) {
|
|
||||||
this.queueHandler( 'shuffleOff' );
|
|
||||||
} else if ( status.type === 'repeat' ) {
|
|
||||||
this.repeat = true;
|
|
||||||
} else if ( status.type === 'repeatOff' ) {
|
|
||||||
this.repeat = false;
|
|
||||||
} else if ( status.type === 'fancyView' ) {
|
|
||||||
this.isShowingFancyView = status.status;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
queueHandler ( command ) {
|
|
||||||
if ( command === 'load' ) {
|
|
||||||
this.play( this.songQueue[ this.songPos ] );
|
|
||||||
} else if ( command === 'shuffle' ) {
|
|
||||||
let processArray = JSON.parse( JSON.stringify( this.allSongs ) );
|
|
||||||
let newOrder = [];
|
|
||||||
for ( let i = 0; i < this.allSongs.length; i++ ) {
|
|
||||||
let randNum = Math.floor( Math.random() * this.allSongs.length );
|
|
||||||
while ( newOrder.includes( randNum ) ) {
|
|
||||||
randNum = Math.floor( Math.random() * this.allSongs.length );
|
|
||||||
}
|
|
||||||
newOrder.push( randNum );
|
|
||||||
}
|
|
||||||
this.songQueue = [];
|
|
||||||
for ( let el in newOrder ) {
|
|
||||||
this.songQueue.push( processArray[ newOrder[ el ] ] );
|
|
||||||
}
|
|
||||||
let fetchOptions = {
|
|
||||||
method: 'post',
|
|
||||||
body: JSON.stringify( { 'type': 'songQueue', 'data': this.songQueue } ),
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'charset': 'utf-8'
|
|
||||||
},
|
|
||||||
};
|
|
||||||
fetch( 'http://localhost:8081/statusUpdate', fetchOptions ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
} else if ( command === 'shuffleOff' ) {
|
|
||||||
this.songQueue = JSON.parse( JSON.stringify( this.allSongs ) );
|
|
||||||
let fetchOptions = {
|
|
||||||
method: 'post',
|
|
||||||
body: JSON.stringify( { 'type': 'songQueue', 'data': this.songQueue } ),
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'charset': 'utf-8'
|
|
||||||
},
|
|
||||||
};
|
|
||||||
fetch( 'http://localhost:8081/statusUpdate', fetchOptions ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
loadSongs() {
|
|
||||||
this.isLoadingSongs = true;
|
|
||||||
fetch( 'http://localhost:8081/openSongs' ).then( res => {
|
|
||||||
if ( res.status === 200 ) {
|
|
||||||
res.json().then( json => {
|
|
||||||
if ( Object.keys( json ).length > 0 ) {
|
|
||||||
this.loadedDirs = json.data;
|
|
||||||
this.indexFiles();
|
|
||||||
} else {
|
|
||||||
this.isLoadingSongs = false;
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
indexFiles () {
|
|
||||||
for ( let dir in this.loadedDirs ) {
|
|
||||||
fetch( 'http://localhost:8081/indexDirs?dir=' + this.loadedDirs[ dir ] + '&coverart=' + this.coverArtSetting + '&doOverride=' + this.doOverride ).then( res => {
|
|
||||||
if ( res.status === 200 ) {
|
|
||||||
this.errorOccurredLoading = false;
|
|
||||||
res.json().then( json => {
|
|
||||||
for ( let song in json ) {
|
|
||||||
this.songQueue.push( json[ song ] );
|
|
||||||
this.allSongs.push( json[ song ] );
|
|
||||||
}
|
|
||||||
this.queueHandler();
|
|
||||||
this.isLoadingSongs = false;
|
|
||||||
this.hasLoadedSongs = true;
|
|
||||||
this.$emit( 'com', { 'type': 'songsLoaded' } );
|
|
||||||
let fetchOptions = {
|
|
||||||
method: 'post',
|
|
||||||
body: JSON.stringify( { 'type': 'songQueue', 'data': this.songQueue } ),
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'charset': 'utf-8'
|
|
||||||
},
|
|
||||||
};
|
|
||||||
fetch( 'http://localhost:8081/statusUpdate', fetchOptions ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
} else if ( res.status === 404 ) {
|
|
||||||
this.isLoadingSongs = false;
|
|
||||||
this.errorOccurredLoading = true;
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
play( song ) {
|
|
||||||
if ( song.filename === this.currentlyPlaying ) {
|
|
||||||
this.$emit( 'com', { 'type': 'play', 'song': song } );
|
|
||||||
} else {
|
|
||||||
for ( let s in this.songQueue ) {
|
|
||||||
if ( this.songQueue[ s ][ 'filename' ] === song.filename ) {
|
|
||||||
this.songPos = parseInt( s );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.$emit( 'com', { 'type': 'startPlayback', 'song': song } );
|
|
||||||
}
|
|
||||||
this.currentlyPlaying = song.filename;
|
|
||||||
this.update( { 'type': 'playback', 'status': true } );
|
|
||||||
let fetchOptions = {
|
|
||||||
method: 'post',
|
|
||||||
body: JSON.stringify( { 'type': 'queuePos', 'data': this.songPos } ),
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'charset': 'utf-8'
|
|
||||||
},
|
|
||||||
};
|
|
||||||
fetch( 'http://localhost:8081/statusUpdate', fetchOptions ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
pause( song ) {
|
|
||||||
this.update( { 'type': 'playback', 'status': false } );
|
|
||||||
this.$emit( 'com', { 'type': 'pause', 'song': song } );
|
|
||||||
},
|
|
||||||
useAppleMusic() {
|
|
||||||
fetch( 'http://localhost:8081/useAppleMusic' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,282 +0,0 @@
|
|||||||
<!-- eslint-disable no-undef -->
|
|
||||||
<template>
|
|
||||||
<div id="notifications" @click="handleNotifications();">
|
|
||||||
<div class="message-box" :class="[ location, size ]">
|
|
||||||
<div class="message-container" :class="messageType">
|
|
||||||
<span class="material-symbols-outlined types hide" v-if="messageType == 'hide'">question_mark</span>
|
|
||||||
<span class="material-symbols-outlined types" v-else-if="messageType == 'ok'" style="background-color: green;">done</span>
|
|
||||||
<span class="material-symbols-outlined types" v-else-if="messageType == 'error'" style="background-color: red;">close</span>
|
|
||||||
<span class="material-symbols-outlined types progress-spinner" v-else-if="messageType == 'progress'" style="background-color: blue;">progress_activity</span>
|
|
||||||
<span class="material-symbols-outlined types" v-else-if="messageType == 'info'" style="background-color: lightblue;">info</span>
|
|
||||||
<span class="material-symbols-outlined types" v-else-if="messageType == 'warning'" style="background-color: orangered;">warning</span>
|
|
||||||
<p class="message">{{ message }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'notifications',
|
|
||||||
props: {
|
|
||||||
location: {
|
|
||||||
type: String,
|
|
||||||
'default': 'topleft',
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
type: String,
|
|
||||||
'default': 'default',
|
|
||||||
}
|
|
||||||
// Size options: small, default (default option), big, bigger, huge
|
|
||||||
},
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
notifications: {},
|
|
||||||
queue: [],
|
|
||||||
message: '',
|
|
||||||
messageType: 'hide',
|
|
||||||
notificationDisplayTime: 0,
|
|
||||||
notificationPriority: 'normal',
|
|
||||||
currentlyDisplayedNotificationID: 0,
|
|
||||||
currentID: { 'critical': 0, 'medium': 1000, 'low': 100000 },
|
|
||||||
displayTimeCurrentNotification: 0,
|
|
||||||
notificationScheduler: null,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
createNotification( message, showDuration, messageType, priority ) {
|
|
||||||
/*
|
|
||||||
Takes a notification options array that contains: message, showDuration (in seconds), messageType (ok, error, progress, info) and priority (low, normal, critical).
|
|
||||||
Returns a notification ID which can be used to cancel the notification. The component will throttle notifications and display
|
|
||||||
one at a time and prioritize messages with higher priority. Use vue refs to access these methods.
|
|
||||||
*/
|
|
||||||
let id = 0;
|
|
||||||
|
|
||||||
if ( priority === 'critical' ) {
|
|
||||||
this.currentID[ 'critical' ] += 1;
|
|
||||||
id = this.currentID[ 'critical' ];
|
|
||||||
} else if ( priority === 'normal' ) {
|
|
||||||
this.currentID[ 'medium' ] += 1;
|
|
||||||
id = this.currentID[ 'medium' ];
|
|
||||||
} else if ( priority === 'low' ) {
|
|
||||||
this.currentID[ 'low' ] += 1;
|
|
||||||
id = this.currentID[ 'low' ];
|
|
||||||
}
|
|
||||||
this.notifications[ id ] = { 'message': message, 'showDuration': showDuration, 'messageType': messageType, 'priority': priority, 'id': id };
|
|
||||||
this.queue.push( id );
|
|
||||||
console.log( 'scheduled notification: ' + id + ' (' + message + ')' );
|
|
||||||
if ( this.displayTimeCurrentNotification >= this.notificationDisplayTime ) {
|
|
||||||
this.handleNotifications();
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
},
|
|
||||||
cancelNotification ( id ) {
|
|
||||||
/*
|
|
||||||
This method deletes a notification and, in case the notification is being displayed, hides it.
|
|
||||||
*/
|
|
||||||
try {
|
|
||||||
delete this.notifications[ id ];
|
|
||||||
} catch ( error ) {
|
|
||||||
console.log( 'notification to be deleted is nonexistent or currently being displayed' );
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
this.queue.splice( this.queue.indexOf( id ), 1 );
|
|
||||||
} catch {
|
|
||||||
console.debug( 'queue empty' );
|
|
||||||
}
|
|
||||||
if ( this.currentlyDisplayedNotificationID == id ) {
|
|
||||||
this.handleNotifications();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleNotifications () {
|
|
||||||
/*
|
|
||||||
This methods should NOT be called in any other component than this one!
|
|
||||||
*/
|
|
||||||
this.displayTimeCurrentNotification = 0;
|
|
||||||
this.notificationDisplayTime = 0;
|
|
||||||
this.message = '';
|
|
||||||
this.queue.sort();
|
|
||||||
if ( this.queue.length > 0 ) {
|
|
||||||
this.message = this.notifications[ this.queue[ 0 ] ][ 'message' ];
|
|
||||||
this.messageType = this.notifications[ this.queue[ 0 ] ][ 'messageType' ];
|
|
||||||
this.priority = this.notifications[ this.queue[ 0 ] ][ 'priority' ];
|
|
||||||
this.currentlyDisplayedNotificationID = this.notifications[ this.queue[ 0 ] ][ 'id' ];
|
|
||||||
this.notificationDisplayTime = this.notifications[ this.queue[ 0 ] ][ 'showDuration' ];
|
|
||||||
delete this.notifications[ this.queue[ 0 ] ];
|
|
||||||
this.queue.reverse();
|
|
||||||
this.queue.pop();
|
|
||||||
$( '.message-box' ).css( 'z-index', 20 );
|
|
||||||
} else {
|
|
||||||
this.messageType = 'hide';
|
|
||||||
$( '.message-box' ).css( 'z-index', -1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created () {
|
|
||||||
window.$ = window.jQuery = require( 'jquery' );
|
|
||||||
this.notificationScheduler = setInterval( () => {
|
|
||||||
if ( this.displayTimeCurrentNotification >= this.notificationDisplayTime ) {
|
|
||||||
this.handleNotifications();
|
|
||||||
} else {
|
|
||||||
this.displayTimeCurrentNotification += 0.5;
|
|
||||||
}
|
|
||||||
}, 500 );
|
|
||||||
},
|
|
||||||
unmounted ( ) {
|
|
||||||
clearInterval( this.notificationScheduler );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.message-box {
|
|
||||||
position: fixed;
|
|
||||||
z-index: -1;
|
|
||||||
color: white;
|
|
||||||
transition: all 0.5s;
|
|
||||||
width: 95vw;
|
|
||||||
right: 2.5vw;
|
|
||||||
top: 1vh;
|
|
||||||
height: 10vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.message-container {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
opacity: 1;
|
|
||||||
transition: all 0.5s;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.types {
|
|
||||||
color: white;
|
|
||||||
border-radius: 100%;
|
|
||||||
margin-right: auto;
|
|
||||||
margin-left: 5%;
|
|
||||||
padding: 1.5%;
|
|
||||||
font-size: 200%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message {
|
|
||||||
margin-right: 5%;
|
|
||||||
text-align: end;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ok {
|
|
||||||
background-color: rgb(1, 71, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.error {
|
|
||||||
background-color: rgb(114, 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.info {
|
|
||||||
background-color: rgb(44, 112, 151);
|
|
||||||
}
|
|
||||||
|
|
||||||
.warning {
|
|
||||||
background-color: orange;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hide {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress {
|
|
||||||
z-index: 20;
|
|
||||||
background-color: rgb(0, 0, 99);
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress-spinner {
|
|
||||||
animation: spin 2s infinite linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
from {
|
|
||||||
transform: rotate( 0deg );
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: rotate( 720deg );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (min-width: 750px) {
|
|
||||||
|
|
||||||
.default {
|
|
||||||
height: 10vh;
|
|
||||||
width: 32vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.small {
|
|
||||||
height: 7vh;
|
|
||||||
width: 27vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.big {
|
|
||||||
height: 12vh;
|
|
||||||
width: 38vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bigger {
|
|
||||||
height: 15vh;
|
|
||||||
width: 43vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.huge {
|
|
||||||
height: 20vh;
|
|
||||||
width: 50vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topleft {
|
|
||||||
top: 3vh;
|
|
||||||
left: 0.5vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topright {
|
|
||||||
top: 3vh;
|
|
||||||
right: 0.5vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bottomright {
|
|
||||||
bottom: 3vh;
|
|
||||||
right: 0.5vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bottomleft {
|
|
||||||
top: 3vh;
|
|
||||||
right: 0.5vw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@media only screen and (min-width: 1500px) {
|
|
||||||
.default {
|
|
||||||
height: 10vh;
|
|
||||||
width: 15vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.small {
|
|
||||||
height: 7vh;
|
|
||||||
width: 11vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.big {
|
|
||||||
height: 12vh;
|
|
||||||
width: 17vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bigger {
|
|
||||||
height: 15vh;
|
|
||||||
width: 20vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.huge {
|
|
||||||
height: 20vh;
|
|
||||||
width: 25vw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,451 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="player">
|
|
||||||
<div class="controls">
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="audioLoaded ? 'active': 'inactive'" @click="control( 'previous' )">skip_previous</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="audioLoaded ? 'active': 'inactive'" @click="control( 'replay10' )">replay_10</span>
|
|
||||||
<span class="material-symbols-outlined control-icon play-pause" v-if="!isPlaying && audioLoaded" @click="control( 'play' )">play_arrow</span>
|
|
||||||
<span class="material-symbols-outlined control-icon play-pause" v-else-if="isPlaying && audioLoaded" @click="control( 'pause' )">pause</span>
|
|
||||||
<span class="material-symbols-outlined control-icon play-pause" style="cursor: default;" v-else>play_disabled</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="audioLoaded ? 'active': 'inactive'" @click="control( 'forward10' )">forward_10</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="audioLoaded ? 'active': 'inactive'" @click="control( 'next' )" style="margin-right: 1vw;">skip_next</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasLoadedSongs ? 'active': 'inactive'" v-if="!isShuffleEnabled" @click="control( 'shuffleOn' )">shuffle</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasLoadedSongs ? 'active': 'inactive'" v-else @click="control( 'shuffleOff' )">shuffle_on</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasLoadedSongs ? 'active': 'inactive'" v-if="repeatMode === 'off'" @click="control( 'repeatOne' )">repeat</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasLoadedSongs ? 'active': 'inactive'" v-else-if="repeatMode === 'one'" @click="control( 'repeatAll' )">repeat_one_on</span>
|
|
||||||
<span class="material-symbols-outlined control-icon" :class="hasLoadedSongs ? 'active': 'inactive'" v-else-if="repeatMode === 'all'" @click="control( 'repeatOff' )">repeat_on</span>
|
|
||||||
<div class="control-icon" id="settings">
|
|
||||||
<span class="material-symbols-outlined">info</span>
|
|
||||||
<div id="showIP">
|
|
||||||
<h4>IP to connect to:</h4><br>
|
|
||||||
<p>{{ localIP }}:8081</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="song-info">
|
|
||||||
<audio v-if="audioLoaded" :src="'http://localhost:8081/getSongFile?filename=' + playingSong.filename" id="music-player"></audio>
|
|
||||||
<div class="song-info-wrapper">
|
|
||||||
<div v-if="audioLoaded" @click="showFancyView()" style="cursor: pointer;">
|
|
||||||
<span class="material-symbols-outlined image" v-if="!playingSong.hasCoverArt">music_note</span>
|
|
||||||
<img v-else-if="playingSong.hasCoverArt && playingSong.coverArtOrigin === 'api'" :src="playingSong.coverArtURL" class="image">
|
|
||||||
<img v-else :src="'http://localhost:8081/getSongCover?filename=' + playingSong.filename" class="image">
|
|
||||||
</div>
|
|
||||||
<span class="material-symbols-outlined image" v-else>music_note</span>
|
|
||||||
<div class="name">
|
|
||||||
<h3>{{ playingSong.title ?? 'No song selected' }}</h3>
|
|
||||||
<p>{{ playingSong.artist }}</p>
|
|
||||||
</div>
|
|
||||||
<div class="image"></div>
|
|
||||||
</div>
|
|
||||||
<div class="playback-pos-info">
|
|
||||||
<div style="margin-right: auto;">{{ playbackPosBeautified }}</div>
|
|
||||||
<div @click="toggleShowMode()" style="cursor: pointer;">{{ durationBeautified }}</div>
|
|
||||||
</div>
|
|
||||||
<sliderView :active="audioLoaded" :position="playbackPos" :duration="playingSong.duration" @pos="( p ) => { setPos( p ) }"
|
|
||||||
name="player"></sliderView>
|
|
||||||
</div>
|
|
||||||
<FancyView v-if="isShowingFancyView" :song="playingSong" @control="instruction => { control( instruction ) }" :isPlaying="isPlaying"
|
|
||||||
:shuffle="isShuffleEnabled" :repeatMode="repeatMode" :durationBeautified="durationBeautified"
|
|
||||||
:playbackPos="playbackPos" :playbackPosBeautified="playbackPosBeautified"
|
|
||||||
@posUpdate="pos => { setPos( pos ) }"></FancyView>
|
|
||||||
<Notifications ref="notifications" size="bigger" location="topright"></Notifications>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.song-info {
|
|
||||||
background-color: #8e9ced;
|
|
||||||
height: 13vh;
|
|
||||||
width: 50%;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.image {
|
|
||||||
width: 7vh;
|
|
||||||
height: 7vh;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: center;
|
|
||||||
font-size: 7vh;
|
|
||||||
margin-left: 1vh;
|
|
||||||
margin-top: 1vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.name {
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-info-wrapper {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.song-info-wrapper h3 {
|
|
||||||
margin: 0;
|
|
||||||
margin-bottom: 0.5vh;
|
|
||||||
margin-top: 1vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.controls {
|
|
||||||
margin-left: 5%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.control-icon {
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 3vh;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.play-pause {
|
|
||||||
font-size: 5vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inactive {
|
|
||||||
color: gray;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.player {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.playback-pos-info {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
width: 98%;
|
|
||||||
margin-left: 1%;
|
|
||||||
position: absolute;
|
|
||||||
bottom: 17px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#showIP {
|
|
||||||
background-color: rgb(63, 63, 63);
|
|
||||||
display: none;
|
|
||||||
position: absolute;
|
|
||||||
min-height: 16vh;
|
|
||||||
padding: 2vh;
|
|
||||||
min-width: 20vw;
|
|
||||||
z-index: 10;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
font-size: 70%;
|
|
||||||
border-radius: 5px 10px 10px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#showIP h4, #showIP p {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#settings:hover #showIP {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
#showIP::before {
|
|
||||||
content: " ";
|
|
||||||
position: absolute;
|
|
||||||
bottom: 100%; /* At the bottom of the tooltip */
|
|
||||||
left: 0;
|
|
||||||
margin-left: 3px;
|
|
||||||
border-width: 10px;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: transparent transparent rgb(63, 63, 63) transparent;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import FancyView from './fancyView.vue';
|
|
||||||
import Notifications from './notifications.vue';
|
|
||||||
import SliderView from './sliderView.vue';
|
|
||||||
import { guess } from 'web-audio-beat-detector';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
playingSong: {},
|
|
||||||
audioLoaded: false,
|
|
||||||
isPlaying: false,
|
|
||||||
isShuffleEnabled: false,
|
|
||||||
repeatMode: 'off',
|
|
||||||
progressTracker: null,
|
|
||||||
playbackPos: 0,
|
|
||||||
playbackPosBeautified: '00:00',
|
|
||||||
durationBeautified: '--:--',
|
|
||||||
hasLoadedSongs: false,
|
|
||||||
isShowingFancyView: false,
|
|
||||||
notifier: null,
|
|
||||||
isShowingRemainingTime: false,
|
|
||||||
localIP: ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
SliderView,
|
|
||||||
FancyView,
|
|
||||||
Notifications,
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
play( song, autoplay, doCrossFade = false ) {
|
|
||||||
this.playingSong = song;
|
|
||||||
this.audioLoaded = true;
|
|
||||||
this.init( doCrossFade, autoplay, song.filename );
|
|
||||||
},
|
|
||||||
// TODO: Make function that connects to status service and add various warnings.
|
|
||||||
init( doCrossFade, autoplay, filename ) {
|
|
||||||
this.control( 'reset' );
|
|
||||||
// TODO: make it support cross-fade
|
|
||||||
setTimeout( () => {
|
|
||||||
if ( autoplay ) {
|
|
||||||
this.control( 'play' );
|
|
||||||
this.isPlaying = true;
|
|
||||||
this.sendUpdate( 'isPlaying' );
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
}
|
|
||||||
this.sendUpdate( 'playingSong' );
|
|
||||||
const minuteCount = Math.floor( this.playingSong.duration / 60 );
|
|
||||||
this.durationBeautified = minuteCount + ':';
|
|
||||||
if ( ( '' + minuteCount ).length === 1 ) {
|
|
||||||
this.durationBeautified = '0' + minuteCount + ':';
|
|
||||||
}
|
|
||||||
const secondCount = Math.floor( this.playingSong.duration - minuteCount * 60 );
|
|
||||||
if ( ( '' + secondCount ).length === 1 ) {
|
|
||||||
this.durationBeautified += '0' + secondCount;
|
|
||||||
} else {
|
|
||||||
this.durationBeautified += secondCount;
|
|
||||||
}
|
|
||||||
let musicPlayer = document.getElementById( 'music-player' );
|
|
||||||
musicPlayer.onended = () => {
|
|
||||||
if ( musicPlayer.currentTime >= this.playingSong.duration - 1 ) {
|
|
||||||
if ( this.repeatMode !== 'one' ) {
|
|
||||||
this.control( 'next' );
|
|
||||||
} else {
|
|
||||||
musicPlayer.currentTime = 0;
|
|
||||||
this.control( 'play' );
|
|
||||||
this.playbackPos = musicPlayer.currentTime;
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( !this.playingSong.bpm ) {
|
|
||||||
const audioContext = new AudioContext();
|
|
||||||
fetch( 'http://localhost:8081/getSongFile?filename=' + filename ).then( res => {
|
|
||||||
res.arrayBuffer().then( buf => {
|
|
||||||
audioContext.decodeAudioData( buf, audioBuffer => {
|
|
||||||
guess( audioBuffer ).then( ( data ) => {
|
|
||||||
this.playingSong.bpm = data.bpm;
|
|
||||||
this.playingSong.accurateTempo = data.tempo;
|
|
||||||
this.playingSong.bpmOffset = data.offset;
|
|
||||||
this.sendUpdate( 'playingSong' );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
}, 300 );
|
|
||||||
},
|
|
||||||
toggleShowMode() {
|
|
||||||
this.isShowingRemainingTime = !this.isShowingRemainingTime;
|
|
||||||
if ( !this.isShowingRemainingTime ) {
|
|
||||||
const minuteCounts = Math.floor( this.playingSong.duration / 60 );
|
|
||||||
this.durationBeautified = String( minuteCounts ) + ':';
|
|
||||||
if ( ( '' + minuteCounts ).length === 1 ) {
|
|
||||||
this.durationBeautified = '0' + minuteCounts + ':';
|
|
||||||
}
|
|
||||||
const secondCounts = Math.floor( this.playingSong.duration - minuteCounts * 60 );
|
|
||||||
if ( ( '' + secondCounts ).length === 1 ) {
|
|
||||||
this.durationBeautified += '0' + secondCounts;
|
|
||||||
} else {
|
|
||||||
this.durationBeautified += secondCounts;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sendUpdate( update ) {
|
|
||||||
let data = {};
|
|
||||||
if ( update === 'pos' ) {
|
|
||||||
data = this.playbackPos;
|
|
||||||
} else if ( update === 'playingSong' ) {
|
|
||||||
data = this.playingSong;
|
|
||||||
} else if ( update === 'isPlaying' ) {
|
|
||||||
data = this.isPlaying;
|
|
||||||
}
|
|
||||||
let fetchOptions = {
|
|
||||||
method: 'post',
|
|
||||||
body: JSON.stringify( { 'type': update, 'data': data } ),
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'charset': 'utf-8'
|
|
||||||
},
|
|
||||||
};
|
|
||||||
fetch( 'http://localhost:8081/statusUpdate', fetchOptions ).catch( err => {
|
|
||||||
console.error( err );
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
control( action ) {
|
|
||||||
// https://css-tricks.com/lets-create-a-custom-audio-player/
|
|
||||||
let musicPlayer = document.getElementById( 'music-player' );
|
|
||||||
if ( musicPlayer ) {
|
|
||||||
if ( action === 'play' ) {
|
|
||||||
this.$emit( 'update', { 'type': 'playback', 'status': true } );
|
|
||||||
musicPlayer.play();
|
|
||||||
this.isPlaying = true;
|
|
||||||
this.progressTracker = setInterval( () => {
|
|
||||||
this.playbackPos = musicPlayer.currentTime;
|
|
||||||
const minuteCount = Math.floor( this.playbackPos / 60 );
|
|
||||||
this.playbackPosBeautified = minuteCount + ':';
|
|
||||||
if ( ( '' + minuteCount ).length === 1 ) {
|
|
||||||
this.playbackPosBeautified = '0' + minuteCount + ':';
|
|
||||||
}
|
|
||||||
const secondCount = Math.floor( this.playbackPos - minuteCount * 60 );
|
|
||||||
if ( ( '' + secondCount ).length === 1 ) {
|
|
||||||
this.playbackPosBeautified += '0' + secondCount;
|
|
||||||
} else {
|
|
||||||
this.playbackPosBeautified += secondCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( this.isShowingRemainingTime ) {
|
|
||||||
const minuteCounts = Math.floor( ( this.playingSong.duration - this.playbackPos ) / 60 );
|
|
||||||
this.durationBeautified = '-' + String( minuteCounts ) + ':';
|
|
||||||
if ( ( '' + minuteCounts ).length === 1 ) {
|
|
||||||
this.durationBeautified = '-0' + minuteCounts + ':';
|
|
||||||
}
|
|
||||||
const secondCounts = Math.floor( ( this.playingSong.duration - this.playbackPos ) - minuteCounts * 60 );
|
|
||||||
if ( ( '' + secondCounts ).length === 1 ) {
|
|
||||||
this.durationBeautified += '0' + secondCounts;
|
|
||||||
} else {
|
|
||||||
this.durationBeautified += secondCounts;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 20 );
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
this.sendUpdate( 'isPlaying' );
|
|
||||||
} else if ( action === 'pause' ) {
|
|
||||||
this.$emit( 'update', { 'type': 'playback', 'status': false } );
|
|
||||||
musicPlayer.pause();
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
try {
|
|
||||||
clearInterval( this.progressTracker );
|
|
||||||
clearInterval( this.notifier );
|
|
||||||
} catch ( err ) {};
|
|
||||||
this.isPlaying = false;
|
|
||||||
this.sendUpdate( 'isPlaying' );
|
|
||||||
} else if ( action === 'replay10' ) {
|
|
||||||
musicPlayer.currentTime = musicPlayer.currentTime > 10 ? musicPlayer.currentTime - 10 : 0;
|
|
||||||
this.playbackPos = musicPlayer.currentTime;
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
} else if ( action === 'forward10' ) {
|
|
||||||
if ( musicPlayer.currentTime < ( musicPlayer.duration - 10 ) ) {
|
|
||||||
musicPlayer.currentTime = musicPlayer.currentTime + 10;
|
|
||||||
this.playbackPos = musicPlayer.currentTime;
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
} else {
|
|
||||||
if ( this.repeatMode !== 'one' ) {
|
|
||||||
this.control( 'next' );
|
|
||||||
} else {
|
|
||||||
musicPlayer.currentTime = 0;
|
|
||||||
this.playbackPos = musicPlayer.currentTime;
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ( action === 'reset' ) {
|
|
||||||
clearInterval( this.progressTracker );
|
|
||||||
this.playbackPos = 0;
|
|
||||||
musicPlayer.currentTime = 0;
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
} else if ( action === 'next' ) {
|
|
||||||
this.$emit( 'update', { 'type': 'next' } );
|
|
||||||
} else if ( action === 'previous' ) {
|
|
||||||
if ( this.playbackPos > 3 ) {
|
|
||||||
this.playbackPos = 0;
|
|
||||||
musicPlayer.currentTime = 0;
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
} else {
|
|
||||||
this.$emit( 'update', { 'type': 'previous' } );
|
|
||||||
}
|
|
||||||
} else if ( action === 'shuffleOff' ) {
|
|
||||||
this.$emit( 'update', { 'type': 'shuffleOff' } );
|
|
||||||
this.isShuffleEnabled = false;
|
|
||||||
} else if ( action === 'shuffleOn' ) {
|
|
||||||
this.$emit( 'update', { 'type': 'shuffle' } );
|
|
||||||
this.isShuffleEnabled = true;
|
|
||||||
} else if ( action === 'repeatOne' ) {
|
|
||||||
this.repeatMode = 'one';
|
|
||||||
} else if ( action === 'repeatAll' ) {
|
|
||||||
this.$emit( 'update', { 'type': 'repeat' } );
|
|
||||||
this.repeatMode = 'all';
|
|
||||||
} else if ( action === 'repeatOff' ) {
|
|
||||||
this.$emit( 'update', { 'type': 'repeatOff' } );
|
|
||||||
this.repeatMode = 'off';
|
|
||||||
} else if ( action === 'exitFancyView' ) {
|
|
||||||
this.isShowingFancyView = false;
|
|
||||||
this.$emit( 'update', { 'type': 'fancyView', 'status': false } );
|
|
||||||
}
|
|
||||||
} else if ( action === 'songsLoaded' ) {
|
|
||||||
this.$refs.notifications.createNotification( 'Songs loaded successfully', 5, 'ok', 'default' );
|
|
||||||
this.hasLoadedSongs = true;
|
|
||||||
} else if ( action === 'shuffleOff' ) {
|
|
||||||
this.$emit( 'update', { 'type': 'shuffleOff' } );
|
|
||||||
this.isShuffleEnabled = false;
|
|
||||||
} else if ( action === 'shuffleOn' ) {
|
|
||||||
this.$emit( 'update', { 'type': 'shuffle' } );
|
|
||||||
this.isShuffleEnabled = true;
|
|
||||||
} else if ( action === 'repeatOne' ) {
|
|
||||||
this.repeatMode = 'one';
|
|
||||||
} else if ( action === 'repeatAll' ) {
|
|
||||||
this.$emit( 'update', { 'type': 'repeat' } );
|
|
||||||
this.repeatMode = 'all';
|
|
||||||
} else if ( action === 'repeatOff' ) {
|
|
||||||
this.$emit( 'update', { 'type': 'repeatOff' } );
|
|
||||||
this.repeatMode = 'off';
|
|
||||||
} else if ( action === 'exitFancyView' ) {
|
|
||||||
this.isShowingFancyView = false;
|
|
||||||
this.$emit( 'update', { 'type': 'fancyView', 'status': false } );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setPos( pos ) {
|
|
||||||
let musicPlayer = document.getElementById( 'music-player' );
|
|
||||||
this.playbackPos = pos;
|
|
||||||
musicPlayer.currentTime = pos;
|
|
||||||
this.sendUpdate( 'pos' );
|
|
||||||
},
|
|
||||||
showFancyView() {
|
|
||||||
this.$emit( 'update', { 'type': 'fancyView', 'status': true } );
|
|
||||||
this.isShowingFancyView = true;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
document.addEventListener( 'keydown', ( e ) => {
|
|
||||||
if ( e.key === ' ' ) {
|
|
||||||
e.preventDefault();
|
|
||||||
if ( !this.isPlaying ) {
|
|
||||||
this.control( 'play' );
|
|
||||||
} else {
|
|
||||||
this.control( 'pause' );
|
|
||||||
}
|
|
||||||
} else if ( e.key === 'ArrowRight' ) {
|
|
||||||
e.preventDefault();
|
|
||||||
this.control( 'next' );
|
|
||||||
} else if ( e.key === 'ArrowLeft' ) {
|
|
||||||
e.preventDefault();
|
|
||||||
this.control( 'previous' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
fetch( 'http://localhost:8081/getLocalIP' ).then( res => {
|
|
||||||
if ( res.status === 200 ) {
|
|
||||||
res.text().then( ip => {
|
|
||||||
this.localIP = ip;
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
} ).catch( err => {
|
|
||||||
this.localIP = 'ERROR fetching';
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div style="width: 100%; height: 100%;">
|
|
||||||
<progress :id="'progress-slider-' + name" class="progress-slider" :value="sliderProgress" max="1000" @mousedown="( e ) => { setPos( e ) }"
|
|
||||||
:class="active ? '' : 'slider-inactive'"></progress>
|
|
||||||
<div v-if="active" id="slider-knob" @mousedown="( e ) => { startMove( e ) }"
|
|
||||||
:style="'left: ' + ( parseInt( originalPos ) + parseInt( sliderPos ) ) + 'px;'">
|
|
||||||
<div id="slider-knob-style"></div>
|
|
||||||
</div>
|
|
||||||
<div v-else id="slider-knob" class="slider-inactive" style="left: 0;">
|
|
||||||
<div id="slider-knob-style"></div>
|
|
||||||
</div>
|
|
||||||
<div id="drag-support" @mousemove="e => { handleDrag( e ) }" @mouseup="() => { stopMove(); }"></div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.progress-slider {
|
|
||||||
width: 100%;
|
|
||||||
margin: 0;
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
height: 5px;
|
|
||||||
cursor: pointer;
|
|
||||||
background-color: #baf4c9;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress-slider::-webkit-progress-value {
|
|
||||||
background-color: #baf4c9;
|
|
||||||
}
|
|
||||||
|
|
||||||
#slider-knob {
|
|
||||||
height: 20px;
|
|
||||||
width: 10px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: flex-end;
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 2;
|
|
||||||
cursor: grab;
|
|
||||||
}
|
|
||||||
|
|
||||||
#slider-knob-style {
|
|
||||||
background-color: #baf4c9;
|
|
||||||
height: 15px;
|
|
||||||
width: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#drag-support {
|
|
||||||
display: none;
|
|
||||||
opacity: 0;
|
|
||||||
height: 100vh;
|
|
||||||
width: 100vw;
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 10;
|
|
||||||
cursor: grabbing;
|
|
||||||
}
|
|
||||||
|
|
||||||
.drag-support-active {
|
|
||||||
display: block !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.slider-inactive {
|
|
||||||
cursor: default !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
props: {
|
|
||||||
style: {
|
|
||||||
type: Object,
|
|
||||||
},
|
|
||||||
position: {
|
|
||||||
type: Number,
|
|
||||||
default: 0,
|
|
||||||
},
|
|
||||||
duration: {
|
|
||||||
type: Number,
|
|
||||||
default: 100
|
|
||||||
},
|
|
||||||
active: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: String,
|
|
||||||
default: '1',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
offset: 0,
|
|
||||||
isDragging: false,
|
|
||||||
sliderPos: 0,
|
|
||||||
originalPos: 0,
|
|
||||||
sliderProgress: 0,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleDrag( e ) {
|
|
||||||
if ( this.isDragging ) {
|
|
||||||
if ( 0 < this.originalPos + e.screenX - this.offset && this.originalPos + e.screenX - this.offset < document.getElementById( 'progress-slider-' + this.name ).clientWidth - 5 ) {
|
|
||||||
this.sliderPos = e.screenX - this.offset;
|
|
||||||
this.calcProgressPos();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
startMove( e ) {
|
|
||||||
this.offset = e.screenX;
|
|
||||||
this.isDragging = true;
|
|
||||||
document.getElementById( 'drag-support' ).classList.add( 'drag-support-active' );
|
|
||||||
},
|
|
||||||
stopMove() {
|
|
||||||
this.originalPos += parseInt( this.sliderPos );
|
|
||||||
this.isDragging = false;
|
|
||||||
this.offset = 0;
|
|
||||||
this.sliderPos = 0;
|
|
||||||
document.getElementById( 'drag-support' ).classList.remove( 'drag-support-active' );
|
|
||||||
this.calcPlaybackPos();
|
|
||||||
},
|
|
||||||
setPos ( e ) {
|
|
||||||
if ( this.active ) {
|
|
||||||
this.originalPos = e.offsetX;
|
|
||||||
this.calcProgressPos();
|
|
||||||
this.calcPlaybackPos();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
calcProgressPos() {
|
|
||||||
this.sliderProgress = Math.ceil( ( this.originalPos + parseInt( this.sliderPos ) ) / ( document.getElementById( 'progress-slider-' + this.name ).clientWidth - 5 ) * 1000 );
|
|
||||||
},
|
|
||||||
calcPlaybackPos() {
|
|
||||||
this.$emit( 'pos', Math.round( ( this.originalPos + parseInt( this.sliderPos ) ) / ( document.getElementById( 'progress-slider-' + this.name ).clientWidth - 5 ) * this.duration ) );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
position() {
|
|
||||||
if ( !this.isDragging ) {
|
|
||||||
this.sliderProgress = Math.ceil( this.position / this.duration * 1000 + 2 );
|
|
||||||
this.originalPos = Math.ceil( this.position / this.duration * ( document.getElementById( 'progress-slider-' + this.name ).scrollWidth - 5 ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"connectionURL": "http://localhost:3000",
|
|
||||||
"authKey": "gaöwovwef89voawö8p9 odövefw8öoaewpf89wec",
|
|
||||||
"doConnect": true
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* MusicPlayerV2 - imageFetcher.js
|
|
||||||
*
|
|
||||||
* Created by Janis Hutz 10/23/2023, Licensed under the GPL V3 License
|
|
||||||
* https://janishutz.com, development@janishutz.com
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
const MusicKit = require( 'node-musickit-api' );
|
|
||||||
const fs = require( 'fs' );
|
|
||||||
const path = require( 'path' );
|
|
||||||
|
|
||||||
// TODO: deploy non-secret version
|
|
||||||
const settings = JSON.parse( fs.readFileSync( path.join( __dirname + '/config/apple-music-api.config.json' ) ) );
|
|
||||||
|
|
||||||
const music = new MusicKit( {
|
|
||||||
key: fs.readFileSync( path.join( __dirname + '/config/apple_private_key.p8' ) ).toString(),
|
|
||||||
teamId: settings.teamID,
|
|
||||||
keyId: settings.keyID
|
|
||||||
} );
|
|
||||||
|
|
||||||
module.exports.fetch = ( type, searchQuery, callback ) => {
|
|
||||||
music.search( settings.storefront, type, searchQuery, ( err, data ) => {
|
|
||||||
if ( err ) {
|
|
||||||
callback( err, null );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
callback( null, data );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
@@ -1,214 +0,0 @@
|
|||||||
/*
|
|
||||||
* MusicPlayerV2 - indexer.js
|
|
||||||
*
|
|
||||||
* Created by Janis Hutz 11/05/2023, Licensed under the GPL V3 License
|
|
||||||
* https://janishutz.com, development@janishutz.com
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
const fs = require( 'fs' );
|
|
||||||
const imageFetcher = require( './imageFetcher.js' );
|
|
||||||
const musicMetadata = require( 'music-metadata' );
|
|
||||||
const allowedFileTypes = [ '.mp3', '.wav', '.flac' ];
|
|
||||||
const csv = require( 'csv-parser' );
|
|
||||||
const path = require( 'path' );
|
|
||||||
|
|
||||||
let coverArtIndex = {};
|
|
||||||
|
|
||||||
module.exports.index = ( req ) => {
|
|
||||||
return new Promise( ( resolve, reject ) => {
|
|
||||||
fs.readdir( req.query.dir, { encoding: 'utf-8' }, ( err, dat ) => {
|
|
||||||
if ( err ) {
|
|
||||||
reject( 'ERR_DIR_NOT_FOUND' );
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
( async() => {
|
|
||||||
// Check for songlist.csv or songlist.json file and use the data provided there for each song to override
|
|
||||||
// what was found automatically. If no song title was found in songlist or metadata, use filename
|
|
||||||
// additionally check if dir has been indexed (songs.json file)
|
|
||||||
if ( dat.includes( 'songs.json' ) ) {
|
|
||||||
parseExistingData( dat, req.query.dir ).then( data => {
|
|
||||||
resolve( data );
|
|
||||||
} ).catch( err => {
|
|
||||||
reject( err );
|
|
||||||
} );
|
|
||||||
} else if ( dat.includes( 'songlist.csv' ) || dat.includes( 'songlist.json' ) ) {
|
|
||||||
parseExistingData( dat, req.query.dir ).then( data => {
|
|
||||||
parseDir( dat, req, data ).then( indexedDir => {
|
|
||||||
resolve( indexedDir );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
} else {
|
|
||||||
resolve( await parseDir( dat, req ) );
|
|
||||||
}
|
|
||||||
} )();
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports.getImages = ( filename ) => {
|
|
||||||
return coverArtIndex[ filename ];
|
|
||||||
};
|
|
||||||
|
|
||||||
const parseExistingData = ( dat, dir ) => {
|
|
||||||
return new Promise( ( resolve, reject ) => {
|
|
||||||
if ( dat.includes( 'songs.json' ) ) {
|
|
||||||
resolve( JSON.parse( fs.readFileSync( path.join( dir + '/songs.json' ) ) ) );
|
|
||||||
} else if ( dat.includes( 'songlist.csv' ) ) {
|
|
||||||
// This will assume that line #1 will be song #1 in the file list
|
|
||||||
// (when sorted by name)
|
|
||||||
let results = {};
|
|
||||||
let pos = 0;
|
|
||||||
fs.createReadStream( path.join( dir + '/songlist.csv' ) )
|
|
||||||
.pipe( csv() )
|
|
||||||
.on( 'data', ( data ) => {
|
|
||||||
results[ dir + '/' + dat[ pos ] ] = data;
|
|
||||||
pos += 1;
|
|
||||||
} ).on( 'end', () => {
|
|
||||||
resolve( results );
|
|
||||||
} );
|
|
||||||
} else if ( dat.includes( 'songlist.json' ) ) {
|
|
||||||
resolve( JSON.parse( fs.readFileSync( path.join( dir + '/songlist.json' ) ) ) );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports.analyzeFile = async ( filepath ) => {
|
|
||||||
let metadata = await musicMetadata.parseFile( filepath );
|
|
||||||
return {
|
|
||||||
'artist': metadata[ 'common' ][ 'artist' ],
|
|
||||||
'title': metadata[ 'common' ][ 'title' ],
|
|
||||||
'year': metadata[ 'common' ][ 'year' ],
|
|
||||||
'bpm': metadata[ 'common' ][ 'bpm' ],
|
|
||||||
'genre': metadata[ 'common' ][ 'genre' ],
|
|
||||||
'duration': Math.round( metadata[ 'format' ][ 'duration' ] ),
|
|
||||||
'isLossless': metadata[ 'format' ][ 'lossless' ],
|
|
||||||
'sampleRate': metadata[ 'format' ][ 'sampleRate' ],
|
|
||||||
'bitrate': metadata[ 'format' ][ 'bitrate' ],
|
|
||||||
'numberOfChannels': metadata[ 'format' ][ 'numberOfChannels' ],
|
|
||||||
'container': metadata[ 'format' ][ 'container' ],
|
|
||||||
'filename': filepath,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hasCompletedFetching = {};
|
|
||||||
let files = {};
|
|
||||||
const parseDir = ( dat, req, existingData ) => {
|
|
||||||
return new Promise( ( resolve, reject ) => {
|
|
||||||
( async() => {
|
|
||||||
files = {};
|
|
||||||
for ( let file in dat ) {
|
|
||||||
if ( allowedFileTypes.includes( dat[ file ].slice( dat[ file ].indexOf( '.' ), dat[ file ].length ) ) ) {
|
|
||||||
try {
|
|
||||||
let metadata = await musicMetadata.parseFile( req.query.dir + '/' + dat[ file ] );
|
|
||||||
files[ req.query.dir + '/' + dat[ file ] ] = {
|
|
||||||
'artist': metadata[ 'common' ][ 'artist' ],
|
|
||||||
'title': metadata[ 'common' ][ 'title' ],
|
|
||||||
'year': metadata[ 'common' ][ 'year' ],
|
|
||||||
'bpm': metadata[ 'common' ][ 'bpm' ],
|
|
||||||
'genre': metadata[ 'common' ][ 'genre' ],
|
|
||||||
'duration': Math.round( metadata[ 'format' ][ 'duration' ] ),
|
|
||||||
'isLossless': metadata[ 'format' ][ 'lossless' ],
|
|
||||||
'sampleRate': metadata[ 'format' ][ 'sampleRate' ],
|
|
||||||
'bitrate': metadata[ 'format' ][ 'bitrate' ],
|
|
||||||
'numberOfChannels': metadata[ 'format' ][ 'numberOfChannels' ],
|
|
||||||
'container': metadata[ 'format' ][ 'container' ],
|
|
||||||
'filename': req.query.dir + '/' + dat[ file ],
|
|
||||||
'coverArtOrigin': req.query.coverart ?? 'none',
|
|
||||||
}
|
|
||||||
runReplace( existingData, req.query.dir + '/' + dat[ file ], req.query.doOverride ?? false );
|
|
||||||
if ( req.query.coverart == 'meta' ) {
|
|
||||||
if ( metadata[ 'common' ][ 'picture' ] ) {
|
|
||||||
files[ req.query.dir + '/' + dat[ file ] ][ 'hasCoverArt' ] = true;
|
|
||||||
coverArtIndex[ req.query.dir + '/' + dat[ file ] ] = metadata[ 'common' ][ 'picture' ] ? metadata[ 'common' ][ 'picture' ][ 0 ][ 'data' ] : undefined;
|
|
||||||
} else {
|
|
||||||
files[ req.query.dir + '/' + dat[ file ] ][ 'hasCoverArt' ] = false;
|
|
||||||
}
|
|
||||||
hasCompletedFetching[ req.query.dir + '/' + dat[ file ] ] = true;
|
|
||||||
} else if ( req.query.coverart == 'api' ) {
|
|
||||||
hasCompletedFetching[ req.query.dir + '/' + dat[ file ] ] = false;
|
|
||||||
fetchImages( metadata[ 'common' ][ 'title' ], metadata[ 'common' ][ 'artist' ], metadata[ 'common' ][ 'year' ], req.query.dir, dat[ file ] );
|
|
||||||
} else {
|
|
||||||
files[ req.query.dir + '/' + dat[ file ] ][ 'hasCoverArt' ] = false;
|
|
||||||
}
|
|
||||||
} catch ( err ) {
|
|
||||||
console.error( err );
|
|
||||||
files[ req.query.dir + '/' + dat[ file ] ] = 'ERROR';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let ok = false;
|
|
||||||
let waiter = setInterval( () => {
|
|
||||||
for ( let song in hasCompletedFetching ) {
|
|
||||||
if ( !hasCompletedFetching[ song ] ) {
|
|
||||||
ok = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( ok ) {
|
|
||||||
saveToDisk( req.query.dir );
|
|
||||||
clearInterval( waiter );
|
|
||||||
resolve( files );
|
|
||||||
}
|
|
||||||
ok = true;
|
|
||||||
}, 250 );
|
|
||||||
} )();
|
|
||||||
} )
|
|
||||||
};
|
|
||||||
|
|
||||||
const runReplace = ( existingData, currentFile, doOverride ) => {
|
|
||||||
for ( let param in existingData[ currentFile ] ) {
|
|
||||||
if ( !files[ currentFile ][ param ] || doOverride ) {
|
|
||||||
files[ currentFile ][ param ] = existingData[ currentFile ][ param ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let imageQueue = [];
|
|
||||||
let runInterval = null;
|
|
||||||
const fetchImages = ( title, artist, year, dir, filename ) => {
|
|
||||||
imageQueue.push( { 'title': title, 'artist': artist, 'year': year, 'dir': dir, 'filename': filename } );
|
|
||||||
if ( runInterval === null ) {
|
|
||||||
runInterval = setInterval( () => {
|
|
||||||
if ( imageQueue.length > 0 ) {
|
|
||||||
const cur = imageQueue.reverse().pop();
|
|
||||||
imageQueue.reverse();
|
|
||||||
runFetch( cur.title, cur.artist, cur.year, cur.dir, cur.filename );
|
|
||||||
} else {
|
|
||||||
clearInterval( runInterval );
|
|
||||||
runInterval = null;
|
|
||||||
}
|
|
||||||
}, 100 );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const runFetch = ( title, artist, year, dir, filename ) => {
|
|
||||||
imageFetcher.fetch( 'songs', ( artist ?? '' ) + ' ' + ( title ?? '' ) + ' ' + ( year ?? '' ), ( err, data ) => {
|
|
||||||
if ( err ) {
|
|
||||||
files[ dir + '/' + filename ][ 'hasCoverArt' ] = false;
|
|
||||||
console.error( dir + '/' + filename );
|
|
||||||
console.error( err );
|
|
||||||
hasCompletedFetching[ dir + '/' + filename ] = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( data.results.songs ) {
|
|
||||||
if ( data.results.songs.data ) {
|
|
||||||
let url = data.results.songs.data[ 0 ].attributes.artwork.url;
|
|
||||||
url = url.replace( '{w}', data.results.songs.data[ 0 ].attributes.artwork.width );
|
|
||||||
url = url.replace( '{h}', data.results.songs.data[ 0 ].attributes.artwork.height );
|
|
||||||
files[ dir + '/' + filename ][ 'coverArtURL' ] = url;
|
|
||||||
files[ dir + '/' + filename ][ 'hasCoverArt' ] = true;
|
|
||||||
} else {
|
|
||||||
files[ dir + '/' + filename ][ 'hasCoverArt' ] = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
files[ dir + '/' + filename ][ 'hasCoverArt' ] = false;
|
|
||||||
}
|
|
||||||
hasCompletedFetching[ dir + '/' + filename ] = true;
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const saveToDisk = ( dir ) => {
|
|
||||||
fs.writeFileSync( path.join( dir + '/songs.json' ), JSON.stringify( files ) );
|
|
||||||
};
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import { createApp } from 'vue'
|
|
||||||
import App from './App.vue'
|
|
||||||
import router from './router'
|
|
||||||
|
|
||||||
createApp(App).use(router).mount('#app')
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
import { createRouter, createWebHistory } from 'vue-router'
|
|
||||||
import HomeView from '../views/HomeView.vue'
|
|
||||||
|
|
||||||
const routes = [
|
|
||||||
{
|
|
||||||
path: '/',
|
|
||||||
name: 'home',
|
|
||||||
component: HomeView
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
const router = createRouter({
|
|
||||||
history: createWebHistory(process.env.BASE_URL),
|
|
||||||
routes
|
|
||||||
})
|
|
||||||
|
|
||||||
export default router
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="home">
|
|
||||||
<div class="top-bar">
|
|
||||||
<img src="@/assets/logo.png" alt="logo" class="logo">
|
|
||||||
<div class="player-wrapper">
|
|
||||||
<Player ref="player" @update="( info ) => { handleUpdates( info ) }"></Player>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="pool-wrapper">
|
|
||||||
<mediaPool @com="( info ) => { handleCom( info ) }" ref="pool"></mediaPool>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.home {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pool-wrapper {
|
|
||||||
height: 84vh;
|
|
||||||
margin-top: 16vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-bar {
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
position: fixed;
|
|
||||||
z-index: 8;
|
|
||||||
width: 99%;
|
|
||||||
height: 15vh;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: row;
|
|
||||||
border: var( --primary-color ) 2px solid;
|
|
||||||
background-color: var( --background-color );
|
|
||||||
}
|
|
||||||
|
|
||||||
.player-wrapper {
|
|
||||||
width: 70vw;
|
|
||||||
margin-right: auto;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
height: 13vh;
|
|
||||||
margin-left: 3%;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import mediaPool from '@/components/mediaPool.vue';
|
|
||||||
import Player from '@/components/player.vue';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'HomeView',
|
|
||||||
components: {
|
|
||||||
mediaPool,
|
|
||||||
Player,
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hasLoadedSongs: false,
|
|
||||||
songQueue: [],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleCom ( data ) {
|
|
||||||
if ( data.type === 'startPlayback' ) {
|
|
||||||
this.$refs.player.play( data.song, data.autoplay === undefined ? true : data.autoplay );
|
|
||||||
} else {
|
|
||||||
this.$refs.player.control( data.type );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleUpdates ( data ) {
|
|
||||||
this.$refs.pool.update( data );
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
const { defineConfig } = require('@vue/cli-service')
|
|
||||||
module.exports = defineConfig({
|
|
||||||
transpileDependencies: true,
|
|
||||||
pluginOptions: {
|
|
||||||
electronBuilder: {
|
|
||||||
nodeIntegration: true,
|
|
||||||
"appId": "com.janishutz.MusicPlayerV2",
|
|
||||||
"copyright": "Copyright (c) 2023 MusicPlayer contributors",
|
|
||||||
"buildVersion": "V2.0.0-dev2",
|
|
||||||
builderOptions: {
|
|
||||||
files: [
|
|
||||||
"**/*",
|
|
||||||
{
|
|
||||||
from: "./*",
|
|
||||||
to: "./*",
|
|
||||||
filter: [ "**/*" ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
from: "./public/*",
|
|
||||||
to: "./*",
|
|
||||||
filter: [ "**/*" ]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
extraFiles: [
|
|
||||||
{
|
|
||||||
from: "./src/client",
|
|
||||||
to: "./client",
|
|
||||||
filter: [ "**/*" ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
from: "./src/config",
|
|
||||||
to: "./config",
|
|
||||||
filter: [ "*.config.json" ]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "MusicPlayer",
|
||||||
|
"version": "3.0.0",
|
||||||
|
"private": false
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
cd frontend/
|
|
||||||
npm i
|
|
||||||
|
|
||||||
npm run electron:build -- --linux deb rpm --win nsis
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
zip -9r musicplayerv2-server.zip backend
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
FROM node:25-alpine3.21 AS build
|
||||||
|
|
||||||
|
# Frontend Build stage
|
||||||
|
WORKDIR /usr/src/build
|
||||||
|
|
||||||
|
COPY . /usr/src/build
|
||||||
|
|
||||||
|
RUN npm i
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Build final image
|
||||||
|
FROM nginx AS prod
|
||||||
|
COPY --from=build /usr/src/build/dist /usr/share/nginx/html
|
||||||
|
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||||
|
EXPOSE 3000
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# MusicPlayer Webapp
|
||||||
|
More notes to come
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
||||||
Generated
+744
@@ -0,0 +1,744 @@
|
|||||||
|
import eslint from '@eslint/js';
|
||||||
|
import globals from 'globals';
|
||||||
|
import stylistic from '@stylistic/eslint-plugin';
|
||||||
|
import tseslint from 'typescript-eslint';
|
||||||
|
import typescript from '@typescript-eslint/eslint-plugin';
|
||||||
|
import vue from 'eslint-plugin-vue';
|
||||||
|
|
||||||
|
const style = {
|
||||||
|
'plugins': {
|
||||||
|
'@stylistic': stylistic,
|
||||||
|
'@stylistic/js': stylistic,
|
||||||
|
'@stylistic/ts': stylistic
|
||||||
|
},
|
||||||
|
'files': [
|
||||||
|
'**/*.ts',
|
||||||
|
'**/*.js',
|
||||||
|
'**/*.mjs',
|
||||||
|
'**/*.cjs',
|
||||||
|
'**/*.tsx',
|
||||||
|
'**/*.jsx'
|
||||||
|
],
|
||||||
|
'rules': {
|
||||||
|
'sort-imports': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
'ignoreCase': false,
|
||||||
|
'ignoreDeclarationSort': false,
|
||||||
|
'ignoreMemberSort': false,
|
||||||
|
'memberSyntaxSortOrder': [
|
||||||
|
'none',
|
||||||
|
'all',
|
||||||
|
'multiple',
|
||||||
|
'single'
|
||||||
|
],
|
||||||
|
'allowSeparatedGroups': false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// Formatting
|
||||||
|
'@stylistic/array-bracket-newline': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'multiline': false,
|
||||||
|
'minItems': 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/array-bracket-spacing': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/array-element-newline': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'consistent': false,
|
||||||
|
'multiline': false,
|
||||||
|
'minItems': 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/arrow-parens': [
|
||||||
|
'error',
|
||||||
|
'as-needed'
|
||||||
|
],
|
||||||
|
'@stylistic/arrow-spacing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'before': true,
|
||||||
|
'after': true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/block-spacing': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/brace-style': [
|
||||||
|
'error',
|
||||||
|
'1tbs',
|
||||||
|
{
|
||||||
|
'allowSingleLine': false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/comma-dangle': [
|
||||||
|
'error',
|
||||||
|
'never'
|
||||||
|
],
|
||||||
|
'@stylistic/comma-spacing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'before': false,
|
||||||
|
'after': true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/comma-style': [
|
||||||
|
'error',
|
||||||
|
'last'
|
||||||
|
],
|
||||||
|
'@stylistic/dot-location': [
|
||||||
|
'error',
|
||||||
|
'property'
|
||||||
|
],
|
||||||
|
'@stylistic/function-call-argument-newline': [
|
||||||
|
'error',
|
||||||
|
'consistent'
|
||||||
|
],
|
||||||
|
'@stylistic/function-call-spacing': [
|
||||||
|
'error',
|
||||||
|
'never'
|
||||||
|
],
|
||||||
|
'@stylistic/function-paren-newline': [
|
||||||
|
'error',
|
||||||
|
'multiline-arguments'
|
||||||
|
],
|
||||||
|
'@stylistic/implicit-arrow-linebreak': [
|
||||||
|
'error',
|
||||||
|
'beside'
|
||||||
|
],
|
||||||
|
'@stylistic/indent': [
|
||||||
|
'error',
|
||||||
|
4
|
||||||
|
],
|
||||||
|
'@stylistic/indent-binary-ops': [
|
||||||
|
'error',
|
||||||
|
4
|
||||||
|
],
|
||||||
|
'@stylistic/key-spacing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'beforeColon': false,
|
||||||
|
'afterColon': true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/keyword-spacing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'before': true,
|
||||||
|
'after': true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/lines-between-class-members': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/max-len': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
'code': 140,
|
||||||
|
'comments': 160,
|
||||||
|
'ignoreComments': false,
|
||||||
|
'ignoreUrls': true,
|
||||||
|
'ignoreStrings': true,
|
||||||
|
'ignoreTemplateLiterals': true,
|
||||||
|
'ignoreRegExpLiterals': true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/max-statements-per-line': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'max': 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/multiline-ternary': [
|
||||||
|
'error',
|
||||||
|
'always-multiline'
|
||||||
|
],
|
||||||
|
'@stylistic/new-parens': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/newline-per-chained-call': 'error',
|
||||||
|
'@stylistic/no-confusing-arrow': 'error',
|
||||||
|
'@stylistic/no-extra-parens': [
|
||||||
|
'error',
|
||||||
|
'all',
|
||||||
|
{
|
||||||
|
'nestedBinaryExpressions': false,
|
||||||
|
'ternaryOperandBinaryExpressions': false,
|
||||||
|
'ignoreJSX': 'multi-line',
|
||||||
|
'nestedConditionalExpressions': false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/no-extra-semi': 'error',
|
||||||
|
'@stylistic/no-floating-decimal': 'error',
|
||||||
|
'@stylistic/no-mixed-operators': 'error',
|
||||||
|
'@stylistic/no-mixed-spaces-and-tabs': 'error',
|
||||||
|
'@stylistic/no-multi-spaces': 'error',
|
||||||
|
'@stylistic/no-multiple-empty-lines': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'max': 3,
|
||||||
|
'maxEOF': 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/no-tabs': 'error',
|
||||||
|
'@stylistic/no-trailing-spaces': 'error',
|
||||||
|
'@stylistic/no-whitespace-before-property': 'error',
|
||||||
|
'@stylistic/object-curly-newline': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'multiline': true,
|
||||||
|
'minProperties': 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/object-curly-spacing': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/object-property-newline': 'error',
|
||||||
|
'@stylistic/one-var-declaration-per-line': 'error',
|
||||||
|
'@stylistic/operator-linebreak': [
|
||||||
|
'error',
|
||||||
|
'before'
|
||||||
|
],
|
||||||
|
'@stylistic/padded-blocks': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'blocks': 'never',
|
||||||
|
'classes': 'always',
|
||||||
|
'switches': 'never'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
// Padding lines. The most in-depth part of this config
|
||||||
|
'@stylistic/padding-line-between-statements': [
|
||||||
|
'error',
|
||||||
|
// Variables, Constants
|
||||||
|
{
|
||||||
|
'blankLine': 'never',
|
||||||
|
'prev': 'var',
|
||||||
|
'next': 'var'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'never',
|
||||||
|
'prev': 'let',
|
||||||
|
'next': 'let'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'never',
|
||||||
|
'prev': 'const',
|
||||||
|
'next': 'const'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'var',
|
||||||
|
'next': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'cjs-import',
|
||||||
|
'class',
|
||||||
|
'const',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'import',
|
||||||
|
'let',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'with'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'let',
|
||||||
|
'next': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'cjs-import',
|
||||||
|
'class',
|
||||||
|
'const',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'import',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'while',
|
||||||
|
'with'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'const',
|
||||||
|
'next': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'cjs-import',
|
||||||
|
'class',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'import',
|
||||||
|
'let',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'while',
|
||||||
|
'with'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// Import
|
||||||
|
{
|
||||||
|
'blankLine': 'never',
|
||||||
|
'prev': 'import',
|
||||||
|
'next': 'import'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'never',
|
||||||
|
'prev': 'cjs-import',
|
||||||
|
'next': 'cjs-import'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'class',
|
||||||
|
'const',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'let',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'while',
|
||||||
|
'with'
|
||||||
|
],
|
||||||
|
'next': 'cjs-import'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'cjs-import',
|
||||||
|
'next': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'class',
|
||||||
|
'const',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'let',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'while',
|
||||||
|
'with'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'class',
|
||||||
|
'const',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'let',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'while',
|
||||||
|
'with'
|
||||||
|
],
|
||||||
|
'next': 'import'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'import',
|
||||||
|
'next': [
|
||||||
|
'block',
|
||||||
|
'block-like',
|
||||||
|
'break',
|
||||||
|
'cjs-export',
|
||||||
|
'class',
|
||||||
|
'const',
|
||||||
|
'continue',
|
||||||
|
'debugger',
|
||||||
|
'directive',
|
||||||
|
'do',
|
||||||
|
'empty',
|
||||||
|
'export',
|
||||||
|
'expression',
|
||||||
|
'for',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'iife',
|
||||||
|
'let',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
'var',
|
||||||
|
'while',
|
||||||
|
'with'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// If
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'if'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'if',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// For
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'for'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'for',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// While
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'while'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'while',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Functions
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'function'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'function',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Block Statements
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'block-like'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'block-like',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Switch
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'switch'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'switch',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Try-Catch
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'try'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'try',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Throw
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'throw'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'throw',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Return
|
||||||
|
{
|
||||||
|
'blankLine': 'never',
|
||||||
|
'prev': 'return',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'return'
|
||||||
|
},
|
||||||
|
// Export
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'export'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'export',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'cjs-export'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'cjs-export',
|
||||||
|
'next': '*'
|
||||||
|
},
|
||||||
|
// Classes
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': '*',
|
||||||
|
'next': 'class'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'blankLine': 'always',
|
||||||
|
'prev': 'class',
|
||||||
|
'next': '*'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/quote-props': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/quotes': [
|
||||||
|
'error',
|
||||||
|
'single'
|
||||||
|
],
|
||||||
|
'@stylistic/rest-spread-spacing': [
|
||||||
|
'error',
|
||||||
|
'never'
|
||||||
|
],
|
||||||
|
'@stylistic/semi': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/semi-spacing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'before': false,
|
||||||
|
'after': true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/semi-style': [
|
||||||
|
'error',
|
||||||
|
'last'
|
||||||
|
],
|
||||||
|
'@stylistic/space-before-blocks': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/space-before-function-paren': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/space-in-parens': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/space-infix-ops': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'int32Hint': false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@stylistic/space-unary-ops': 'error',
|
||||||
|
'@stylistic/spaced-comment': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/switch-colon-spacing': 'error',
|
||||||
|
'@stylistic/template-curly-spacing': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/template-tag-spacing': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'@stylistic/type-generic-spacing': 'error',
|
||||||
|
'@stylistic/type-named-tuple-spacing': 'error',
|
||||||
|
'@stylistic/wrap-iife': [
|
||||||
|
'error',
|
||||||
|
'inside'
|
||||||
|
],
|
||||||
|
'@stylistic/wrap-regex': 'error',
|
||||||
|
'@stylistic/ts/type-annotation-spacing': 'error'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @type {import('eslint').Linter.Config} */
|
||||||
|
export default tseslint.config(
|
||||||
|
// Base JavaScript rules
|
||||||
|
eslint.configs.recommended,
|
||||||
|
tseslint.configs.recommended,
|
||||||
|
style,
|
||||||
|
|
||||||
|
// Vue support (including TS and JSX inside SFCs)
|
||||||
|
{
|
||||||
|
'files': [ '**/*.vue' ],
|
||||||
|
'languageOptions': {
|
||||||
|
'sourceType': 'module',
|
||||||
|
'ecmaVersion': 'latest',
|
||||||
|
'globals': globals.browser,
|
||||||
|
'parserOptions': {
|
||||||
|
'parser': tseslint.parser
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'plugins': {
|
||||||
|
'vue': vue,
|
||||||
|
'@stylistic': stylistic,
|
||||||
|
'@stylistic/js': stylistic,
|
||||||
|
'@stylistic/ts': stylistic,
|
||||||
|
'@typescript-eslint': typescript
|
||||||
|
},
|
||||||
|
'extends': [
|
||||||
|
eslint.configs.recommended,
|
||||||
|
...vue.configs['flat/recommended']
|
||||||
|
],
|
||||||
|
'rules': {
|
||||||
|
...typescript.configs.recommended.rules,
|
||||||
|
...style.rules,
|
||||||
|
|
||||||
|
// Vue specific rules
|
||||||
|
'@stylistic/indent': 'off',
|
||||||
|
'vue/html-indent': [
|
||||||
|
'error',
|
||||||
|
4
|
||||||
|
],
|
||||||
|
'vue/html-comment-indent': [
|
||||||
|
'error',
|
||||||
|
4
|
||||||
|
],
|
||||||
|
'vue/script-indent': [
|
||||||
|
'error',
|
||||||
|
4,
|
||||||
|
{
|
||||||
|
'baseIndent': 1,
|
||||||
|
'switchCase': 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'vue/html-self-closing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'html': {
|
||||||
|
'void': 'never',
|
||||||
|
'normal': 'never',
|
||||||
|
'component': 'always'
|
||||||
|
},
|
||||||
|
'svg': 'always',
|
||||||
|
'math': 'never'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'vue/max-attributes-per-line': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'singleline': 3,
|
||||||
|
'multiline': 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<link rel="icon" href="/favicon.ico">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>MusicPlayer</title>
|
||||||
|
<script src="https://js-cdn.music.apple.com/musickit/v3/musickit.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<noscript>This application requires JavaScript to work!</noscript>
|
||||||
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"name": "vue-project",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "run-p type-check \"build-only {@}\" --",
|
||||||
|
"preview": "vite preview",
|
||||||
|
"build-only": "vite build",
|
||||||
|
"type-check": "vue-tsc --build"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@fortawesome/fontawesome-free": "^7.3.1",
|
||||||
|
"@fortawesome/fontawesome-svg-core": "^7.3.1",
|
||||||
|
"@fortawesome/free-regular-svg-icons": "^7.3.1",
|
||||||
|
"@globalhive/vuejs-tour": "^3.0.1",
|
||||||
|
"@janishutz/login-sdk-browser": "^1.1.0",
|
||||||
|
"@kyvg/vue3-notification": "^3.4.2",
|
||||||
|
"music-metadata": "^11.15.0",
|
||||||
|
"nprogress": "^0.2.0",
|
||||||
|
"pinia": "^4.0.2",
|
||||||
|
"vue": "^3.5.40",
|
||||||
|
"vue-router": "^5.2.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^10.0.1",
|
||||||
|
"@stylistic/eslint-plugin": "^5.10.0",
|
||||||
|
"@tsconfig/node24": "^24.0.4",
|
||||||
|
"@types/node": "^24.13.3",
|
||||||
|
"@vitejs/plugin-vue": "^6.0.8",
|
||||||
|
"@vue/tsconfig": "^0.9.1",
|
||||||
|
"eslint": "^10.9.1",
|
||||||
|
"eslint-plugin-vue": "^10.10.0",
|
||||||
|
"globals": "^17.12.0",
|
||||||
|
"musickitjs-v3-types": "^1.2.1",
|
||||||
|
"npm-run-all2": "^9.0.2",
|
||||||
|
"sass-embedded": "^1.103.1",
|
||||||
|
"typescript": "~6.0.0",
|
||||||
|
"typescript-eslint": "^8.69.0",
|
||||||
|
"vite": "^8.1.5",
|
||||||
|
"vite-plugin-vue-devtools": "^8.1.5",
|
||||||
|
"vue-tsc": "^3.3.7"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^22.18.0 || >=24.12.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,193 @@
|
|||||||
|
{
|
||||||
|
"ages": {
|
||||||
|
"below": "Orange",
|
||||||
|
"16-18": "Yellow",
|
||||||
|
"18+": "Turquoise"
|
||||||
|
},
|
||||||
|
"offering": {
|
||||||
|
"big-bar": {
|
||||||
|
"offering": {
|
||||||
|
"softdrinks": {
|
||||||
|
"name": "Softdrinks",
|
||||||
|
"price": 400,
|
||||||
|
"id": "softdrinks"
|
||||||
|
},
|
||||||
|
"energy": {
|
||||||
|
"name": "Energy",
|
||||||
|
"price": 400,
|
||||||
|
"id": "energy"
|
||||||
|
},
|
||||||
|
"mate": {
|
||||||
|
"name": "Mate",
|
||||||
|
"price": 500,
|
||||||
|
"id": "mate",
|
||||||
|
"depot": 200
|
||||||
|
},
|
||||||
|
"sparkly-water": {
|
||||||
|
"name": "Mineralwasser mit",
|
||||||
|
"price": 300,
|
||||||
|
"id": "sparkly-water",
|
||||||
|
"showLine": true
|
||||||
|
},
|
||||||
|
"rose": {
|
||||||
|
"name": "Rosé",
|
||||||
|
"price": 1500,
|
||||||
|
"id": "rose",
|
||||||
|
"depot": 200
|
||||||
|
},
|
||||||
|
"red": {
|
||||||
|
"name": "Rotwein",
|
||||||
|
"price": 2000,
|
||||||
|
"id": "red",
|
||||||
|
"depot": 200
|
||||||
|
},
|
||||||
|
"wine-glasses": {
|
||||||
|
"name": "Weingläser",
|
||||||
|
"price": 0,
|
||||||
|
"id": "wine-glasses",
|
||||||
|
"depot": 200
|
||||||
|
},
|
||||||
|
"appenzeller": {
|
||||||
|
"name": "Appenzeller Vollmond",
|
||||||
|
"price": 500,
|
||||||
|
"id": "appenzeller",
|
||||||
|
"depot": 200
|
||||||
|
},
|
||||||
|
"feldschloesschen": {
|
||||||
|
"name": "Feldschlösschen",
|
||||||
|
"price": 500,
|
||||||
|
"id": "feldschloesschen",
|
||||||
|
"depot": 200
|
||||||
|
},
|
||||||
|
"sommersby": {
|
||||||
|
"name": "Sommersby",
|
||||||
|
"price": 500,
|
||||||
|
"id": "sommersby",
|
||||||
|
"depot": 200
|
||||||
|
},
|
||||||
|
"jever-fun": {
|
||||||
|
"name": "Jever Fun",
|
||||||
|
"price": 400,
|
||||||
|
"id": "jever-fun",
|
||||||
|
"depot": 200
|
||||||
|
},
|
||||||
|
"trojka-ice": {
|
||||||
|
"name": "Trojka Ice",
|
||||||
|
"price": 600,
|
||||||
|
"id": "trojka-ice",
|
||||||
|
"depot": 200,
|
||||||
|
"showLine": true
|
||||||
|
},
|
||||||
|
"vodka-red-energy": {
|
||||||
|
"name": "Vodka Rot Energy",
|
||||||
|
"price": 800,
|
||||||
|
"id": "vodka-red-energy"
|
||||||
|
},
|
||||||
|
"vodka-green-citro": {
|
||||||
|
"name": "Vodka Grün Citro",
|
||||||
|
"price": 800,
|
||||||
|
"id": "vodka-green-citro"
|
||||||
|
},
|
||||||
|
"vodka-white-energy": {
|
||||||
|
"name": "Vodka White Energy",
|
||||||
|
"price": 900,
|
||||||
|
"id": "vodka-white-energy"
|
||||||
|
},
|
||||||
|
"gin-tonic": {
|
||||||
|
"name": "Gin Tonic",
|
||||||
|
"price": 900,
|
||||||
|
"id": "gin-tonic"
|
||||||
|
},
|
||||||
|
"rum-cola": {
|
||||||
|
"name": "Rum Cola",
|
||||||
|
"price": 900,
|
||||||
|
"id": "rum-cola"
|
||||||
|
},
|
||||||
|
"whiskey-cola": {
|
||||||
|
"name": "Whiskey Cola",
|
||||||
|
"price": 900,
|
||||||
|
"id": "whiskey-cola"
|
||||||
|
},
|
||||||
|
"mate-mit-schuss": {
|
||||||
|
"name": "Mate mit Schuss",
|
||||||
|
"price": 1200,
|
||||||
|
"id": "mate-mit-schuss",
|
||||||
|
"depot": 200,
|
||||||
|
"showLine": true
|
||||||
|
},
|
||||||
|
"poseidon": {
|
||||||
|
"name": "Poseidon",
|
||||||
|
"price": 900,
|
||||||
|
"id": "poseidon"
|
||||||
|
},
|
||||||
|
"arielle": {
|
||||||
|
"name": "Arielle",
|
||||||
|
"price": 900,
|
||||||
|
"id": "arielle"
|
||||||
|
},
|
||||||
|
"pearl-driver": {
|
||||||
|
"name": "Pearl Driver",
|
||||||
|
"price": 400,
|
||||||
|
"id": "pearl-driver"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Poseidon's Quelle",
|
||||||
|
"id": "big-bar"
|
||||||
|
},
|
||||||
|
"small-bar": {
|
||||||
|
"offering": {
|
||||||
|
"softdrinks": {
|
||||||
|
"name": "Softdrinks (Alle)",
|
||||||
|
"price": 300,
|
||||||
|
"id": "softdrinks",
|
||||||
|
"showLine": true
|
||||||
|
},
|
||||||
|
"appenzeller": {
|
||||||
|
"name": "Appenzeller Vollmond",
|
||||||
|
"price": 500,
|
||||||
|
"id": "appenzeller",
|
||||||
|
"depot": 200
|
||||||
|
},
|
||||||
|
"feldschloesschen": {
|
||||||
|
"name": "Feldschlösschen",
|
||||||
|
"price": 500,
|
||||||
|
"id": "feldschloesschen",
|
||||||
|
"depot": 200
|
||||||
|
},
|
||||||
|
"sommersby": {
|
||||||
|
"name": "Sommersby",
|
||||||
|
"price": 500,
|
||||||
|
"id": "sommersby",
|
||||||
|
"depot": 200
|
||||||
|
},
|
||||||
|
"jever-fun": {
|
||||||
|
"name": "Jever Fun",
|
||||||
|
"price": 400,
|
||||||
|
"id": "jever-fun",
|
||||||
|
"depot": 200,
|
||||||
|
"showLine": true
|
||||||
|
},
|
||||||
|
"rose": {
|
||||||
|
"name": "Rosé",
|
||||||
|
"price": 1500,
|
||||||
|
"id": "rose",
|
||||||
|
"depot": 200
|
||||||
|
},
|
||||||
|
"red": {
|
||||||
|
"name": "Rotwein",
|
||||||
|
"price": 2000,
|
||||||
|
"id": "red",
|
||||||
|
"depot": 200
|
||||||
|
},
|
||||||
|
"wine-glasses": {
|
||||||
|
"name": "Weingläser",
|
||||||
|
"price": 0,
|
||||||
|
"id": "wine-glasses",
|
||||||
|
"depot": 200
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "Seepferdchenbar",
|
||||||
|
"id": "small-bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
+231
@@ -0,0 +1,231 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import {
|
||||||
|
Notifications
|
||||||
|
} from '@kyvg/vue3-notification';
|
||||||
|
import {
|
||||||
|
RouterView
|
||||||
|
} from 'vue-router';
|
||||||
|
import {
|
||||||
|
ref
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
|
const theme = ref( 'dark' );
|
||||||
|
|
||||||
|
const changeTheme = () => {
|
||||||
|
if ( theme.value === 'moon' ) {
|
||||||
|
document.documentElement.classList.remove( 'dark' );
|
||||||
|
document.documentElement.classList.add( 'light' );
|
||||||
|
localStorage.setItem( 'theme', 'light' );
|
||||||
|
theme.value = 'sun';
|
||||||
|
} else if ( theme.value === 'sun' ) {
|
||||||
|
document.documentElement.classList.remove( 'light' );
|
||||||
|
document.documentElement.classList.add( 'dark' );
|
||||||
|
localStorage.setItem( 'theme', 'dark' );
|
||||||
|
theme.value = 'moon';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
theme.value = localStorage.getItem( 'theme' ) ?? '';
|
||||||
|
|
||||||
|
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches || theme.value === 'dark' ) {
|
||||||
|
document.documentElement.classList.add( 'dark' );
|
||||||
|
theme.value = 'moon';
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.add( 'light' );
|
||||||
|
theme.value = 'sun';
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<notifications
|
||||||
|
position="top center"
|
||||||
|
:duration="5000"
|
||||||
|
class="notifications"
|
||||||
|
style="top: 20px;"
|
||||||
|
width="400px"
|
||||||
|
:max="3"
|
||||||
|
/>
|
||||||
|
<button id="themeSelector" title="Toggle between light and dark mode" @click="changeTheme();">
|
||||||
|
<i :class="['fa-solid', 'fa-' + theme]"></i>
|
||||||
|
</button>
|
||||||
|
<router-view id="main-view" v-slot="{ Component, route }">
|
||||||
|
<transition :name="route.meta.transition ? String( route.meta.transition ) : 'fade'" mode="out-in">
|
||||||
|
<component :is="Component" />
|
||||||
|
</transition>
|
||||||
|
</router-view>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
body {
|
||||||
|
background-color: var( --background-color );
|
||||||
|
}
|
||||||
|
|
||||||
|
.notifications {
|
||||||
|
.vue-notification {
|
||||||
|
padding: 20px;
|
||||||
|
.notification-title {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
.notification-text {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:root, :root.light {
|
||||||
|
--primary-color: #0a1520;
|
||||||
|
--secondary-color: white;
|
||||||
|
--background-color: rgb(221, 221, 221);
|
||||||
|
--nav-background: white;
|
||||||
|
--accent-color: #00457a;
|
||||||
|
--popup-color: rgb(224, 224, 224);
|
||||||
|
--overlay-color: rgba(0, 0, 0, 0.7);
|
||||||
|
--PI: 3.14159265358979;
|
||||||
|
--gray-color: rgb(53, 53, 53);
|
||||||
|
--footer-background: rgb(233, 233, 233);
|
||||||
|
--accent-background: rgb(195, 235, 243);
|
||||||
|
--loading-color: rgb(167, 167, 167);
|
||||||
|
--slider-color: rgb(119, 132, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
:root.dark {
|
||||||
|
--primary-color: white;
|
||||||
|
--secondary-color: black;
|
||||||
|
--background-color: rgb(32, 32, 32);
|
||||||
|
--nav-background: rgb(54, 54, 54);
|
||||||
|
--popup-color: rgb(58, 58, 58);
|
||||||
|
--accent-color: #007ddd;
|
||||||
|
--overlay-color: rgba(104, 104, 104, 0.575);
|
||||||
|
--gray-color: rgb(207, 207, 207);
|
||||||
|
--footer-background: rgb(53, 53, 53);
|
||||||
|
--accent-background: rgb(24, 12, 58);
|
||||||
|
--loading-color: rgb(65, 65, 65);
|
||||||
|
--slider-color: rgb(119, 132, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media ( prefers-color-scheme: dark ) {
|
||||||
|
:root {
|
||||||
|
--primary-color: white;
|
||||||
|
--secondary-color: black;
|
||||||
|
--background-color: rgb(32, 32, 32);
|
||||||
|
--nav-background: rgb(54, 54, 54);
|
||||||
|
--popup-color: rgb(58, 58, 58);
|
||||||
|
--accent-color: #007ddd;
|
||||||
|
--overlay-color: rgba(104, 104, 104, 0.575);
|
||||||
|
--gray-color: rgb(207, 207, 207);
|
||||||
|
--footer-background: rgb(53, 53, 53);
|
||||||
|
--accent-background: rgb(24, 12, 58);
|
||||||
|
--loading-color: rgb(65, 65, 65);
|
||||||
|
--slider-color: rgb(119, 132, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::selection {
|
||||||
|
background-color: #7c8cec;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-size: 17px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#app {
|
||||||
|
transition: 0.5s;
|
||||||
|
background-color: var( --background-color );
|
||||||
|
font-family: 'Plus Jakarta Sans', sans-serif;
|
||||||
|
/* font-family: Avenir, Helvetica, Arial, sans-serif; */
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
text-align: center;
|
||||||
|
color: var( --primary-color );
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-grow: 1;
|
||||||
|
width: 100vw;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main-view {
|
||||||
|
min-height: 60vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scale-enter-active,
|
||||||
|
.scale-leave-active {
|
||||||
|
transition: all 0.5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scale-enter-from,
|
||||||
|
.scale-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fade-enter-active,
|
||||||
|
.fade-leave-active {
|
||||||
|
transition: opacity 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fade-enter-from,
|
||||||
|
.fade-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.material-symbols-outlined {
|
||||||
|
font-variation-settings:
|
||||||
|
'FILL' 0,
|
||||||
|
'wght' 400,
|
||||||
|
'GRAD' 0,
|
||||||
|
'opsz' 48
|
||||||
|
}
|
||||||
|
|
||||||
|
.clr-open {
|
||||||
|
border: black solid 1px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#themeSelector {
|
||||||
|
position: fixed;
|
||||||
|
top: 10px;
|
||||||
|
left: 10px;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: var( --primary-color );
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.fancy-button {
|
||||||
|
text-decoration: none;
|
||||||
|
color: white;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
border: none;
|
||||||
|
background: linear-gradient( 45deg, rgb(0, 33, 139), rgb(151, 0, 0) );
|
||||||
|
font-size: larger;
|
||||||
|
transition: all 0.5s;
|
||||||
|
background-size: 150%;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fancy-button:hover {
|
||||||
|
border-radius: 5px;
|
||||||
|
background-position: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fancy-button-inactive {
|
||||||
|
background: linear-gradient( 45deg, rgba(0, 33, 139, 0.6), rgba(151, 0, 0, 0.6) );
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fancy-button-inactive:hover {
|
||||||
|
border-radius: 20px;
|
||||||
|
background-position: 0px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
<script setup lang="ts" generic="T">
|
||||||
|
import {
|
||||||
|
computed,
|
||||||
|
ref,
|
||||||
|
useTemplateRef
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
|
const array = defineModel<T[]>( {
|
||||||
|
'required': true
|
||||||
|
} );
|
||||||
|
|
||||||
|
defineSlots<{
|
||||||
|
default( props: {
|
||||||
|
'item': T,
|
||||||
|
'index': number
|
||||||
|
} ): void
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
( e: 'dropped' ): void
|
||||||
|
}>();
|
||||||
|
const scrollContainer = useTemplateRef( 'scroll-container' );
|
||||||
|
const movingIdx = ref( -1 );
|
||||||
|
const movingCurrentIdx = ref( -1 );
|
||||||
|
const movableSize = ref( -1 );
|
||||||
|
const offset = ref( -1 );
|
||||||
|
|
||||||
|
let mover = -1;
|
||||||
|
let moveSpeed = 0;
|
||||||
|
|
||||||
|
const start = ( ev: MouseEvent, idx: number ) => {
|
||||||
|
if ( array.value.length < 2 ) return;
|
||||||
|
|
||||||
|
movableSize.value = document.getElementById( 'movable-' + idx )!.scrollHeight;
|
||||||
|
offset.value = ev.y - ( movableSize.value / 2 );
|
||||||
|
movingIdx.value = idx;
|
||||||
|
movingCurrentIdx.value = idx;
|
||||||
|
};
|
||||||
|
|
||||||
|
const move = ( ev: MouseEvent ) => {
|
||||||
|
if ( movingIdx.value < 0 ) return;
|
||||||
|
|
||||||
|
offset.value = ev.y - ( movableSize.value / 2 );
|
||||||
|
const relToContainer = ev.y - scrollContainer.value!.offsetTop;
|
||||||
|
const height = scrollContainer.value!.offsetHeight;
|
||||||
|
|
||||||
|
// Scrolling up and down
|
||||||
|
if ( relToContainer < 50 ) {
|
||||||
|
if ( relToContainer < 0 )
|
||||||
|
moveSpeed = -20;
|
||||||
|
else
|
||||||
|
moveSpeed = -Math.ceil( Math.max( 1, Math.min( 5 / relToContainer, 10 ) ) );
|
||||||
|
|
||||||
|
startTracker();
|
||||||
|
} else if ( relToContainer > height - 50 ) {
|
||||||
|
if ( height - relToContainer < 0 )
|
||||||
|
moveSpeed = 20;
|
||||||
|
else
|
||||||
|
moveSpeed = Math.ceil( Math.max( 1, Math.min( 5 / ( height - relToContainer ), 10 ) ) );
|
||||||
|
|
||||||
|
startTracker();
|
||||||
|
} else {
|
||||||
|
if ( mover >= 0 ) {
|
||||||
|
try {
|
||||||
|
clearInterval( mover );
|
||||||
|
mover = -1;
|
||||||
|
} catch { /* empty */ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine current index to insert
|
||||||
|
const percentage = ( relToContainer + scrollContainer.value!.scrollTop ) / scrollContainer.value!.scrollHeight;
|
||||||
|
const newIdx = Math.min( Math.max( Math.round( percentage * array.value.length ), 0 ), array.value.length - 1 );
|
||||||
|
|
||||||
|
if ( newIdx !== movingIdx.value )
|
||||||
|
movingCurrentIdx.value = newIdx;
|
||||||
|
else
|
||||||
|
movingCurrentIdx.value = movingIdx.value;
|
||||||
|
};
|
||||||
|
|
||||||
|
const startTracker = () => {
|
||||||
|
if ( mover < 0 ) {
|
||||||
|
mover = setInterval( () => {
|
||||||
|
scrollContainer.value!.scrollTop += moveSpeed;
|
||||||
|
}, 100 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const end = () => {
|
||||||
|
offset.value = -1;
|
||||||
|
|
||||||
|
try {
|
||||||
|
clearInterval( mover );
|
||||||
|
mover = -1;
|
||||||
|
} catch { /* empty */ }
|
||||||
|
|
||||||
|
const before = array.value.slice( 0, movingIdx.value );
|
||||||
|
const after = array.value.slice( movingIdx.value + 1 );
|
||||||
|
const el = array.value[ movingIdx.value ]!;
|
||||||
|
const arr = before.concat( after );
|
||||||
|
|
||||||
|
arr.splice( movingCurrentIdx.value, 0, el );
|
||||||
|
array.value = arr;
|
||||||
|
movingIdx.value = -1;
|
||||||
|
movingCurrentIdx.value = -1;
|
||||||
|
|
||||||
|
emit( 'dropped' );
|
||||||
|
};
|
||||||
|
|
||||||
|
const style = computed( () => {
|
||||||
|
return ( index: number ) => {
|
||||||
|
if ( movingIdx.value === array.value.length - 1 && movingIdx.value === index + 1
|
||||||
|
&& movingCurrentIdx.value === movingIdx.value )
|
||||||
|
return `margin-bottom: ${ movableSize.value }px;`;
|
||||||
|
|
||||||
|
if ( movingIdx.value >= 0 ) {
|
||||||
|
if ( movingIdx.value === index ) {
|
||||||
|
// Current item is moved
|
||||||
|
return `top: ${ offset.value }px;`;
|
||||||
|
} else {
|
||||||
|
// Current item is not moved
|
||||||
|
if ( movingCurrentIdx.value === array.value.length - 1 && index === movingCurrentIdx.value ) {
|
||||||
|
// Create gap below
|
||||||
|
return `margin-bottom: ${ movableSize.value }px;`;
|
||||||
|
} else if ( movingCurrentIdx.value === index
|
||||||
|
|| ( movingCurrentIdx.value === index - 1 && movingIdx.value == index - 1 ) ) {
|
||||||
|
// Create a gap above
|
||||||
|
return `margin-top: ${ movableSize.value }px;`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div ref="scroll-container" class="sortable-list">
|
||||||
|
<div
|
||||||
|
v-if="movingIdx >= 0"
|
||||||
|
class="grip-target"
|
||||||
|
@mousemove="move"
|
||||||
|
@mouseleave="end"
|
||||||
|
@mouseup="end"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-for="(item, index) in array"
|
||||||
|
:id="'movable-' + index"
|
||||||
|
:key="index"
|
||||||
|
:class="[ 'movable', movingIdx === index ? 'moving' : undefined ]"
|
||||||
|
:style="style(index)"
|
||||||
|
>
|
||||||
|
<slot :item="item" :index="index"></slot>
|
||||||
|
<i class="fa-solid fa-grip-vertical" @mousedown="( e ) => start( e, index )"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@use '@/scss/components/sortablelist.scss'
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import {
|
||||||
|
queue,
|
||||||
|
queueIdx
|
||||||
|
} from '@/ts/player/state';
|
||||||
|
import CurrentSong from '../player/CurrentSong.vue';
|
||||||
|
import PlayerControls from '../player/PlayerControls.vue';
|
||||||
|
import QueueViewer from '../player/QueueViewer.vue';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="player">
|
||||||
|
<div
|
||||||
|
class="panel"
|
||||||
|
>
|
||||||
|
<div style="margin-bottom: 20px; width: 100%;">
|
||||||
|
<CurrentSong
|
||||||
|
v-model="queue[queueIdx]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<PlayerControls />
|
||||||
|
</div>
|
||||||
|
<div class="panel">
|
||||||
|
<QueueViewer />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.player {
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
|
.panel {
|
||||||
|
width: 45%;
|
||||||
|
margin-left: 2.5%;
|
||||||
|
margin-right: 2.5%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user