Compare commits

..

50 commits

Author SHA1 Message Date
7b3b5f7136
Add more info to album page 2024-05-02 04:11:54 +02:00
7958a00050
Fix bug where playback would not pause when fetching the newest playqueue 2024-05-02 04:11:34 +02:00
d42c3202b5
Move shuffle and displaytime functions to new utilities file 2024-05-02 04:11:12 +02:00
2af920a7ac
Add Album Page 2024-05-02 03:53:28 +02:00
19d35589be
Add Option to shuffle playQueue 2024-05-02 03:53:11 +02:00
e2f8adc5db
Album Page Views 2024-04-30 05:19:41 +02:00
99b534e9b5
Move playback and queue to state files; Move various components to layout; Begin moving view to state file; 2024-04-30 02:27:10 +02:00
65f0e6776e
Add unique session identifier to OpenSubsonic for improved behaviour with getNowPlaying 2024-04-30 02:25:15 +02:00
ff396e8ca2
Add various new components 2024-04-29 07:15:09 +02:00
e162c674bf
Make Center Module reactive & use snippets 2024-04-29 07:14:45 +02:00
b69f04fbe8
Make left sidebar interactive 2024-04-29 07:13:33 +02:00
7488b7cfeb
Use opensubsonic types in module and code 2024-04-29 07:12:43 +02:00
b0ec1c7d56
Add Data types to opensubsonic module 2024-04-29 07:11:21 +02:00
fc382d6876
Switch layout to use runes syntax 2024-04-29 07:10:44 +02:00
9964b08133
Add Author and License ´to package.json 2024-04-26 02:18:20 +02:00
d800031d3e
Remove Debug Text on Login Form 2024-04-26 02:17:08 +02:00
7b0874691e
Change version number 2024-04-26 01:57:57 +02:00
a7d7d036c3
Switch to svelte-adapter-node and remove package-lock.json 2024-04-26 01:53:40 +02:00
287959a60c
Small cleanup stuff 2024-04-26 01:21:09 +02:00
0abe420398
Re-enable Left Sidebar in Player 2024-04-26 01:16:54 +02:00
2ae90a5639
Include domain on login page 2024-04-26 01:16:38 +02:00
352a1b857e
Cleanup unused files 2024-04-25 18:19:11 +02:00
6bff963d7a
Move Sidebar and Player into components 2024-04-25 18:16:53 +02:00
25536b078a
Move Player code to separate file 2024-04-25 18:04:37 +02:00
1a771168ee
Add Header to Login Page 2024-04-25 17:53:45 +02:00
ba3e38c081
Complete rebrand to lydstyrke 2024-04-23 16:13:21 +02:00
180721088c
switch to AGPL 2024-04-23 16:13:08 +02:00
20047ea0b8 Update README.md 2024-04-23 10:00:29 +00:00
91582d4b41 Rebrand to lydstyrke due to domain availability 2024-04-23 09:36:25 +00:00
d9fcdcf930
Removed Debug logging 2024-04-22 20:08:55 +02:00
652e8afc37
Append: Improve Volume Handling 2024-04-22 20:08:30 +02:00
a99e12c6e6
Include Scrobble 2024-04-22 20:08:08 +02:00
6a7ba60ca9
Add Rewind and Forward 2024-04-22 20:07:52 +02:00
20499ca5a1
Move source to currentSong.source 2024-04-22 20:07:41 +02:00
2bad02d27e
Move song data to currentSong.data 2024-04-22 20:07:03 +02:00
c7e0d93fb0
Add Playback Modes 2024-04-22 20:06:25 +02:00
1175f88401
Add Various Title Displays 2024-04-22 20:05:27 +02:00
d1903045a4
Improve Volume Handling 2024-04-22 20:04:12 +02:00
115d30dc67
Fix Time formatting Function 2024-04-22 20:02:47 +02:00
c116aa8c47
Add Highlighter to currently playing song 2024-04-22 20:02:29 +02:00
1e535c9715
Move superforms to dev dependencies 2024-04-22 20:00:54 +02:00
20276e8293
Automatically fetch currently playing song, fallback to first song in playqueue 2024-04-22 16:53:03 +02:00
8f429f0847
Change playSong method to consume song object rather than queue ID 2024-04-22 16:50:48 +02:00
3b3b7773db
Various stuff 2024-04-22 16:49:36 +02:00
3cf0820faa
Rebrand to lytter 2024-04-22 10:07:38 +02:00
94dc6e2fcd
Cleaned Up Controls Code 2024-04-21 23:40:04 +02:00
d088472acb
Somewhat functional playback (not really) 2024-04-21 23:00:45 +02:00
59bedf73da
Functional Login Page 2024-04-21 02:15:50 +02:00
f40f5c2d20
Barebones Svelte Project 2024-04-20 21:26:11 +02:00
025ab031f3
Remove Rust Code 2024-04-20 21:23:25 +02:00
96 changed files with 5431 additions and 1814 deletions

13
.eslintignore Normal file
View file

@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

30
.eslintrc.cjs Normal file
View file

@ -0,0 +1,30 @@
/** @type { import("eslint").Linter.Config } */
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
extraFileExtensions: ['.svelte']
},
env: {
browser: true,
es2017: true,
node: true
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
]
};

16
.gitignore vendored
View file

@ -1,4 +1,12 @@
/target/
/.directory
/.idea/
/dist/
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
.directory
get_queue.json

8
.idea/.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View file

@ -0,0 +1,3 @@
<component name="ProjectDictionaryState">
<dictionary name="neshura" />
</component>

View file

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

8
.idea/modules.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/navidrome-alt-ui.iml" filepath="$PROJECT_DIR$/.idea/navidrome-alt-ui.iml" />
</modules>
</component>
</project>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="EMPTY_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

1
.npmrc Normal file
View file

@ -0,0 +1 @@
engine-strict=true

1431
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,15 +0,0 @@
[package]
name = "navidrome-alternate-ui"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
sycamore = { version = "0.9.0-beta.2", features = ["suspense"] }
reqwest = { version = "0.11.23", features = ["blocking", "json"] }
md5 = "0.7.0"
dotenv = "0.15.0"
serde = { version = "1.0.196", features = ["derive"] }
log = "0.4.20"
console_log = "1.0.0"

123
LICENSE
View file

@ -1,29 +1,25 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright © 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.
Preamble
The GNU General Public License is a free, copyleft license for software and other kinds of works.
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, 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.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
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.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
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.
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
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.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
The precise terms and conditions for copying, distribution and modification follow.
@ -31,30 +27,31 @@ TERMS AND CONDITIONS
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 works, such as semiconductor masks.
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
A “covered work” means either the unmodified Program or a work based on the Program.
A "covered work" means either the unmodified Program or a work based on the Program.
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
@ -82,13 +79,13 @@ You may convey a work based on the Program, or the modifications to produce it f
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
@ -105,9 +102,9 @@ You may convey a covered work in object code form under the terms of sections 4
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
"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).
@ -116,7 +113,7 @@ The requirement to provide Installation Information does not include a requireme
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.
"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.
@ -134,13 +131,14 @@ Notwithstanding any other provision of this License, for material you add to a c
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.
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.
@ -150,54 +148,67 @@ Moreover, your license from a particular copyright holder is reinstated permanen
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.
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.
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.
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 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.
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.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU 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.
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.
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.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
@ -206,27 +217,19 @@ How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
navidrome-alternate-ui
Copyright (C) 2024 Neshura
lydstyrke
Copyright (C) 2024 Lydstyrke
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is 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 General Public License for more details.
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 General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
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/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
navidrome-alternate-ui Copyright (C) 2024 Neshura
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <http://www.gnu.org/licenses/>.

View file

@ -1,7 +1,13 @@
# Navidrome Alternate UI
# Lydstyrke
Alternative UI Frontend for Navidrome using the Subsonic API.
Designed around some personal misgivings I had with Navidrome's native UI and as a way for me to play around with [Sycamore](https://sycamore-rs.netlify.app/#).
Designed around some personal misgivings I had with Navidrome's native UI. Built using Svelte 5.
Project Site: [Site](lydstyrke.net)
Preview (eventually): [Demo](demo.lydstyrke.net)
Wiki (eventually, based on wiki.js): [Wiki](docs.lydstyrke.net)
Supports:

View file

@ -1,4 +0,0 @@
[serve]
address = "::"
port = 8080
open = false

14
components.json Normal file
View file

@ -0,0 +1,14 @@
{
"$schema": "https://shadcn-svelte.com/schema.json",
"style": "new-york",
"tailwind": {
"config": "tailwind.config.js",
"css": "src/app.pcss",
"baseColor": "slate"
},
"aliases": {
"components": "$lib/components",
"utils": "$lib/utils"
},
"typescript": true
}

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html lang="en" class="h-full">
<head>
<meta charset="UTF-8">
<link data-trunk rel="tailwind-css" href="styles.css"/>
<title>Music App</title>
</head>
<body class="h-full">
</body>
</html>

52
package.json Normal file
View file

@ -0,0 +1,52 @@
{
"name": "lydstyrke",
"author": "Neshura",
"license": "AGPL-3.0-or-later",
"description": "A Subsonic Web UI",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "eslint .",
"ui": "npx shadcn-svelte@latest"
},
"devDependencies": {
"@sveltejs/adapter-node": "^5.0.1",
"@sveltejs/kit": "^2.5.7",
"@sveltejs/vite-plugin-svelte": "^3.1.0",
"@types/eslint": "^8.56.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.56.0",
"eslint-plugin-svelte": "^2.36.0-next.13",
"postcss": "^8.4.32",
"postcss-load-config": "^5.0.2",
"svelte": "^5.0.0-next",
"svelte-check": "^3.6.0",
"svelte-loading-spinners": "^0.3.6",
"sveltekit-superforms": "^2.12.5",
"tailwindcss": "^3.3.6",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^5.0.3"
},
"type": "module",
"dependencies": {
"@radix-ui/react-icons": "^1.3.0",
"bits-ui": "^0.21.7",
"clsx": "^2.1.0",
"formsnap": "^1.0.0",
"js-cookie": "^3.0.5",
"radix-icons-svelte": "^1.2.1",
"svelte-radix": "^1.1.0",
"tailwind-merge": "^2.3.0",
"tailwind-variants": "^0.2.1",
"ts-md5": "^1.3.1",
"zod": "^3.22.5"
}
}

13
postcss.config.cjs Normal file
View file

@ -0,0 +1,13 @@
const tailwindcss = require("tailwindcss");
const autoprefixer = require("autoprefixer");
const config = {
plugins: [
//Some plugins, like tailwindcss/nesting, need to run before Tailwind,
tailwindcss(),
//But others, like autoprefixer, need to run after,
autoprefixer,
],
};
module.exports = config;

13
src/app.d.ts vendored Normal file
View file

@ -0,0 +1,13 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}
export {};

12
src/app.html Normal file
View file

@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover" class="h-screen light dark">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

71
src/app.pcss Normal file
View file

@ -0,0 +1,71 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
:root {
--background: 191.6 100% 95%;
--foreground: 191.6 5% 0%;
--card: 191.6 50% 90%;
--card-foreground: 191.6 5% 10%;
--popover: 191.6 100% 95%;
--popover-foreground: 191.6 100% 0%;
--primary: 191.6 91.4% 36.5%;
--primary-foreground: 0 0% 100%;
--secondary: 191.6 30% 70%;
--secondary-foreground: 0 0% 0%;
--muted: 153.6 30% 85%;
--muted-foreground: 191.6 5% 35%;
--accent: 153.6 30% 80%;
--accent-foreground: 191.6 5% 10%;
--destructive: 0 100% 30%;
--destructive-foreground: 191.6 5% 90%;
--border: 191.6 30% 50%;
--input: 191.6 30% 18%;
--ring: 191.6 91.4% 36.5%;
--radius: 0.75rem;
}
.dark {
--background: 191.6 50% 5%;
--foreground: 191.6 5% 90%;
--card: 191.6 50% 0%;
--card-foreground: 191.6 5% 90%;
--popover: 191.6 50% 5%;
--popover-foreground: 191.6 5% 90%;
--primary: 191.6 91.4% 36.5%;
--primary-foreground: 0 0% 100%;
--secondary: 191.6 30% 10%;
--secondary-foreground: 0 0% 100%;
--muted: 153.6 30% 15%;
--muted-foreground: 191.6 5% 60%;
--accent: 153.6 30% 15%;
--accent-foreground: 191.6 5% 90%;
--destructive: 0 100% 30%;
--destructive-foreground: 191.6 5% 90%;
--border: 191.6 30% 18%;
--input: 191.6 30% 18%;
--ring: 191.6 91.4% 36.5%;
--radius: 0.75rem;
}
}
@layer base {
h1 {
@apply text-2xl;
@apply font-bold;
}
h2 {
@apply text-xl;
@apply font-bold;
}
h3 {
@apply text-lg;
@apply font-bold;
}
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}

View file

@ -1,3 +0,0 @@
pub use separator::separator;
mod separator;

View file

@ -1,26 +0,0 @@
use sycamore::prelude::*;
#[derive(Props)]
pub struct SeparatorProps {
width: u8
}
/*
w-[1%] w-[2%] w-[3%] w-[4%] w-[5%] w-[6%] w-[7%] w-[8%] w-[9%] w-[10%]
w-[11%] w-[12%] w-[13%] w-[14%] w-[15%] w-[16%] w-[17%] w-[18%] w-[19%] w-[20%]
w-[21%] w-[22%] w-[23%] w-[24%] w-[25%] w-[26%] w-[27%] w-[28%] w-[29%] w-[30%]
w-[31%] w-[32%] w-[33%] w-[34%] w-[35%] w-[36%] w-[37%] w-[38%] w-[39%] w-[40%]
w-[41%] w-[42%] w-[43%] w-[44%] w-[45%] w-[46%] w-[47%] w-[48%] w-[49%] w-[50%]
w-[51%] w-[52%] w-[53%] w-[54%] w-[55%] w-[56%] w-[57%] w-[58%] w-[59%] w-[60%]
w-[61%] w-[62%] w-[63%] w-[64%] w-[65%] w-[66%] w-[67%] w-[68%] w-[69%] w-[70%]
w-[71%] w-[72%] w-[73%] w-[74%] w-[75%] w-[76%] w-[77%] w-[78%] w-[79%] w-[80%]
w-[81%] w-[82%] w-[83%] w-[84%] w-[85%] w-[86%] w-[87%] w-[88%] w-[89%] w-[90%]
w-[91%] w-[92%] w-[93%] w-[94%] w-[95%] w-[96%] w-[97%] w-[98%] w-[99%] w-[100%]
*/
pub fn separator<G: Html>(props: SeparatorProps) -> View<G> {
let class_string = format!("place-self-center w-[{}%] border border-1 border-black", props.width);
view! {
p(class=class_string) {}
}
}

View file

@ -0,0 +1,10 @@
<script>
import {Circle2} from "svelte-loading-spinners";
</script>
<Circle2
size="40" unit="px"
colorOuter="#0892B4" durationOuter="1s"
colorCenter="white" durationCenter="3s"
colorInner="#9cc1c9" durationInner="2s"
/>

View file

@ -0,0 +1,58 @@
<svelte:options runes={true} />
<script lang="ts">
import {Button} from "$lib/components/ui/button";
import {onMount} from "svelte";
import {playbackState} from "$lib/states/playback-state.svelte";
import {toFixedNumber} from "$lib/formatting";
import {displayTime} from "$lib/utilities";
let mounted = $state(false);
function changeVolume(change: number) {
if (playbackState.volume + change > 1) {
playbackState.volume = 1;
}
else if (playbackState.volume + change < 0) {
playbackState.volume = 0;
}
else {
playbackState.volume = toFixedNumber(playbackState.volume + change, 2, 10) ;
}
if (playbackState.song) {
playbackState.song.volume = playbackState.volume;
}
}
function progressPercent() {
return playbackState.progress / playbackState.duration * 100 || 0;
}
onMount(() => {
mounted = true;
})
</script>
<div class="flex flex-row gap-2">
{#if mounted}
<div class="flex flex-row gap-2">
<p class="border p-2">Song: {playbackState.metaData.title}</p>
<p class="border p-2">Volume: {playbackState.volume}</p>
<p class="border p-2">{displayTime(playbackState.progress)}/{displayTime(playbackState.duration)}</p>
<p class="border p-2">{progressPercent().toFixed(2)}%</p>
<Button class="border p-2" onclick={() => changeVolume(-0.05)}>-</Button>
<Button class="border p-2" onclick={() => changeVolume(0.05)}>+</Button>
<Button class="border p-2" onclick={() => playbackState.song.currentTime -= 5}>{"<<"}</Button>
{#if playbackState.paused}
<Button onclick={() => playbackState.play()}>Play</Button>
{:else}
<Button onclick={() => playbackState.pause()}>Pause</Button>
{/if}
<Button class="border p-2" onclick={() => playbackState.song.currentTime += 5}>{">>"}</Button>
<Button class="border p-2" onclick={() => playbackState.loopMode.next()}>{playbackState.loopMode.get()}</Button>
<Button class="botder p-2" onclick={() => playbackState.shuffle = !playbackState.shuffle}>{playbackState.shuffle ? "X" : "="}</Button>
</div>
{:else}
<p>Nothing going on here</p>
{/if}
</div>

View file

@ -0,0 +1,39 @@
<svelte:options runes={true} />
<script lang="ts">
import {Separator} from "$lib/components/ui/separator";
import {Button} from "$lib/components/ui/button";
import {View} from "$lib/components/custom/Views/views.svelte";
import {AlbumView} from "$lib/components/custom/Views/views.svelte.js";
import {viewState} from "$lib/states/view-state.svelte";
import {goto} from "$app/navigation";
let playlists = $state([]);
let expanded = $state(true);
$inspect(expanded)
</script>
<div class="border border-2 col-span-1 flex flex-col gap-1 p-2">
<div class="flex flex-col gap-2">
<Button onclick={() => expanded = !expanded} class="flex flex-col h-fit">Albums</Button>
{#if expanded}
<Button variant="secondary" onclick={() => goto("/albums/all")}>All</Button>
<Button variant="secondary" onclick={() => goto("/albums/random")}>Random</Button>
<Button variant="secondary" onclick={() => goto("/albums/favourites")}>Favourites</Button>
<Button variant="secondary" onclick={() => goto("/albums/top-rated")}>Top Rated</Button>
<Button variant="secondary" onclick={() => goto("/albums/recently-added")}>Recently Added</Button>
<Button variant="secondary" onclick={() => goto("/albums/recently-played")}>Recently Played</Button>
<Button variant="secondary" onclick={() => goto("/albums/most-played")}>Most Played</Button>
{/if}
</div>
<Separator />
<Button onclick={() => viewState.setMode(View.Artists)}>Artists</Button>
<h1>Songs</h1>
<h1>Radios</h1>
<h1>Shares</h1>
<Separator />
<h1>Playlists</h1>
{#each playlists as playlist}
<h2>{playlist}</h2>
{/each}
</div>

View file

@ -0,0 +1,78 @@
<svelte:options runes={true} />
<script lang="ts">
import {Separator} from "$lib/components/ui/separator";
import {Button} from "$lib/components/ui/button";
import {timeFormat} from "$lib/time-format";
import LoadingSpinner from "$lib/components/custom/LoadingSpinner.svelte";
import {queueState} from "$lib/states/play-queue.svelte";
import {playbackState} from "$lib/states/playback-state.svelte";
let loading = $state(false);
async function innerFetchQueue() {
loading = true;
playbackState.pause();
await queueState.getPlayQueue()
await new Promise(resolve => setTimeout(resolve, 100));
loading = false;
}
function removeSongFromQueue(idx: number) {
if (idx > -1) {
queueState.queue.splice(idx, 1);
}
}
function playSong( songIndex: number) {
queueState.setSong(songIndex);
playbackState.pause();
playbackState.newSong(queueState.getSong());
playbackState.play();
}
</script>
{#snippet songEntry(song, idx)}
<p onclick={() => playSong(idx)}>{song.artist} - {song.title} ({timeFormat(song.duration)})</p>
<Button onclick={() => removeSongFromQueue(idx)}>X</Button>
{/snippet}
{#snippet playerQueue()}
{#each queueState.queue as song, idx}
{#if idx < queueState.currentIndex}
<div class="flex flex-row gap-2 text-muted">
{@render songEntry(song, idx)}
</div>
{:else if idx === queueState.currentIndex}
<div class="flex flex-row gap-2 bg-secondary">
{@render songEntry(song, idx)}
</div>
{:else}
<div class="flex flex-row gap-2">
{@render songEntry(song, idx)}
</div>
{/if}
{/each}
<Button onclick={() => queueState.queue.push(queueState.queue[0])}>Add</Button>
{/snippet}
<div class="border border-2 col-span-1 flex flex-col gap-1 p-2">
<div class="flex gap-2">
<h1>Current Queue</h1>
<div class="flex-grow"></div>
<Button variant="outline" class="h-8 w-12" onclick={innerFetchQueue}>Fetch</Button>
<Button variant="outline" class="h-8 w-12" onclick={() => queueState.saveQueue()}>Upload</Button>
</div>
<Separator />
{#if loading}
<div class="relative flex flex-col gap-1">
<div class="absolute w-full h-full z-40 bg-opacity-60 bg-background flex flex-col items-center justify-center gap-2">
<h2>Fetching Play Queue</h2>
<LoadingSpinner />
</div>
{@render playerQueue()}
</div>
{:else}
{@render playerQueue()}
{/if}
</div>

View file

@ -0,0 +1,20 @@
<svelte:options runes={true} />
<script>
import ViewCard from "$lib/components/custom/Views/ViewCard.svelte";
import {Skeleton} from "$lib/components/ui/skeleton";
let {albums, updateScroll, selectAlbum} = $props();
let self = $state();
</script>
<div class="border border-2 flex flex-row flex-wrap gap-2 p-2 h-fit max-h-full items-start justify-start overflow-y-auto" bind:this={self} onscroll={() => updateScroll(self)}>
{#if albums.loading}
{#each [...Array(20).keys()] as i}
<Skeleton id={"album-skeleton-" + i} class="rounded-md w-56 h-72 border border-2 bg-background" />
{/each}
{:else}
{#each albums.list as album}
<ViewCard data={album} onselectalbum={selectAlbum}/>
{/each}
{/if}
</div>

View file

@ -0,0 +1,85 @@
<svelte:options runes={true} />
<script lang="ts">
import {AlbumView} from "$lib/components/custom/Views/views.svelte";
import {viewState} from "$lib/states/view-state.svelte";
import {onMount} from "svelte";
import ViewCard from "$lib/components/custom/Views/ViewCard.svelte";
import {type AlbumID3, type GetAlbumList2Response, OpenSubsonic, type Parameter} from "$lib/opensubsonic";
import {Skeleton} from "$lib/components/ui/skeleton";
import {goto} from "$app/navigation";
let albums: Array<AlbumID3> = $state([]);
let loading = $state(true);
let paginating = $state(false);
const paginationIncrement = 100; // TODO: make configurable?
let pagination = $state(0);
let self = $state();
let scrollY = $state(0);
let scrollYMax = $state(1);
async function fetchAlbums() {
let parameters: Array<Parameter> = [
{key: "type", value: viewState.current.subMode},
{key: "size", value: paginationIncrement},
{key: "offset", value: pagination},
];
const data: GetAlbumList2Response = await OpenSubsonic.get("getAlbumList2", parameters);
if (data && data.albumList2.album) {
albums = albums.concat(data.albumList2.album);
pagination += paginationIncrement;
paginating = false;
loading = false;
}
}
function updateScroll(self) {
scrollY = self.scrollTop;
scrollYMax = self.scrollTopMax;
}
$effect(() => {
if(scrollY/scrollYMax && albums.length === 100 && !paginating) {
console.log("triggered")
paginating = true;
fetchAlbums();
}
})
$effect(() => {
console.log(viewState.current.subMode);
if (viewState.previous) {
if (viewState.current.subMode !== viewState.previous.subMode) {
loading = true;
albums = [];
pagination = 0;
fetchAlbums();
viewState.previous.mode = viewState.current.mode
}
}
})
function selectAlbum(albumId) {
goto(`/album/${albumId}`);
console.log(albumId);
}
onMount(() => {
fetchAlbums();
viewState.previous = viewState.current;
})
</script>
<div class="border border-2 flex flex-row flex-wrap gap-2 p-2 h-1 min-h-full items-center justify-center overflow-y-auto" bind:this={self} onscroll={() => updateScroll(self)}>
{#if loading}
{#each [...Array(20).keys()] as i}
<Skeleton id={"album-skeleton-" + i} class="rounded-md w-56 h-72 border border-2 bg-background" />
{/each}
{:else}
{#each albums as album}
<ViewCard data={album} onselectalbum={selectAlbum}/>
{/each}
{/if}
</div>

View file

@ -0,0 +1,24 @@
<svelte:options runes={true} />
<script lang="ts">
import {Separator} from "$lib/components/ui/separator";
import {Button} from "$lib/components/ui/button";
import {AlbumView} from "$lib/components/custom/Views/views.svelte";
let { viewMode = $bindable() }: { viewMode: AlbumView } = $props();
let range = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,]
</script>
<div class="border border-2 flex flex-col gap-1 p-2 h-1 min-h-full">
<h1>{viewMode}</h1>
<h1>View Actions go here</h1>
<div class="overflow-y-auto">
<p>everything above this should be sticky</p>
<h1>and this lists the songs</h1>
{#each range as ignore}
<p>A</p>
{/each}
<p>And this should be after infiny loading</p>
</div>
</div>

View file

@ -0,0 +1,42 @@
<svelte:options runes={true} />
<script lang="ts">
import {Button} from "$lib/components/ui/button";
import {onMount} from "svelte";
import {type AlbumID3, type GetAlbumList2Response, OpenSubsonic, type Parameter} from "$lib/opensubsonic";
import {Skeleton} from "$lib/components/ui/skeleton";
let { data = $bindable(), onselectalbum }: { data: AlbumID3 } = $props();
let coverImage = $state(new Image());
let loading = $state(true);
async function getCoverImage() {
let parameters: Array<Parameter> = [
{key: "id", value: data.coverArt},
//{key: "size", value: paginationIncrement},
];
const imgData = await OpenSubsonic.get("getCoverArt", parameters);
if (data) {
coverImage.src = imgData.url;
coverImage.onload = () => {
loading = false;
}
}
}
onMount(() => {
getCoverImage();
})
</script>
<div class="border border-2 flex flex-col gap-1 p-2 h-72 w-56 rounded-md" onclick={() => onselectalbum(data.id)}>
{#if loading}
<Skeleton class="min-h-[192px] w-[192px]" />
{:else}
<img alt={data.name + " Cover Art"} src={coverImage.src} height="192px" width="192px" class="rounded-md"/>
{/if}
<h1>{data.name}</h1>
<h2>{data.artist}</h2>
</div>

View file

@ -0,0 +1,30 @@
import {type AlbumID3, type GetAlbumList2Response, OpenSubsonic, type Parameter} from "$lib/opensubsonic";
export class AlbumState {
list: Array<AlbumID3> = $state(new Array<AlbumID3>())
loading: boolean = $state(true)
paginating: boolean = $state(false)
paginationIncrement: number = $state(100)
pagination: number = $state(0)
mode: string = $state("alphabeticalByName")
async fetchAlbums(): Promise<void> {
const parameters: Array<Parameter> = [
{key: "type", value: this.mode},
{key: "size", value: this.paginationIncrement.toString()},
{key: "offset", value: this.pagination.toString()},
];
const data: GetAlbumList2Response = await OpenSubsonic.get("getAlbumList2", parameters);
if (data && data.albumList2.album) {
this.list = this.list.concat(data.albumList2.album);
this.pagination += this.paginationIncrement;
this.paginating = false;
this.loading = false;
}
}
setMode(mode: string): void {
this.mode = mode;
}
}

View file

@ -0,0 +1,20 @@
export enum AlbumView {
All = "alphabeticalByName",
Random = "random",
Favourites = "starred",
TopRated = "highest",
RecentlyAdded = "newest",
RecentlyPlayed = "recent",
MostPlayed = "frequent"
}
export enum View {
Albums = "Albums",
Artists = "Artists",
Songs = "Songs",
Radios = "Radios",
Shares = "Shares",
Playlist = "Playlist",
Artist = "Artist",
Album = "Album",
}

View file

@ -0,0 +1,25 @@
<script lang="ts">
import { Button as ButtonPrimitive } from "bits-ui";
import { type Events, type Props, buttonVariants } from "./index.js";
import { cn } from "$lib/utils.js";
type $$Props = Props;
type $$Events = Events;
let className: $$Props["class"] = undefined;
export let variant: $$Props["variant"] = "default";
export let size: $$Props["size"] = "default";
export let builders: $$Props["builders"] = [];
export { className as class };
</script>
<ButtonPrimitive.Root
{builders}
class={cn(buttonVariants({ variant, size, className }))}
type="button"
{...$$restProps}
on:click
on:keydown
>
<slot />
</ButtonPrimitive.Root>

View file

@ -0,0 +1,49 @@
import { type VariantProps, tv } from "tailwind-variants";
import type { Button as ButtonPrimitive } from "bits-ui";
import Root from "./button.svelte";
const buttonVariants = tv({
base: "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline:
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
icon: "h-10 w-10",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
});
type Variant = VariantProps<typeof buttonVariants>["variant"];
type Size = VariantProps<typeof buttonVariants>["size"];
type Props = ButtonPrimitive.Props & {
variant?: Variant;
size?: Size;
};
type Events = ButtonPrimitive.Events;
export {
Root,
type Props,
type Events,
//
Root as Button,
type Props as ButtonProps,
type Events as ButtonEvents,
buttonVariants,
};

View file

@ -0,0 +1,13 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
type $$Props = HTMLAttributes<HTMLDivElement>;
let className: $$Props["class"] = undefined;
export { className as class };
</script>
<div class={cn("p-6 pt-0", className)} {...$$restProps}>
<slot />
</div>

View file

@ -0,0 +1,13 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
type $$Props = HTMLAttributes<HTMLParagraphElement>;
let className: $$Props["class"] = undefined;
export { className as class };
</script>
<p class={cn("text-sm text-muted-foreground", className)} {...$$restProps}>
<slot />
</p>

View file

@ -0,0 +1,13 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
type $$Props = HTMLAttributes<HTMLDivElement>;
let className: $$Props["class"] = undefined;
export { className as class };
</script>
<div class={cn("flex items-center p-6 pt-0", className)} {...$$restProps}>
<slot />
</div>

View file

@ -0,0 +1,13 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
type $$Props = HTMLAttributes<HTMLDivElement>;
let className: $$Props["class"] = undefined;
export { className as class };
</script>
<div class={cn("flex flex-col space-y-1.5 p-6", className)} {...$$restProps}>
<slot />
</div>

View file

@ -0,0 +1,21 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import type { HeadingLevel } from "./index.js";
import { cn } from "$lib/utils.js";
type $$Props = HTMLAttributes<HTMLHeadingElement> & {
tag?: HeadingLevel;
};
let className: $$Props["class"] = undefined;
export let tag: $$Props["tag"] = "h3";
export { className as class };
</script>
<svelte:element
this={tag}
class={cn("text-lg font-semibold leading-none tracking-tight", className)}
{...$$restProps}
>
<slot />
</svelte:element>

View file

@ -0,0 +1,16 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
type $$Props = HTMLAttributes<HTMLDivElement>;
let className: $$Props["class"] = undefined;
export { className as class };
</script>
<div
class={cn("rounded-lg border bg-card text-card-foreground shadow-sm", className)}
{...$$restProps}
>
<slot />
</div>

View file

@ -0,0 +1,24 @@
import Root from "./card.svelte";
import Content from "./card-content.svelte";
import Description from "./card-description.svelte";
import Footer from "./card-footer.svelte";
import Header from "./card-header.svelte";
import Title from "./card-title.svelte";
export {
Root,
Content,
Description,
Footer,
Header,
Title,
//
Root as Card,
Content as CardContent,
Description as CardDescription,
Footer as CardFooter,
Header as CardHeader,
Title as CardTitle,
};
export type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";

View file

@ -0,0 +1,35 @@
<script lang="ts">
import { Checkbox as CheckboxPrimitive } from "bits-ui";
import Check from "svelte-radix/Check.svelte";
import Minus from "svelte-radix/Minus.svelte";
import { cn } from "$lib/utils.js";
type $$Props = CheckboxPrimitive.Props;
type $$Events = CheckboxPrimitive.Events;
let className: $$Props["class"] = undefined;
export let checked: $$Props["checked"] = false;
export { className as class };
</script>
<CheckboxPrimitive.Root
class={cn(
"peer box-content h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[disabled=true]:cursor-not-allowed data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[disabled=true]:opacity-50",
className
)}
bind:checked
on:click
{...$$restProps}
>
<CheckboxPrimitive.Indicator
class={cn("flex h-4 w-4 items-center justify-center text-current")}
let:isChecked
let:isIndeterminate
>
{#if isIndeterminate}
<Minus class="h-3.5 w-3.5" />
{:else}
<Check class={cn("h-3.5 w-3.5", !isChecked && "text-transparent")} />
{/if}
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>

View file

@ -0,0 +1,6 @@
import Root from "./checkbox.svelte";
export {
Root,
//
Root as Checkbox,
};

View file

@ -0,0 +1,10 @@
<script lang="ts">
import * as Button from "$lib/components/ui/button/index.js";
type $$Props = Button.Props;
type $$Events = Button.Events;
</script>
<Button.Root type="submit" on:click on:keydown {...$$restProps}>
<slot />
</Button.Root>

View file

@ -0,0 +1,17 @@
<script lang="ts">
import * as FormPrimitive from "formsnap";
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
type $$Props = HTMLAttributes<HTMLSpanElement>;
let className: string | undefined | null = undefined;
export { className as class };
</script>
<FormPrimitive.Description
class={cn("text-sm text-muted-foreground", className)}
{...$$restProps}
let:descriptionAttrs
>
<slot {descriptionAttrs} />
</FormPrimitive.Description>

View file

@ -0,0 +1,25 @@
<script lang="ts" context="module">
import type { FormPathLeaves, SuperForm } from "sveltekit-superforms";
type T = Record<string, unknown>;
type U = FormPathLeaves<T>;
</script>
<script lang="ts" generics="T extends Record<string, unknown>, U extends FormPathLeaves<T>">
import type { HTMLAttributes } from "svelte/elements";
import * as FormPrimitive from "formsnap";
import { cn } from "$lib/utils.js";
type $$Props = FormPrimitive.ElementFieldProps<T, U> & HTMLAttributes<HTMLElement>;
export let form: SuperForm<T>;
export let name: U;
let className: $$Props["class"] = undefined;
export { className as class };
</script>
<FormPrimitive.ElementField {form} {name} let:constraints let:errors let:tainted let:value>
<div class={cn("space-y-2", className)}>
<slot {constraints} {errors} {tainted} {value} />
</div>
</FormPrimitive.ElementField>

View file

@ -0,0 +1,26 @@
<script lang="ts">
import * as FormPrimitive from "formsnap";
import { cn } from "$lib/utils.js";
type $$Props = FormPrimitive.FieldErrorsProps & {
errorClasses?: string | undefined | null;
};
let className: $$Props["class"] = undefined;
export { className as class };
export let errorClasses: $$Props["class"] = undefined;
</script>
<FormPrimitive.FieldErrors
class={cn("text-sm font-medium text-destructive", className)}
{...$$restProps}
let:errors
let:fieldErrorsAttrs
let:errorAttrs
>
<slot {errors} {fieldErrorsAttrs} {errorAttrs}>
{#each errors as error}
<div {...errorAttrs} class={cn(errorClasses)}>{error}</div>
{/each}
</slot>
</FormPrimitive.FieldErrors>

View file

@ -0,0 +1,25 @@
<script lang="ts" context="module">
import type { FormPath, SuperForm } from "sveltekit-superforms";
type T = Record<string, unknown>;
type U = FormPath<T>;
</script>
<script lang="ts" generics="T extends Record<string, unknown>, U extends FormPath<T>">
import type { HTMLAttributes } from "svelte/elements";
import * as FormPrimitive from "formsnap";
import { cn } from "$lib/utils.js";
type $$Props = FormPrimitive.FieldProps<T, U> & HTMLAttributes<HTMLElement>;
export let form: SuperForm<T>;
export let name: U;
let className: $$Props["class"] = undefined;
export { className as class };
</script>
<FormPrimitive.Field {form} {name} let:constraints let:errors let:tainted let:value>
<div class={cn("space-y-2", className)}>
<slot {constraints} {errors} {tainted} {value} />
</div>
</FormPrimitive.Field>

View file

@ -0,0 +1,30 @@
<script lang="ts" context="module">
import type { FormPath, SuperForm } from "sveltekit-superforms";
type T = Record<string, unknown>;
type U = FormPath<T>;
</script>
<script lang="ts" generics="T extends Record<string, unknown>, U extends FormPath<T>">
import * as FormPrimitive from "formsnap";
import { cn } from "$lib/utils.js";
type $$Props = FormPrimitive.FieldsetProps<T, U>;
export let form: SuperForm<T>;
export let name: U;
let className: $$Props["class"] = undefined;
export { className as class };
</script>
<FormPrimitive.Fieldset
{form}
{name}
let:constraints
let:errors
let:tainted
let:value
class={cn("space-y-2", className)}
>
<slot {constraints} {errors} {tainted} {value} />
</FormPrimitive.Fieldset>

View file

@ -0,0 +1,17 @@
<script lang="ts">
import type { Label as LabelPrimitive } from "bits-ui";
import { getFormControl } from "formsnap";
import { cn } from "$lib/utils.js";
import { Label } from "$lib/components/ui/label/index.js";
type $$Props = LabelPrimitive.Props;
let className: $$Props["class"] = undefined;
export { className as class };
const { labelAttrs } = getFormControl();
</script>
<Label {...$labelAttrs} class={cn("data-[fs-error]:text-destructive", className)} {...$$restProps}>
<slot {labelAttrs} />
</Label>

View file

@ -0,0 +1,17 @@
<script lang="ts">
import * as FormPrimitive from "formsnap";
import { cn } from "$lib/utils.js";
type $$Props = FormPrimitive.LegendProps;
let className: $$Props["class"] = undefined;
export { className as class };
</script>
<FormPrimitive.Legend
{...$$restProps}
class={cn("text-sm font-medium leading-none data-[fs-error]:text-destructive", className)}
let:legendAttrs
>
<slot {legendAttrs} />
</FormPrimitive.Legend>

View file

@ -0,0 +1,33 @@
import * as FormPrimitive from "formsnap";
import Description from "./form-description.svelte";
import Label from "./form-label.svelte";
import FieldErrors from "./form-field-errors.svelte";
import Field from "./form-field.svelte";
import Fieldset from "./form-fieldset.svelte";
import Legend from "./form-legend.svelte";
import ElementField from "./form-element-field.svelte";
import Button from "./form-button.svelte";
const Control = FormPrimitive.Control;
export {
Field,
Control,
Label,
Button,
FieldErrors,
Description,
Fieldset,
Legend,
ElementField,
//
Field as FormField,
Control as FormControl,
Description as FormDescription,
Label as FormLabel,
FieldErrors as FormFieldErrors,
Fieldset as FormFieldset,
Legend as FormLegend,
ElementField as FormElementField,
Button as FormButton,
};

View file

@ -0,0 +1,28 @@
import Root from "./input.svelte";
export type FormInputEvent<T extends Event = Event> = T & {
currentTarget: EventTarget & HTMLInputElement;
};
export type InputEvents = {
blur: FormInputEvent<FocusEvent>;
change: FormInputEvent<Event>;
click: FormInputEvent<MouseEvent>;
focus: FormInputEvent<FocusEvent>;
focusin: FormInputEvent<FocusEvent>;
focusout: FormInputEvent<FocusEvent>;
keydown: FormInputEvent<KeyboardEvent>;
keypress: FormInputEvent<KeyboardEvent>;
keyup: FormInputEvent<KeyboardEvent>;
mouseover: FormInputEvent<MouseEvent>;
mouseenter: FormInputEvent<MouseEvent>;
mouseleave: FormInputEvent<MouseEvent>;
paste: FormInputEvent<ClipboardEvent>;
input: FormInputEvent<InputEvent>;
wheel: FormInputEvent<WheelEvent>;
};
export {
Root,
//
Root as Input,
};

View file

@ -0,0 +1,41 @@
<script lang="ts">
import type { HTMLInputAttributes } from "svelte/elements";
import type { InputEvents } from "./index.js";
import { cn } from "$lib/utils.js";
type $$Props = HTMLInputAttributes;
type $$Events = InputEvents;
let className: $$Props["class"] = undefined;
export let value: $$Props["value"] = undefined;
export { className as class };
// Workaround for https://github.com/sveltejs/svelte/issues/9305
// Fixed in Svelte 5, but not backported to 4.x.
export let readonly: $$Props["readonly"] = undefined;
</script>
<input
class={cn(
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
className
)}
bind:value
{readonly}
on:blur
on:change
on:click
on:focus
on:focusin
on:focusout
on:keydown
on:keypress
on:keyup
on:mouseover
on:mouseenter
on:mouseleave
on:paste
on:input
on:wheel
{...$$restProps}
/>

View file

@ -0,0 +1,7 @@
import Root from "./label.svelte";
export {
Root,
//
Root as Label,
};

View file

@ -0,0 +1,21 @@
<script lang="ts">
import { Label as LabelPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = LabelPrimitive.Props;
type $$Events = LabelPrimitive.Events;
let className: $$Props["class"] = undefined;
export { className as class };
</script>
<LabelPrimitive.Root
class={cn(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
className
)}
{...$$restProps}
on:mousedown
>
<slot />
</LabelPrimitive.Root>

View file

@ -0,0 +1,7 @@
import Root from "./separator.svelte";
export {
Root,
//
Root as Separator,
};

View file

@ -0,0 +1,22 @@
<script lang="ts">
import { Separator as SeparatorPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = SeparatorPrimitive.Props;
let className: $$Props["class"] = undefined;
export let orientation: $$Props["orientation"] = "horizontal";
export let decorative: $$Props["decorative"] = undefined;
export { className as class };
</script>
<SeparatorPrimitive.Root
class={cn(
"shrink-0 bg-border",
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
className
)}
{orientation}
{decorative}
{...$$restProps}
/>

View file

@ -0,0 +1,7 @@
import Root from "./skeleton.svelte";
export {
Root,
//
Root as Skeleton,
};

View file

@ -0,0 +1,11 @@
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
type $$Props = HTMLAttributes<HTMLDivElement>;
let className: $$Props["class"] = undefined;
export { className as class };
</script>
<div class={cn("animate-pulse rounded-md bg-primary/10", className)} {...$$restProps}></div>

4
src/lib/formatting.ts Normal file
View file

@ -0,0 +1,4 @@
export function toFixedNumber(num: number, digits: number, base: number): number{
const pow: number = Math.pow(base ?? 10, digits);
return Math.round(num*pow) / pow;
}

1
src/lib/index.ts Normal file
View file

@ -0,0 +1 @@
// place files you want to import through the `$lib` alias in this folder.

298
src/lib/opensubsonic.ts Normal file
View file

@ -0,0 +1,298 @@
import {Md5} from "ts-md5";
import Cookies from 'js-cookie';
import {Disc} from "radix-icons-svelte";
function getIdent(): string {
let cookie = Cookies.get("subsonicPlayerIdent");
if (typeof cookie === "undefined") {
cookie = Math.random().toString(36).slice(2);
}
const options = {
expires: 7,
path: "/",
sameSite: "strict",
};
Cookies.set("subsonicPlayerIdent", cookie, options);
return cookie;
}
export module OpenSubsonic {
export let username: string = "";
export let password: string = "";
let token: string = "";
let salt: string = "";
export let base = "https://music.neshweb.net";
const apiVer = "1.16.1"; // Version supported by Navidrome. Variable for easier updating
export const clientName = "Lydstyrke-" + getIdent();
export async function get(path: string, parameters: Array<Parameter> = []) {
const apiPath = getApiUrl(path, parameters);
const res = (await fetch(apiPath));
if (res.ok) {
const contentType =res.headers.get("content-type");
switch (contentType) {
case("application/json"): {
return (await res.json())["subsonic-response"];
}
case("audio/mp4"): {
return res;
}
case("image/jpeg"): {
return res;
}
case("image/png"): {
return res;
}
default: {
console.warn(`Content Type: '${contentType}' is not supported`)
}
}
}
else {
return false;
}
}
export function getApiUrl(path: string, parameters: Array<Parameter> = []) {
let apiPath = generateBasePath(path);
parameters.forEach((parameter) => {
apiPath = apiPath + `&${parameter.key}=${parameter.value}`;
})
return apiPath;
}
const generateBasePath = (path: string) => {
if (username === "") {
const cookie = Cookies.get("subsonicUsername");
if (typeof cookie !== "undefined") {
username = cookie;
}
}
let cookie = Cookies.get("subsonicToken");
if (typeof cookie !== "undefined") {
token = cookie;
cookie = Cookies.get("subsonicSalt");
if (typeof cookie !== "undefined") {
salt = cookie;
}
}
else {
generateToken();
}
return `${base}/rest/${path}?u=${username}&s=${salt}&t=${token}&v=${apiVer}&c=${clientName}&f=json`;
}
const generateToken = () => {
salt = "staticfornow";
token = Md5.hashStr(password + salt);
}
export function storeCredentials() {
const options = {
expires: 7,
path: "/",
sameSite: "strict",
};
Cookies.set("subsonicToken", token, options);
Cookies.set("subsonicSalt", salt, options);
Cookies.set("subsonicUsername", username, options);
}
}
export interface Parameter {
key: string,
value: string
}
interface OpenSubsonicResponse {
status: string,
version: string,
type: string,
serverVersion: string,
openSubsonic: boolean,
}
export interface Song {
id: string,
parent?: string,
isDir: boolean,
title?: string,
album?: string,
artist?: string,
track?: number,
year?: number,
genre?: string,
coverArt?: string,
size?: number,
contentType?: string,
suffix?: string,
transcodedContentType?: string,
transcodedSuffix?: string,
duration?: number,
bitRate?: number,
bitDepth?: number,
samplingRate?: number,
channelCount?: number,
bitRate?: number,
path?: string,
isVideo?: boolean,
userRating?: number,
averageRating?: number,
playCount?: number,
discNumber?: number,
created?: string,
starred?: string,
albumId?: string,
artistId?: string,
type?: string,
mediaType?: string,
bookmarkPosition?: number,
originalWidth?: number,
originalHeight?: number,
played?: string,
bpm?: number,
comment?: string,
sortName?: string,
musicBrainzId?: string,
genres?: Array<ItemGenre>,
artists?: Array<ArtistID3>,
displayArtist?: string,
albumArtists?: Array<ArtistID3>,
displayAlbumArtist?: string,
contributors?: Array<Contributor>
displayComposer?: string,
moods?: Array<string>,
replayGain?: ReplayGain,
}
export interface ItemGenre {
name: string
}
export interface ReplayGain {
trackGain?: number,
albumGain?: number,
trackPeak?: number,
albumPeak?: number,
baseGain?: number,
fallbackGain?: number,
}
export interface NowPlayingResponse extends OpenSubsonicResponse {
nowPlaying: NowPlaying
}
interface NowPlaying {
entry: Array<NowPlayingEntry>
}
export interface NowPlayingEntry extends Song {
username: string,
minutesAgo?: string,
playerId?: number,
playerName?: string,
}
export interface GetPlayQueueResponse extends OpenSubsonicResponse {
playQueue: PlayQueue
}
interface PlayQueue extends NowPlaying {
dummy: string
}
export interface GetAlbumList2Response extends OpenSubsonicResponse {
albumList2: AlbumList2
}
export interface AlbumList2 {
album: Array<AlbumID3>
}
export interface AlbumID3 {
id: string,
name: string,
artist?: string,
artistId?: string,
coverArt?: string,
songCount: number,
duration: number,
playCount?: number,
created: string,
starred?: string,
year?: number,
genre?: string,
played?: string,
userRating?: number,
recordLabels?: Array<RecordLabel>,
musicBrainzId?: string,
genres?: Array<ItemGenre>,
artists?: Array<ArtistID3>,
displayArtist?: string,
releaseTypes?: Array<string>,
moods?: Array<string>,
sortName?: string,
originalReleaseDate?: ItemDate,
releaseDate?: ItemDate,
isCompilation?: boolean,
discTitles?: Array<DiscTitle>
}
export interface GetAlbumInfo2Response extends OpenSubsonicResponse {
albumInfo: AlbumInfo
}
export interface AlbumInfo {
notes?: string,
musicBrainzId?: string,
lastFmUrl?: string,
smallImageUrl?: string,
mediumImageUrl?: string,
largeImageUrl?: string,
}
export interface GetAlbumResponse extends OpenSubsonicResponse{
album: AlbumID3WithSongs
}
export interface AlbumID3WithSongs extends AlbumID3 {
song?: Array<Song>,
}
interface RecordLabel {
name: string
}
interface ArtistID3 {
id: string,
name: string,
coverArt?: string,
artistImageUrl?: string,
albumCount?: number,
starred?: string,
musicBrainzId?: string,
sortName?: string,
roles?: Array<string>
}
interface Contributor {
role: string,
subRole?: string,
artist: ArtistID3,
}
interface ItemDate {
year?: number,
month?: number,
day?: number,
}
interface DiscTitle {
disc: number,
title: string,
}

33
src/lib/player.svelte.ts Normal file
View file

@ -0,0 +1,33 @@
export enum PlaybackMode {
Linear,
LoopOne,
LoopQueue,
}
export class PlaybackStateSvelte {
values = {
[PlaybackMode.Linear]: "1",
[PlaybackMode.LoopOne]: "0",
[PlaybackMode.LoopQueue]: "00",
}
current: PlaybackMode = $state(PlaybackMode.Linear);
next = function() {
if (this.current == PlaybackMode.LoopQueue) {
this.current = -1;
}
return this.values[++this.current];
}
prev = function() {
if (this.current == PlaybackMode.Linear) {
this.current = this.values.length;
}
return this.values[--this.current];
}
get = function() {
return this.values[this.current];
}
}

View file

@ -0,0 +1,140 @@
import {
type GetPlayQueueResponse, type NowPlayingEntry,
type NowPlayingResponse,
OpenSubsonic,
type Parameter,
type Song
} from "$lib/opensubsonic";
import {playbackState} from "$lib/states/playback-state.svelte";
interface QueueState {
queue: Array<Song>,
currentIndex: number,
nextSong: () => Song,
setSong: (index: number) => void,
getSong: () => Song,
firstSong: () => Song,
findSong: (song: Song) => {found: boolean, index: number},
addSong: (song: Song) => void,
replaceQueue: (newQueue: Array<Song>) => void,
getPlayQueue: (addNowPlaying: boolean) => Promise<void>,
saveQueue: () => Promise<void>,
}
export const queueState: QueueState = $state({
queue: new Array<Song>(),
currentIndex: 0,
nextSong(): Song {
this.currentIndex += 1;
return this.queue[this.currentIndex];
},
setSong(index: number): void {
this.currentIndex = index;
},
getSong(): Song {
return this.queue[this.currentIndex];
},
firstSong(): Song {
this.currentIndex = 0;
return this.queue[this.currentIndex];
},
findSong(searchSong: Song): {found: boolean, index: number} {
const data = {
found: false,
index: 0,
}
for (const [index, song] of this.queue.entries()) {
if (song.id === searchSong.id) {
data.found = true;
data.index = index;
break;
}
}
return data;
},
addSong(newSong: Song): void {
this.queue.push(newSong);
this.currentIndex = this.queue.length - 1;
},
replaceQueue(newQueue: Array<Song>): void {
console.log(newQueue)
this.queue = [...newQueue];
this.currentIndex = 0;
},
async getPlayQueue(addNowPlaying: boolean = false): Promise<void> {
const queueData: GetPlayQueueResponse = await OpenSubsonic.get("getPlayQueue")
if (queueData && queueData.playQueue.entry) {
this.queue = queueData.playQueue.entry;
}
const nowPlayingData: NowPlayingResponse = await OpenSubsonic.get("getNowPlaying");
if (nowPlayingData && nowPlayingData.nowPlaying.entry) {
const userEntries: Array<NowPlayingEntry> = [];
nowPlayingData.nowPlaying.entry.forEach((entry) => {
if (entry.username === OpenSubsonic.username) {
userEntries.push(entry);
}
});
console.log(userEntries);
let localClientEntry = undefined;
userEntries.forEach((entry) => {
if (entry.playerName === OpenSubsonic.clientName) {
localClientEntry = entry;
}
})
if (typeof localClientEntry !== "undefined") {
if (this.findSong(localClientEntry).found) {
this.setSong(this.findSong(localClientEntry).index);
playbackState.newSong(this.getSong());
}
else if (addNowPlaying) {
this.addSong(localClientEntry);
playbackState.newSong(this.getSong());
}
else if (this.queue.length != 0) {
playbackState.newSong(this.firstSong());
}
}
else {
for (const entry of userEntries) {
if (this.findSong(entry).found) {
this.setSong(this.findSong(entry).index);
playbackState.newSong(this.getSong());
}
else if (addNowPlaying) {
this.addSong(entry);
playbackState.newSong(this.getSong());
}
else if (this.queue.length != 0) {
playbackState.newSong(this.firstSong());
}
}
}
}
},
async saveQueue(): Promise<void> {
const songs: Array<Parameter> = [];
console.log(this.queue);
this.queue.forEach((song: Song, idx: number): void => {
if (idx === 0) {
songs.push({key: "current", value: song.id})
songs.push({key: "id", value: song.id})
// Add Progress within current song
}
else {
songs.push({key: "id", value: song.id})
}
})
const data = await OpenSubsonic.get("savePlayQueue", songs);
if (data) {
await this.getPlayQueue();
}
}
})

View file

@ -0,0 +1,105 @@
import {PlaybackMode, PlaybackStateSvelte} from "$lib/player.svelte";
import {OpenSubsonic, type Parameter, type Song} from "$lib/opensubsonic";
import {queueState} from "$lib/states/play-queue.svelte";
import {shuffle} from "$lib/utilities";
interface PlaybackState {
loopMode: PlaybackStateSvelte,
shuffle: boolean,
song: HTMLAudioElement,
metaData: Song,
duration: number,
volume: number,
paused: boolean,
progress: number,
newSong: (song: Song) => void,
play: () => void,
pause: () => void,
}
export const playbackState: PlaybackState = $state({
loopMode: new PlaybackStateSvelte(),
shuffle: false,
song: {},
metaData: {},
duration: 0,
volume: 0.05,
paused: true,
progress: 0,
newSong(song: Song): void {
const parameters: Array<Parameter> = [
{ key: "id", value: song.id },
//{ key: "maxBitRate", value: } // TODO
//{ key: "format", value: } // TODO
//{ key: "timeOffset", value: } // TODO? Only Video related
//{ key: "size", value: } // TODO? Only Video related
{ key: "estimateContentLength", value: "true" },
//{ key: "converted", value: } // TODO? Only Video related
];
const url = OpenSubsonic.getApiUrl("stream", parameters);
this.song = new Audio(url); // Assign new URL
this.metaData = song;
// Reassign Event Handlers
this.song.onloadedmetadata = () => {
this.duration = this.song.duration;
};
this.song.onplay = () => {
this.song.volume = this.volume;
this.paused = this.song.paused;
const time: number = Date.now();
const parameters: Array<Parameter> = [
{ key: "id", value: song.id },
{ key: "time", value: time.toString()},
{ key: "submission", value: `${false}`}
];
OpenSubsonic.get("scrobble", parameters);
}
this.song.onpause = () => {
this.paused = this.song.paused;
}
this.song.ontimeupdate = () => {
this.progress = this.song.currentTime;
}
this.song.onended = () => {
switch (this.loopMode.current) {
case PlaybackMode.Linear: {
this.newSong(queueState.nextSong());
this.play();
break;
}
case PlaybackMode.LoopOne: {
this.play();
break;
}
case PlaybackMode.LoopQueue: {
if (queueState.currentIndex === queueState.queue.length -1) {
if (this.shuffle) {
const shuffledQueue = shuffle([...queueState.queue])
queueState.replaceQueue(shuffledQueue);
}
this.newSong(queueState.firstSong());
}
else {
this.newSong(queueState.nextSong());
}
this.play();
break;
}
}
}
this.song.load();
},
play() {
this.song.play().catch((): void => {});
},
pause() {
console.log(this.song);
this.song.pause();
}
})

View file

@ -0,0 +1,30 @@
import {AlbumView, View} from "$lib/components/custom/Views/views.svelte";
interface ViewState {
current: ViewDetails,
previous?: ViewState,
parent?: ViewState,
setMode: (newMode: View) => void,
setSubMode: (newSubMode: AlbumView) => void,
}
interface ViewDetails {
// sort
mode: View,
subMode: AlbumView,
}
export const viewState: ViewState = $state<ViewState>({
current: {
mode: View.Albums,
subMode: AlbumView.All,
},
setSubMode(newSubMode: AlbumView): void {
this.previous = this.current;
this.current.subMode = newSubMode;
},
setMode(newMode: View): void {
this.previous = this.current;
this.current.mode = newMode;
}
})

7
src/lib/time-format.ts Normal file
View file

@ -0,0 +1,7 @@
export function timeFormat(time: number) {
const minutes = (time / 60).toFixed(0).toString();
const seconds = time % 60;
const secondsString = (seconds < 10) ? '0' + seconds.toString() : seconds.toString()
return minutes + ":" + secondsString;
}

23
src/lib/utilities.ts Normal file
View file

@ -0,0 +1,23 @@
import type {Song} from "$lib/opensubsonic";
export function displayTime(rawSeconds: number) {
const intSeconds = Math.round(rawSeconds);
const seconds = intSeconds % 60;
const minutes = Math.floor((intSeconds / 60)) % 60;
const hours = Math.floor((intSeconds / 3600));
if (hours == 0) {
return `${minutes.toString()}:${seconds.toString().padStart(2, 0)}`
}
else {
return `${hours}:${minutes.toString().padStart(2, 0)}:${seconds.toString().padStart(2, 0)}`
}
}
export const shuffle = (array: Array<Song>) => {
for (let i: number = array.length - 1; i > 0; i--) {
const j: number = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
};

62
src/lib/utils.ts Normal file
View file

@ -0,0 +1,62 @@
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
import { cubicOut } from "svelte/easing";
import type { TransitionConfig } from "svelte/transition";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
type FlyAndScaleParams = {
y?: number;
x?: number;
start?: number;
duration?: number;
};
export const flyAndScale = (
node: Element,
params: FlyAndScaleParams = { y: -8, x: 0, start: 0.95, duration: 150 }
): TransitionConfig => {
const style = getComputedStyle(node);
const transform = style.transform === "none" ? "" : style.transform;
const scaleConversion = (
valueA: number,
scaleA: [number, number],
scaleB: [number, number]
) => {
const [minA, maxA] = scaleA;
const [minB, maxB] = scaleB;
const percentage = (valueA - minA) / (maxA - minA);
const valueB = percentage * (maxB - minB) + minB;
return valueB;
};
const styleToString = (
style: Record<string, number | string | undefined>
): string => {
return Object.keys(style).reduce((str, key) => {
if (style[key] === undefined) return str;
return str + `${key}:${style[key]};`;
}, "");
};
return {
duration: params.duration ?? 200,
delay: 0,
css: (t) => {
const y = scaleConversion(t, [0, 1], [params.y ?? 5, 0]);
const x = scaleConversion(t, [0, 1], [params.x ?? 0, 0]);
const scale = scaleConversion(t, [0, 1], [params.start ?? 0.95, 1]);
return styleToString({
transform: `${transform} translate3d(${x}px, ${y}px, 0) scale(${scale})`,
opacity: t
});
},
easing: cubicOut
};
};

View file

@ -1,201 +0,0 @@
mod components;
use std::env;
use sycamore::prelude::*;
use sycamore::futures::spawn_local_scoped;
use serde::Deserialize;
use log::{info, warn, error, Level, debug};
fn main() {
console_log::init_with_level(Level::Debug).expect("Something went horribly wrong while setting the Logging Level");
sycamore::render(|| view! {
div(class="flex flex-col h-full") {
div(class="min-w-full p-1 debug") {
h1 { "Navbar" }
}
div(class="flex-1 grid grid-cols-5 debug") {
div(class="col-span-1 debug") {
h1 { "Left Sidebar" }
}
div(class="col-span-3 debug") {
h1 { "Center Module" }
}
div(class="col-span-1 flex flex-col gap-1 p-2 debug") {
div(class="flex flex-row w-full gap-2 items-center") {
h1(class="flex flex-1") { "Current Queue" }
p { "Fetch" }
p { "Upload" }
}
components::separator(width = 100)
crate::render_playlist {}
}
}
div(class="min-h-24 h-24 debug") {
h3 { "Player Module" }
}
}
});
}
#[derive(Deserialize)]
struct PlayQueueApi {
#[serde(alias="subsonic-response")]
subsonic_response: SubsonicResponse
}
#[derive(Deserialize)]
struct SubsonicResponse {
status: String,
version: String,
r#type: String,
#[serde(alias="serverVersion")]
server_version: String,
#[serde(alias="openSubsonic")]
open_subsonic: bool,
#[serde(alias="playQueue")]
play_queue: PlayQueue,
}
#[derive(Debug, Deserialize)]
struct PlayQueue {
entry: Vec<Song>,
current: Option<String>,
position: Option<usize>,
username: String,
changed: String,
#[serde(alias="changedBy")]
changed_by: String
}
#[derive(Clone, Debug, Deserialize)]
struct Song {
id: String,
parent: String,
#[serde(alias="isDir")]
is_dir: bool,
title: String,
album: String,
artist: String,
track: usize,
year: usize,
genre: String,
genres: Vec<Genre>,
#[serde(alias="coverArt")]
cover_art: String,
size: usize,
#[serde(alias="contentType")]
content_type: String,
suffix: String,
duration: usize,
#[serde(alias="bitRate")]
bit_rate: usize,
path: String,
#[serde(alias="playCount")]
play_count: usize,
played: String,
#[serde(alias="discNumber")]
disc_number: usize,
created: String,
#[serde(alias="albumId")]
album_id: String,
#[serde(alias="artistId")]
artist_id: String,
r#type: String,
#[serde(alias="userRating")]
user_rating: Option<usize>,
#[serde(alias="isVideo")]
is_video: bool,
bpm: usize,
comment: String
}
#[derive(Debug, Clone, Deserialize)]
struct Genre {
name: String
}
async fn test_api() -> Vec<Song> {
const API_BASE: &str = "https://music.neshweb.net/rest";
let salt = "testsalt1234"; // TODO: random salt please
let salted_password = format!("{password}{salt}");
let hash = md5::compute(salted_password.as_bytes());
let res = match reqwest::get(format!("{API_BASE}/getPlayQueue.view?u={user}&t={:x}&s={salt}&v=1.16.1&c={}&f=json", hash, env!("CARGO_PKG_NAME"))).await {
Ok(data) => data,
Err(e) => {
error!("Error: {e}");
return vec![]
},
};
debug!("Still alive!");
let data = match res.json::<PlayQueueApi>().await {
Ok(data) => data,
Err(e) => {
error!("Error: {e}");
return vec![]
},
};
data.subsonic_response.play_queue.entry.iter().map(|elem| {
elem.clone()
}).collect()
/*
let res = reqwest::blocking::get(format!("{api_base}/getPlayQueue.view?u={user}&t={:x}&s={salt}&v=1.16.1&c=myapp&f=json", hash)).unwrap();
let text = res.text().unwrap();
println!("{text}");
let song_id = "81983bfae2fdddfa5d3dc181d61d987c";
let song_pos = 1;
let res_save = reqwest::blocking::get(format!("{api_base}/savePlayQueue.view?u={user}&t={:x}&s={salt}&v=1.16.1&c={}&f=json&id={song_id}&pos={song_pos}", hash, env!("CARGO_PKG_NAME"))).unwrap();
let text_save = res_save.text().unwrap();
println!("{text_save}");*/
}
#[component]
fn render_playlist<G: Html>() -> View<G> {
let list: Signal<Vec<Song>> = create_signal(vec![]);
info!("Info Test");
debug!("Debug Test");
spawn_local_scoped(async move {
debug!("Moving into spawned task");
let res = test_api().await;
debug!("Data from spawned task returned");
list.set(res);
});
create_effect(move || {
debug!("List is: {:#?}", list.get_clone());
});
view! {
(View::new_fragment(list.get_clone().iter().map(|elem: &Song| {
let song = elem.clone();
view! {
p { (song.artist) " - " (song.title) " (" (seconds_to_duration(song.duration)) ")" }
}
}).collect()))
}
}
fn seconds_to_duration(raw_seconds: usize) -> String {
let minutes = raw_seconds / 60;
let seconds = raw_seconds % 60;
format!("{minutes}:{seconds}")
}

View file

@ -0,0 +1,13 @@
import {redirect} from "@sveltejs/kit";
export function load({ cookies, url }) {
let auth = cookies.get("subsonicToken");
if (typeof auth === "undefined" && url.pathname !== "/login") {
cookies.set("preLoginRoute", `${url.pathname}`, {
path: "/login",
secure: false,
httpOnly: false,
});
throw redirect(302, '/login');
}
}

36
src/routes/+layout.svelte Normal file
View file

@ -0,0 +1,36 @@
<svelte:options runes={true} />
<script>
import "../app.pcss";
import QueueFrame from "$lib/components/custom/QueueFrame.svelte";
import {onMount} from "svelte";
import PlayerControls from "$lib/components/custom/PlayerControls.svelte";
import PlayerSidebar from "$lib/components/custom/PlayerSidebar.svelte";
import {queueState} from "$lib/states/play-queue.svelte";
import {playbackState} from "$lib/states/playback-state.svelte";
let { children } = $props();
onMount(() => {
queueState.getPlayQueue(true);
playbackState.song = new Audio(); // needed so source is not undefined
})
</script>
<div class="h-full flex flex-col">
<div class="border border-2 p-1">
<h1>Navbar</h1>
</div>
<!--<QueueFrame queue={queueState} {fetchQueue} {saveQueue} {removeSongFromQueue} {playSong} currentIndex={currentSong.queueIndex} />-->
<div class="border border-2 flex-1 grid grid-cols-5 h-1 min-h-fit">
<PlayerSidebar />
<div class="border border-2 col-span-3 overflow-hidden">
{@render children()}
</div>
<QueueFrame />
</div>
<div class="border border-2 min-h-24 h-24">
<PlayerControls />
</div>
</div>

23
src/routes/+page.svelte Normal file
View file

@ -0,0 +1,23 @@
<svelte:options runes={true} />
<script lang="ts">
import {onMount} from "svelte";
import AlbumsView from "$lib/components/custom/Views/AlbumsView.svelte";
import {View} from "$lib/components/custom/Views/views.svelte";
import {queueState} from "$lib/states/play-queue.svelte";
import {playbackState} from "$lib/states/playback-state.svelte";
import {viewState} from "$lib/states/view-state.svelte";
</script>
<svelte:head>
<title>Lydstyrke - {playbackState.metaData.title}({playbackState.metaData.artist})</title>
<meta name="robots" content="noindex nofollow" />
</svelte:head>
{#if viewState.current.mode === View.Albums}es
<AlbumsView />
{:else if viewState.current.mode === View.Artists}
<p>Get Fucked</p>
{/if}

View file

@ -0,0 +1,185 @@
<svelte:options runes={true} />
<script lang="ts">
import {onMount} from "svelte";
import {goto} from "$app/navigation";
import {
type AlbumID3WithSongs,
type GetAlbumInfo2Response, type GetAlbumResponse,
OpenSubsonic,
type Parameter, type Song
} from "$lib/opensubsonic";
import {queueState} from "$lib/states/play-queue.svelte";
import {playbackState} from "$lib/states/playback-state.svelte";
import {Button} from "$lib/components/ui/button";
import {shuffle} from "$lib/utilities";
import {displayTime} from "$lib/utilities.js";
import {Checkbox} from "$lib/components/ui/checkbox";
class AlbumData {
data: AlbumID3WithSongs = $state({})
}
let { data } = $props();
let albumId = $derived(data.albumId);
let album = $state(new AlbumData());
let loading = $state(true);
console.log("album:", data.albumId)
async function fetchAlbumInfos(): Promise<void> {
let parameters: Array<Parameter> = [
{key: "id", value: albumId},
];
const infoData: GetAlbumInfo2Response = await OpenSubsonic.get("getAlbumInfo2", parameters);
if (infoData) {
album.info = infoData.albumInfo;
}
const albumResponse: GetAlbumResponse = await OpenSubsonic.get("getAlbum", parameters);
if (albumResponse && albumResponse.album.song) {
album.data = albumResponse.album;
}
loading = false;
}
function getAlbumImage() {
if (album.info.mediumImageUrl) {
return album.info.mediumImageUrl;
}
else if (album.info.largeImageUrl) {
return album.info.largeImageUrl;
}
else if (album.info.smallImageUrl) {
return album.info.smallImageUrl;
}
else {
return "";
}
}
let scrollY = $state(0);
let scrollYMax = $state(1);
function updateScroll(self) {
scrollY = self.scrollTop;
scrollYMax = self.scrollTopMax;
}
$effect(() => {
if(scrollY/scrollYMax > 0.7 && albums.length === 100 && !albums.paginating) {
console.log("triggered")
}
})
function selectAlbum(albumId) {
goto(`/album/${albumId}`);
console.log(albumId);
}
function playSong( song: Song) {
queueState.addSong(song);
playbackState.pause();
playbackState.newSong(queueState.getSong());
playbackState.play();
}
let playHover = $state(false);
let shuffleHover = $state(false);
function playAlbum(addToQueue = false) {
if (addToQueue) {
const queuePosition = queueState.currentIndex;
album.data.song.forEach((song) => {
queueState.addSong(song);
})
queueState.setSong(queuePosition);
}
else {
queueState.replaceQueue(album.data.song);
console.log(queueState.queue);
playbackState.pause();
playbackState.newSong(queueState.getSong());
playbackState.play();
}
}
function shuffleAlbum(addToQueue = false) {
const shuffledAlbum = shuffle([...album.data.song])
if (addToQueue) {
const queuePosition = queueState.currentIndex;
shuffledAlbum.forEach((song) => {
queueState.addSong(song);
})
queueState.setSong(queuePosition);
}
else {
queueState.replaceQueue(shuffledAlbum);
console.log(queueState.queue);
playbackState.pause();
playbackState.newSong(queueState.getSong());
playbackState.play();
}
}
async function toggleStarred() {
const parameters = [
{key: "albumId", value: album.data.id}
];
if (album.data.starred) {
await OpenSubsonic.get("unstar", parameters);
}
else {
await OpenSubsonic.get("star", parameters)
}
fetchAlbumInfos();
}
onMount(() => {
fetchAlbumInfos();
})
</script>
{#if loading}
<p>Loading</p>
{:else}
<div class="flex flex-row gap-4">
<img alt={album.data.name + " Album Cover"} src={getAlbumImage()} height="312px" width="312px" class="rounded-md" />
<div>
<h1>{album.data.name}</h1>
<h2>{album.data.artist}</h2>
<p>{album.info.notes}</p>
<p>{album.info.lastFmUrl}</p>
<p>{album.info.musicBrainzId}</p>
<p>Length: {displayTime(album.data.duration)}</p>
<p>{album.data.genre}</p>
<p>{"*".repeat(album.data.userRating)}</p>
<Checkbox id="starred" checked={album.data.starred} onclick={() => toggleStarred()} />
</div>
</div>
<div class="flex">
<div class="flex flex-col" onmouseover={() => playHover = true} onmouseleave={() => playHover = false}>
<Button onclick={() => playAlbum()}>Play</Button>
{#if playHover}
<Button onclick={() => playAlbum(true)}>Add To Queue</Button>
{/if}
</div>
<div class="flex flex-col" onmouseover={() => shuffleHover = true} onmouseleave={() => shuffleHover = false}>
<Button onclick={() => shuffleAlbum()}>Shuffle</Button>
{#if shuffleHover}
<Button onclick={() => shuffleAlbum(true)}>Add To Queue</Button>
{/if}
</div>
</div>
<div class="border border-2 p-2 rounded-md">
{#each album.data.song as song}
<p onclick={() => playSong(song)}>{song.title}</p>
{/each}
</div>
{/if}

View file

@ -0,0 +1,7 @@
import type { RouteParams } from './$types';
export const load = ({ params }: { params: RouteParams }) => {
return {
albumId: params.albumId
}
}

View file

@ -0,0 +1,38 @@
<svelte:options runes={true} />
<script lang="ts">
import {onMount} from "svelte";
import {goto} from "$app/navigation";
import {AlbumState} from "$lib/components/custom/Views/album-pages-utils.svelte";
import AlbumComponent from "$lib/components/custom/Views/AlbumComponent.svelte";
let scrollY = $state(0);
let scrollYMax = $state(1);
let albums: AlbumState = $state(new AlbumState());
albums.setMode("alphabeticalByName")
function updateScroll(self) {
scrollY = self.scrollTop;
scrollYMax = self.scrollTopMax;
}
$effect(() => {
if(scrollY/scrollYMax > 0.7 && albums.length === 100 && !albums.paginating) {
console.log("triggered")
albums.paginating = true;
albums.fetchAlbums();
}
})
function selectAlbum(albumId) {
goto(`/album/${albumId}`);
console.log(albumId);
}
onMount(() => {
albums.fetchAlbums();
})
</script>
<AlbumComponent {albums} {updateScroll} {selectAlbum} />

View file

@ -0,0 +1,37 @@
<svelte:options runes={true} />
<script lang="ts">
import {onMount} from "svelte";
import {goto} from "$app/navigation";
import {AlbumState} from "$lib/components/custom/Views/album-pages-utils.svelte";
import AlbumComponent from "$lib/components/custom/Views/AlbumComponent.svelte";
let scrollY = $state(0);
let scrollYMax = $state(1);
let albums: AlbumState = $state(new AlbumState());
albums.setMode("starred")
function updateScroll(self) {
scrollY = self.scrollTop;
scrollYMax = self.scrollTopMax;
}
$effect(() => {
if(scrollY/scrollYMax > 0.7 && albums.length === 100 && !albums.paginating) {
console.log("triggered")
albums.paginating = true;
albums.fetchAlbums();
}
})
function selectAlbum(albumId) {
goto(`/album/${albumId}`);
console.log(albumId);
}
onMount(() => {
albums.fetchAlbums();
})
</script>
<AlbumComponent {albums} {updateScroll} {selectAlbum} />

View file

@ -0,0 +1,37 @@
<svelte:options runes={true} />
<script lang="ts">
import {onMount} from "svelte";
import {goto} from "$app/navigation";
import {AlbumState} from "$lib/components/custom/Views/album-pages-utils.svelte";
import AlbumComponent from "$lib/components/custom/Views/AlbumComponent.svelte";
let scrollY = $state(0);
let scrollYMax = $state(1);
let albums: AlbumState = $state(new AlbumState());
albums.setMode("frequent")
function updateScroll(self) {
scrollY = self.scrollTop;
scrollYMax = self.scrollTopMax;
}
$effect(() => {
if(scrollY/scrollYMax > 0.7 && albums.length === 100 && !albums.paginating) {
console.log("triggered")
albums.paginating = true;
albums.fetchAlbums();
}
})
function selectAlbum(albumId) {
goto(`/album/${albumId}`);
console.log(albumId);
}
onMount(() => {
albums.fetchAlbums();
})
</script>
<AlbumComponent {albums} {updateScroll} {selectAlbum} />

View file

@ -0,0 +1,37 @@
<svelte:options runes={true} />
<script lang="ts">
import {onMount} from "svelte";
import {goto} from "$app/navigation";
import {AlbumState} from "$lib/components/custom/Views/album-pages-utils.svelte";
import AlbumComponent from "$lib/components/custom/Views/AlbumComponent.svelte";
let scrollY = $state(0);
let scrollYMax = $state(1);
let albums: AlbumState = $state(new AlbumState());
albums.setMode("random")
function updateScroll(self) {
scrollY = self.scrollTop;
scrollYMax = self.scrollTopMax;
}
$effect(() => {
if(scrollY/scrollYMax > 0.7 && albums.length === 100 && !albums.paginating) {
console.log("triggered")
albums.paginating = true;
albums.fetchAlbums();
}
})
function selectAlbum(albumId) {
goto(`/album/${albumId}`);
console.log(albumId);
}
onMount(() => {
albums.fetchAlbums();
})
</script>
<AlbumComponent {albums} {updateScroll} {selectAlbum} />

View file

@ -0,0 +1,37 @@
<svelte:options runes={true} />
<script lang="ts">
import {onMount} from "svelte";
import {goto} from "$app/navigation";
import {AlbumState} from "$lib/components/custom/Views/album-pages-utils.svelte";
import AlbumComponent from "$lib/components/custom/Views/AlbumComponent.svelte";
let scrollY = $state(0);
let scrollYMax = $state(1);
let albums: AlbumState = $state(new AlbumState());
albums.setMode("newest")
function updateScroll(self) {
scrollY = self.scrollTop;
scrollYMax = self.scrollTopMax;
}
$effect(() => {
if(scrollY/scrollYMax > 0.7 && albums.length === 100 && !albums.paginating) {
console.log("triggered")
albums.paginating = true;
albums.fetchAlbums();
}
})
function selectAlbum(albumId) {
goto(`/album/${albumId}`);
console.log(albumId);
}
onMount(() => {
albums.fetchAlbums();
})
</script>
<AlbumComponent {albums} {updateScroll} {selectAlbum} />

View file

@ -0,0 +1,37 @@
<svelte:options runes={true} />
<script lang="ts">
import {onMount} from "svelte";
import {goto} from "$app/navigation";
import {AlbumState} from "$lib/components/custom/Views/album-pages-utils.svelte";
import AlbumComponent from "$lib/components/custom/Views/AlbumComponent.svelte";
let scrollY = $state(0);
let scrollYMax = $state(1);
let albums: AlbumState = $state(new AlbumState());
albums.setMode("recent")
function updateScroll(self) {
scrollY = self.scrollTop;
scrollYMax = self.scrollTopMax;
}
$effect(() => {
if(scrollY/scrollYMax > 0.7 && albums.length === 100 && !albums.paginating) {
console.log("triggered")
albums.paginating = true;
albums.fetchAlbums();
}
})
function selectAlbum(albumId) {
goto(`/album/${albumId}`);
console.log(albumId);
}
onMount(() => {
albums.fetchAlbums();
})
</script>
<AlbumComponent {albums} {updateScroll} {selectAlbum} />

View file

@ -0,0 +1,37 @@
<svelte:options runes={true} />
<script lang="ts">
import {onMount} from "svelte";
import {goto} from "$app/navigation";
import {AlbumState} from "$lib/components/custom/Views/album-pages-utils.svelte";
import AlbumComponent from "$lib/components/custom/Views/AlbumComponent.svelte";
let scrollY = $state(0);
let scrollYMax = $state(1);
let albums: AlbumState = $state(new AlbumState());
albums.setMode("highest")
function updateScroll(self) {
scrollY = self.scrollTop;
scrollYMax = self.scrollTopMax;
}
$effect(() => {
if(scrollY/scrollYMax > 0.7 && albums.length === 100 && !albums.paginating) {
console.log("triggered")
albums.paginating = true;
albums.fetchAlbums();
}
})
function selectAlbum(albumId) {
goto(`/album/${albumId}`);
console.log(albumId);
}
onMount(() => {
albums.fetchAlbums();
})
</script>
<AlbumComponent {albums} {updateScroll} {selectAlbum} />

View file

@ -0,0 +1,26 @@
import type { PageServerLoad, Actions } from "./$types.js";
import { fail } from "@sveltejs/kit";
import { superValidate } from "sveltekit-superforms";
import { formSchema } from "./schema";
import { zod } from "sveltekit-superforms/adapters";
export const load: PageServerLoad = async () => {
return {
form: await superValidate(zod(formSchema)),
};
};
export const actions: Actions = {
default: async (event) => {
const form = await superValidate(event, zod(formSchema));
if (!form.valid) {
return fail(400, {
form,
});
}
return {
form,
};
},
};

View file

@ -0,0 +1,26 @@
<script lang="ts">
import * as Card from "$lib/components/ui/card";
import LoginForm from "./login-form.svelte";
import type { PageData } from "./$types.js";
export let data: PageData;
</script>
<svelte:head>
<title>Lydstyrke - Login</title>
<meta name="robots" content="noindex nofollow" />
</svelte:head>
<div class="h-full flex flex-col items-center justify-center">
<Card.Root class="border-2 p-2">
<Card.Header>
<Card.Title class="text-center">Login</Card.Title>
<Card.Description></Card.Description>
</Card.Header>
<Card.Content>
<LoginForm data={data.form}></LoginForm>
</Card.Content>
<Card.Footer>
<p class="text-xs text-secondary pt-4">Sign Up (not implemented)</p>
</Card.Footer>
</Card.Root>
</div>

View file

@ -0,0 +1,83 @@
<svelte:options runes={true} />
<script lang="ts">
import { Input } from "$lib/components/ui/input";
import * as Form from "$lib/components/ui/form";
import { formSchema, type FormSchema } from "./schema";
import {OpenSubsonic} from "$lib/opensubsonic";
import {
type SuperValidated,
type Infer,
superForm,
} from "sveltekit-superforms";
import { zodClient } from "sveltekit-superforms/adapters";
import Cookies from 'js-cookie'
import {goto} from "$app/navigation";
import LoadingSpinner from "$lib/components/custom/LoadingSpinner.svelte";
let { data }: SuperValidated<Infer<FormSchema>> = $props<{ data: SuperValidated<Infer<FormSchema>> }>();
const form = superForm(data, {
validators: zodClient(formSchema),
onUpdated() {
OpenSubsonic.username = previousForm.get("username");
OpenSubsonic.password = previousForm.get("password");
OpenSubsonic.get("ping").then((data) => {
if (data) {
if (data.status === "ok") {
OpenSubsonic.storeCredentials();
loading = false;
let route = Cookies.get("preLoginRoute")
Cookies.remove("preLoginRoute", { path: "/login" })
goto(route);
}
else {
error = true;
loading = false;
}
}
else {
error = true;
loading = false;
}
});
},
onSubmit({ formData }) {
loading = true;
previousForm = formData;
}
});
let previousForm: FormData = $state({});
const { form: formData, enhance } = form;
let error = $state(false);
let loading = $state(false);
</script>
<form method="POST" use:enhance>
<Form.Field {form} name="username" class="px-3">
<Form.Control let:attrs>
<Form.Label>Username:</Form.Label>
<Input {...attrs} bind:value={$formData.username}></Input>
</Form.Control>
<Form.FieldErrors></Form.FieldErrors>
</Form.Field>
<Form.Field {form} name="password" class="px-3">
<Form.Control let:attrs>
<Form.Label>Password:</Form.Label>
<Input {...attrs} type="password" bind:value={$formData.password}></Input>
</Form.Control>
<Form.FieldErrors></Form.FieldErrors>
</Form.Field>
<div class="flex flex-row justify-center pt-2">
{#if loading}
<LoadingSpinner />
{:else}
<Form.Button>Login</Form.Button>
{/if}
</div>
{#if error}
<p class="pt-2 text-sm text-destructive">Username or Password incorrect</p>
{/if}
</form>

View file

@ -0,0 +1,10 @@
import { z } from "zod";
export const formSchema = z.object({
username: z.string().min(2).max(64),
password: z.string().min(2).max(64),
});
export type FormSchema = typeof formSchema;

BIN
static/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -1,24 +0,0 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
h1 {
@apply text-2xl;
@apply font-bold;
}
h2 {
@apply text-xl;
@apply font-bold;
}
h3 {
@apply text-lg;
@apply font-bold;
}
}
.debug {
@apply border;
@apply border-2;
@apply border-black;
}

18
svelte.config.js Normal file
View file

@ -0,0 +1,18 @@
import adapter from "@sveltejs/adapter-node";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: [vitePreprocess({})],
kit: {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter(),
},
};
export default config;

View file

@ -1,3 +1,64 @@
module.exports = {
content: [ "./src/**/*.rs", "./index.html" ]
import { fontFamily } from "tailwindcss/defaultTheme";
/** @type {import('tailwindcss').Config} */
const config = {
darkMode: ["class"],
content: ["./src/**/*.{html,js,svelte,ts}"],
safelist: ["dark"],
theme: {
container: {
center: true,
padding: "2rem",
screens: {
"2xl": "1400px"
}
},
extend: {
colors: {
border: "hsl(var(--border) / <alpha-value>)",
input: "hsl(var(--input) / <alpha-value>)",
ring: "hsl(var(--ring) / <alpha-value>)",
background: "hsl(var(--background) / <alpha-value>)",
foreground: "hsl(var(--foreground) / <alpha-value>)",
primary: {
DEFAULT: "hsl(var(--primary) / <alpha-value>)",
foreground: "hsl(var(--primary-foreground) / <alpha-value>)"
},
secondary: {
DEFAULT: "hsl(var(--secondary) / <alpha-value>)",
foreground: "hsl(var(--secondary-foreground) / <alpha-value>)"
},
destructive: {
DEFAULT: "hsl(var(--destructive) / <alpha-value>)",
foreground: "hsl(var(--destructive-foreground) / <alpha-value>)"
},
muted: {
DEFAULT: "hsl(var(--muted) / <alpha-value>)",
foreground: "hsl(var(--muted-foreground) / <alpha-value>)"
},
accent: {
DEFAULT: "hsl(var(--accent) / <alpha-value>)",
foreground: "hsl(var(--accent-foreground) / <alpha-value>)"
},
popover: {
DEFAULT: "hsl(var(--popover) / <alpha-value>)",
foreground: "hsl(var(--popover-foreground) / <alpha-value>)"
},
card: {
DEFAULT: "hsl(var(--card) / <alpha-value>)",
foreground: "hsl(var(--card-foreground) / <alpha-value>)"
}
},
borderRadius: {
lg: "var(--radius)",
md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)"
},
fontFamily: {
sans: [...fontFamily.sans]
}
}
},
};
export default config;

19
tsconfig.json Normal file
View file

@ -0,0 +1,19 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}

9
vite.config.ts Normal file
View file

@ -0,0 +1,9 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()],
server: {
host: '::'
}
});

2597
yarn.lock Normal file

File diff suppressed because it is too large Load diff