├── .editorconfig ├── .gitignore ├── .tx └── config ├── LICENSE.txt ├── README.md ├── angular.json ├── e2e ├── app.e2e-spec.ts ├── app.po.ts └── tsconfig.e2e.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── protractor.conf.js ├── src ├── app │ ├── album │ │ ├── album.component.html │ │ ├── album.component.scss │ │ ├── album.component.spec.ts │ │ └── album.component.ts │ ├── albums │ │ ├── albums.component.html │ │ ├── albums.component.scss │ │ ├── albums.component.spec.ts │ │ └── albums.component.ts │ ├── app-routing.module.ts │ ├── app.component.html │ ├── app.component.scss │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── artists │ │ ├── artists.component.html │ │ ├── artists.component.scss │ │ ├── artists.component.spec.ts │ │ └── artists.component.ts │ ├── login │ │ ├── login.component.html │ │ ├── login.component.scss │ │ ├── login.component.spec.ts │ │ └── login.component.ts │ ├── profile │ │ ├── profile.component.html │ │ ├── profile.component.scss │ │ ├── profile.component.spec.ts │ │ └── profile.component.ts │ ├── search-result │ │ ├── search-result.component.html │ │ ├── search-result.component.scss │ │ ├── search-result.component.spec.ts │ │ └── search-result.component.ts │ ├── settings │ │ ├── media-folders-settings │ │ │ ├── media-folders-settings.component.html │ │ │ ├── media-folders-settings.component.scss │ │ │ ├── media-folders-settings.component.spec.ts │ │ │ └── media-folders-settings.component.ts │ │ ├── settings.component.html │ │ ├── settings.component.scss │ │ ├── settings.component.spec.ts │ │ └── settings.component.ts │ ├── shared │ │ ├── auth │ │ │ └── AuthInterceptor.ts │ │ ├── component │ │ │ ├── album-card │ │ │ │ ├── album-card.component.html │ │ │ │ ├── album-card.component.scss │ │ │ │ ├── album-card.component.spec.ts │ │ │ │ └── album-card.component.ts │ │ │ ├── media-controls │ │ │ │ ├── media-controls.component.html │ │ │ │ ├── media-controls.component.scss │ │ │ │ ├── media-controls.component.spec.ts │ │ │ │ └── media-controls.component.ts │ │ │ └── song-table │ │ │ │ ├── song-table.component.html │ │ │ │ ├── song-table.component.scss │ │ │ │ ├── song-table.component.spec.ts │ │ │ │ └── song-table.component.ts │ │ ├── directive │ │ │ └── click-outside.directive.ts │ │ ├── domain │ │ │ ├── album.domain.ts │ │ │ ├── artist.domain.ts │ │ │ ├── auth.domain.ts │ │ │ ├── media-file.domain.ts │ │ │ ├── music-directory.domain.ts │ │ │ ├── search.domain.ts │ │ │ ├── user.domain.ts │ │ │ └── users.domain.ts │ │ ├── guards │ │ │ ├── auth.guard.spec.ts │ │ │ ├── auth.guard.ts │ │ │ ├── roles.guard.spec.ts │ │ │ └── roles.guard.ts │ │ ├── pipe │ │ │ ├── time.pipe.spec.ts │ │ │ └── time.pipe.ts │ │ ├── provider │ │ │ └── audio.provider.ts │ │ └── service │ │ │ ├── album.service.spec.ts │ │ │ ├── album.service.ts │ │ │ ├── artist.service.spec.ts │ │ │ ├── artist.service.ts │ │ │ ├── auth.service.spec.ts │ │ │ ├── auth.service.ts │ │ │ ├── music-directory.service.spec.ts │ │ │ ├── music-directory.service.ts │ │ │ ├── notification.service.spec.ts │ │ │ ├── notification.service.ts │ │ │ ├── search.service.spec.ts │ │ │ ├── search.service.ts │ │ │ ├── side-menu.service.spec.ts │ │ │ ├── side-menu.service.ts │ │ │ ├── stream.service.spec.ts │ │ │ ├── stream.service.ts │ │ │ ├── system.service.spec.ts │ │ │ ├── system.service.ts │ │ │ ├── users.service.spec.ts │ │ │ └── users.service.ts │ ├── side-menu │ │ ├── side-menu.component.html │ │ ├── side-menu.component.scss │ │ ├── side-menu.component.spec.ts │ │ └── side-menu.component.ts │ └── top-bar │ │ ├── top-bar.component.html │ │ ├── top-bar.component.scss │ │ ├── top-bar.component.spec.ts │ │ └── top-bar.component.ts ├── assets │ ├── .gitkeep │ ├── i18n │ │ ├── en-US.json │ │ └── fr.json │ └── images │ │ └── logo │ │ ├── airsonic-dark-350x100.png │ │ ├── airsonic-grey-350x100.png │ │ └── airsonic-light-350x100.png ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── favicon.png ├── index.html ├── main.ts ├── polyfills.ts ├── styles.scss ├── test.ts ├── tsconfig.app.json ├── tsconfig.spec.json ├── typings.d.ts └── vars.scss ├── tsconfig.json └── tslint.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | /node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | testem.log 34 | /typings 35 | 36 | # e2e 37 | /e2e/*.js 38 | /e2e/*.map 39 | 40 | # System Files 41 | .DS_Store 42 | Thumbs.db 43 | -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | 4 | [airsonic-ui.en-json] 5 | file_filter = src/assets/i18n/.json 6 | minimum_perc = 0 7 | source_file = src/assets/i18n/en.json 8 | source_lang = en 9 | type = KEYVALUEJSON 10 | 11 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Airsonic UI 2 | 3 | ## Setup 4 | 5 | 1. Install angular cli `npm install -g @angular/cli` 6 | 2. Install packages `npm install` 7 | 8 | ## Development server 9 | 10 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 11 | 12 | ## Code scaffolding 13 | 14 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 15 | 16 | ## Build 17 | 18 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. 19 | 20 | ## Running unit tests 21 | 22 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 23 | 24 | ## Running end-to-end tests 25 | 26 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 27 | 28 | Before running the tests make sure you are serving the app via `ng serve`. 29 | 30 | ## Extracting new translation 31 | 32 | Run `npm run i18n-extract` to extract the new translation from the app. 33 | 34 | ## Further help 35 | 36 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 37 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "airsonic-ui": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "architect": { 11 | "build": { 12 | "builder": "@angular-devkit/build-angular:browser", 13 | "options": { 14 | "outputPath": "dist", 15 | "index": "src/index.html", 16 | "main": "src/main.ts", 17 | "tsConfig": "src/tsconfig.app.json", 18 | "polyfills": "src/polyfills.ts", 19 | "assets": [ 20 | "src/assets", 21 | "src/favicon.ico" 22 | ], 23 | "styles": [ 24 | "node_modules/bootstrap/scss/bootstrap.scss", 25 | "node_modules/material-design-icons/iconfont/material-icons.css", 26 | "src/styles.scss" 27 | ], 28 | "scripts": [] 29 | }, 30 | "configurations": { 31 | "production": { 32 | "optimization": true, 33 | "outputHashing": "all", 34 | "sourceMap": false, 35 | "extractCss": true, 36 | "namedChunks": false, 37 | "aot": true, 38 | "extractLicenses": true, 39 | "vendorChunk": false, 40 | "buildOptimizer": true, 41 | "fileReplacements": [ 42 | { 43 | "replace": "src/environments/environment.ts", 44 | "with": "src/environments/environment.prod.ts" 45 | } 46 | ] 47 | } 48 | } 49 | }, 50 | "serve": { 51 | "builder": "@angular-devkit/build-angular:dev-server", 52 | "options": { 53 | "browserTarget": "airsonic-ui:build" 54 | }, 55 | "configurations": { 56 | "production": { 57 | "browserTarget": "airsonic-ui:build:production" 58 | } 59 | } 60 | }, 61 | "extract-i18n": { 62 | "builder": "@angular-devkit/build-angular:extract-i18n", 63 | "options": { 64 | "browserTarget": "airsonic-ui:build" 65 | } 66 | }, 67 | "test": { 68 | "builder": "@angular-devkit/build-angular:karma", 69 | "options": { 70 | "main": "src/test.ts", 71 | "karmaConfig": "./karma.conf.js", 72 | "polyfills": "src/polyfills.ts", 73 | "tsConfig": "src/tsconfig.spec.json", 74 | "scripts": [], 75 | "styles": [ 76 | "node_modules/bootstrap/scss/bootstrap.scss", 77 | "node_modules/material-design-icons/iconfont/material-icons.css", 78 | "src/styles.scss" 79 | ], 80 | "assets": [ 81 | "src/assets", 82 | "src/favicon.ico" 83 | ] 84 | } 85 | }, 86 | "lint": { 87 | "builder": "@angular-devkit/build-angular:tslint", 88 | "options": { 89 | "tsConfig": [ 90 | "src/tsconfig.app.json", 91 | "src/tsconfig.spec.json" 92 | ], 93 | "exclude": [ 94 | "**/node_modules/**" 95 | ] 96 | } 97 | } 98 | } 99 | }, 100 | "airsonic-ui-e2e": { 101 | "root": "e2e", 102 | "sourceRoot": "e2e", 103 | "projectType": "application", 104 | "architect": { 105 | "e2e": { 106 | "builder": "@angular-devkit/build-angular:protractor", 107 | "options": { 108 | "protractorConfig": "./protractor.conf.js", 109 | "devServerTarget": "airsonic-ui:serve" 110 | } 111 | }, 112 | "lint": { 113 | "builder": "@angular-devkit/build-angular:tslint", 114 | "options": { 115 | "tsConfig": [ 116 | "e2e/tsconfig.e2e.json" 117 | ], 118 | "exclude": [ 119 | "**/node_modules/**" 120 | ] 121 | } 122 | } 123 | } 124 | } 125 | }, 126 | "defaultProject": "airsonic-ui", 127 | "schematics": { 128 | "@schematics/angular:component": { 129 | "prefix": "app", 130 | "styleext": "scss" 131 | }, 132 | "@schematics/angular:directive": { 133 | "prefix": "app" 134 | } 135 | } 136 | } -------------------------------------------------------------------------------- /e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('airsonic-ui App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to app!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-firefox-launcher'), 12 | require('karma-jasmine-html-reporter'), 13 | require('karma-coverage-istanbul-reporter'), 14 | require('@angular-devkit/build-angular/plugins/karma') 15 | ], 16 | client:{ 17 | clearContext: false // leave Jasmine Spec Runner output visible in browser 18 | }, 19 | coverageIstanbulReporter: { 20 | dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ], 21 | fixWebpackSourcePaths: true 22 | }, 23 | 24 | reporters: ['progress', 'kjhtml'], 25 | port: 9876, 26 | colors: true, 27 | logLevel: config.LOG_INFO, 28 | autoWatch: true, 29 | browsers: ['Chrome', 'Firefox'], 30 | singleRun: false 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "airsonic-ui", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "scripts": { 6 | "ng": "ng", 7 | "start": "ng serve", 8 | "build": "ng build --prod", 9 | "test": "ng test", 10 | "lint": "ng lint", 11 | "lint.fix": "ng lint --fix && exit 0", 12 | "e2e": "ng e2e", 13 | "i18n-extract": "ngx-translate-extract --input ./src --output ./src/assets/i18n/*.json --format namespaced-json" 14 | }, 15 | "pre-commit": [ 16 | "lint.fix" 17 | ], 18 | "private": true, 19 | "dependencies": { 20 | "@angular/animations": "7.2.3", 21 | "@angular/common": "7.2.3", 22 | "@angular/compiler": "7.2.3", 23 | "@angular/core": "7.2.3", 24 | "@angular/forms": "7.2.3", 25 | "@angular/http": "7.2.3", 26 | "@angular/platform-browser": "7.2.3", 27 | "@angular/platform-browser-dynamic": "7.2.3", 28 | "@angular/router": "7.2.3", 29 | "@ng-bootstrap/ng-bootstrap": "^4.0.2", 30 | "@ngx-translate/core": "^11.0.1", 31 | "@ngx-translate/http-loader": "^4.0.0", 32 | "bootstrap": "^4.2.1", 33 | "core-js": "^2.6.3", 34 | "material-design-icons": "^3.0.1", 35 | "ngx-infinite-scroll": "^7.0.0", 36 | "rxjs": "^6.4.0", 37 | "ts-md5": "^1.2.4", 38 | "tslib": "^1.9.0", 39 | "zone.js": "^0.8.29" 40 | }, 41 | "devDependencies": { 42 | "@angular-devkit/build-angular": "~0.13.0", 43 | "@angular/cli": "7.3.0", 44 | "@angular/compiler-cli": "7.2.3", 45 | "@angular/language-service": "7.2.3", 46 | "@biesbjerg/ngx-translate-extract": "^2.3.4", 47 | "@types/jasmine": "^2.8.16", 48 | "@types/jasminewd2": "^2.0.6", 49 | "@types/node": "^6.14.2", 50 | "codelyzer": "^4.5.0", 51 | "jasmine-core": "~2.8.0", 52 | "jasmine-spec-reporter": "~4.2.1", 53 | "karma": "^2.0.5", 54 | "karma-chrome-launcher": "~2.2.0", 55 | "karma-cli": "~1.0.1", 56 | "karma-coverage-istanbul-reporter": "^1.4.3", 57 | "karma-firefox-launcher": "^1.1.0", 58 | "karma-jasmine": "^1.1.2", 59 | "karma-jasmine-html-reporter": "^0.2.2", 60 | "pre-commit": "^1.2.2", 61 | "protractor": "^5.4.2", 62 | "ts-node": "~4.1.0", 63 | "tslint": "~5.9.1", 64 | "typescript": "3.2.4" 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /src/app/album/album.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | Photo of {{musicDirectory?.name}} 4 |

{{album?.name}} play_circle_outline

5 |

{{album?.artist}}

6 |
7 |
8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /src/app/album/album.component.scss: -------------------------------------------------------------------------------- 1 | #play-album { 2 | cursor: pointer; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/album/album.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AlbumComponent } from './album.component'; 4 | import { TimePipe } from '../shared/pipe/time.pipe'; 5 | import { AlbumService } from '../shared/service/album.service'; 6 | import { MusicDirectoryService } from '../shared/service/music-directory.service'; 7 | import { ActivatedRoute } from '@angular/router'; 8 | import { AlbumServiceSpy } from '../shared/service/album.service.spec'; 9 | import { MusicDirectoryServiceSpy } from '../shared/service/music-directory.service.spec'; 10 | import { StreamService } from '../shared/service/stream.service'; 11 | import { StreamServiceSpy } from '../shared/service/stream.service.spec'; 12 | import { NO_ERRORS_SCHEMA } from '@angular/core'; 13 | 14 | describe('AlbumComponent', () => { 15 | let component: AlbumComponent; 16 | let fixture: ComponentFixture; 17 | let albumService: AlbumServiceSpy; 18 | let musicDirectoryService: MusicDirectoryServiceSpy; 19 | const activatedRoute = { 20 | snapshot: { 21 | params: { 22 | id: '1234' 23 | } 24 | } 25 | }; 26 | 27 | beforeEach(async(() => { 28 | TestBed.configureTestingModule({ 29 | declarations: [AlbumComponent, TimePipe], 30 | providers: [ 31 | { provide: AlbumService, useValue: new AlbumServiceSpy() }, 32 | { provide: MusicDirectoryService, useValue: new MusicDirectoryServiceSpy() }, 33 | { provide: ActivatedRoute, useValue: activatedRoute }, 34 | { provide: StreamService, useValue: new StreamServiceSpy() } 35 | ], 36 | schemas: [NO_ERRORS_SCHEMA] 37 | }) 38 | .compileComponents(); 39 | })); 40 | 41 | beforeEach(() => { 42 | fixture = TestBed.createComponent(AlbumComponent); 43 | component = fixture.componentInstance; 44 | fixture.detectChanges(); 45 | albumService = fixture.debugElement.injector.get(AlbumService) as any; 46 | musicDirectoryService = fixture.debugElement.injector.get(MusicDirectoryService) as any; 47 | }); 48 | 49 | it('should be created', () => { 50 | expect(component).toBeTruthy(); 51 | }); 52 | }); 53 | -------------------------------------------------------------------------------- /src/app/album/album.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { MusicDirectoryService } from '../shared/service/music-directory.service'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | import { MusicDirectory } from '../shared/domain/music-directory.domain'; 5 | import { AlbumService } from '../shared/service/album.service'; 6 | import { Album } from '../shared/domain/album.domain'; 7 | import { StreamService } from '../shared/service/stream.service'; 8 | 9 | @Component({ 10 | selector: 'app-album', 11 | templateUrl: './album.component.html', 12 | styleUrls: ['./album.component.scss'] 13 | }) 14 | export class AlbumComponent implements OnInit { 15 | musicDirectory: MusicDirectory; 16 | album: Album; 17 | constructor(private musicDirectoryService: MusicDirectoryService, 18 | private route: ActivatedRoute, 19 | private albumService: AlbumService, 20 | private streamService: StreamService) { } 21 | 22 | ngOnInit() { 23 | const id = this.route.snapshot.params.id; 24 | this.musicDirectoryService.getMusicDirectory(id) 25 | .subscribe( 26 | data => { 27 | this.musicDirectory = data; 28 | this.getAlbum(this.musicDirectory.child[0].albumId); 29 | }, 30 | error => console.log(error) 31 | ); 32 | } 33 | 34 | getAlbumImageUrl(id: string) { 35 | return AlbumService.getAlbumImageUrl(id, '200'); 36 | } 37 | 38 | getAlbum(albumId: string) { 39 | this.albumService.getAlbum(albumId) 40 | .subscribe( 41 | res => this.album = res, 42 | err => console.log(err) 43 | ); 44 | } 45 | 46 | playAlbum() { 47 | this.streamService.addToQueue(this.album.song); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/app/albums/albums.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /src/app/albums/albums.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsonic/airsonic-ui/5bc4ceb0350f296e970fd5c1688f8064797490db/src/app/albums/albums.component.scss -------------------------------------------------------------------------------- /src/app/albums/albums.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AlbumsComponent } from './albums.component'; 4 | import { NO_ERRORS_SCHEMA } from '@angular/core'; 5 | import { AlbumService } from '../shared/service/album.service'; 6 | import { NotificationService } from '../shared/service/notification.service'; 7 | import { NoopAnimationsModule } from '@angular/platform-browser/animations'; 8 | import { AlbumServiceSpy } from '../shared/service/album.service.spec'; 9 | import { NotificationServiceSpy } from '../shared/service/notification.service.spec'; 10 | 11 | describe('AlbumsComponent', () => { 12 | let component: AlbumsComponent; 13 | let fixture: ComponentFixture; 14 | let albumService: AlbumServiceSpy; 15 | let notificationService: NotificationServiceSpy; 16 | 17 | beforeEach(async(() => { 18 | TestBed.configureTestingModule({ 19 | declarations: [AlbumsComponent], 20 | schemas: [NO_ERRORS_SCHEMA], 21 | imports: [NoopAnimationsModule], 22 | providers: [ 23 | { provide: AlbumService, useValue: new AlbumServiceSpy() }, 24 | { provide: NotificationService, useValue: new NotificationServiceSpy() } 25 | ] 26 | }) 27 | .compileComponents(); 28 | })); 29 | 30 | beforeEach(() => { 31 | fixture = TestBed.createComponent(AlbumsComponent); 32 | component = fixture.componentInstance; 33 | fixture.detectChanges(); 34 | albumService = fixture.debugElement.injector.get(AlbumService) as any; 35 | notificationService = fixture.debugElement.injector.get(NotificationService) as any; 36 | }); 37 | 38 | it('should be created', () => { 39 | expect(component).toBeTruthy(); 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /src/app/albums/albums.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AlbumService } from '../shared/service/album.service'; 3 | import { Albums } from '../shared/domain/album.domain'; 4 | import { NotificationService } from '../shared/service/notification.service'; 5 | 6 | @Component({ 7 | selector: 'app-albums', 8 | templateUrl: './albums.component.html', 9 | styleUrls: ['./albums.component.scss'] 10 | }) 11 | export class AlbumsComponent implements OnInit { 12 | albums: Array = []; 13 | pageSize = 40; 14 | page = 0; 15 | // pageSorting = default is 'alphabeticalByName' | 'random', 'newest', 'highest', 'frequent', 16 | // 'recent', 'alphabeticalByName', 'alphabeticalByArtist', 'starred', 'byYear', 'byGenre' 17 | pageSorting = 'random'; 18 | 19 | constructor(private albumService: AlbumService, 20 | private notificationService: NotificationService) { } 21 | 22 | ngOnInit() { 23 | this.getAlbums(); 24 | } 25 | 26 | getAlbums() { 27 | this.albumService.getAlbums({ type: this.pageSorting, size: this.pageSize, offset: this.page * this.pageSize }) 28 | .subscribe( 29 | data => this.albums.push(...data), 30 | err => this.notificationService.notify(err)); 31 | } 32 | 33 | onScroll() { 34 | this.page++; 35 | this.getAlbums(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | 4 | import { AuthGuard } from './shared/guards/auth.guard'; 5 | import { RolesGuard } from './shared/guards/roles.guard'; 6 | 7 | import { AlbumComponent } from './album/album.component'; 8 | import { AlbumsComponent } from './albums/albums.component'; 9 | import { LoginComponent } from './login/login.component'; 10 | import { ProfileComponent } from './profile/profile.component'; 11 | import { SearchResultComponent } from './search-result/search-result.component'; 12 | import { SettingsComponent } from './settings/settings.component'; 13 | import { SideMenuComponent } from './side-menu/side-menu.component'; 14 | import { TopBarComponent } from './top-bar/top-bar.component'; 15 | import { MediaFoldersSettingsComponent } from './settings/media-folders-settings/media-folders-settings.component'; 16 | 17 | @NgModule({ 18 | imports: [RouterModule.forRoot([ 19 | { 20 | path: '', 21 | canActivate: [AuthGuard], 22 | children: [ 23 | { path: '', component: SideMenuComponent, outlet: 'side-menu' }, 24 | { path: '', component: TopBarComponent, outlet: 'top-bar' }, 25 | { path: '', component: AlbumsComponent }, 26 | { path: 'album/:id', component: AlbumComponent }, 27 | { path: 'search/:query', component: SearchResultComponent }, 28 | { path: 'profile', component: ProfileComponent, canActivate: [RolesGuard], data: { role: 'settingsRole' } }, 29 | { 30 | path: 'settings', 31 | canActivate: [RolesGuard], data: { role: 'adminRole' }, 32 | component: SettingsComponent, 33 | children: [ 34 | { path: '', redirectTo: '/settings/media-folders', pathMatch: 'full' }, 35 | { path: 'media-folders', component: MediaFoldersSettingsComponent } 36 | ] 37 | } 38 | ] 39 | }, 40 | { path: 'login', component: LoginComponent }, 41 | { path: '**', redirectTo: '' } 42 | ])], 43 | exports: [RouterModule] 44 | }) 45 | export class AppRoutingModule { } 46 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |
6 | 7 |
8 |
9 |
10 | 11 | 12 | -------------------------------------------------------------------------------- /src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsonic/airsonic-ui/5bc4ceb0350f296e970fd5c1688f8064797490db/src/app/app.component.scss -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | 3 | import { AppComponent } from './app.component'; 4 | import { NO_ERRORS_SCHEMA } from '@angular/core'; 5 | import { AuthService } from './shared/service/auth.service'; 6 | import { AuthServiceSpy } from './shared/service/auth.service.spec'; 7 | import { SideMenuService } from './shared/service/side-menu.service'; 8 | import { TranslateModule } from '@ngx-translate/core'; 9 | import { UsersService } from './shared/service/users.service'; 10 | import { HttpClientTestingModule } from '@angular/common/http/testing'; 11 | 12 | describe('AppComponent', () => { 13 | beforeEach(async(() => { 14 | TestBed.configureTestingModule({ 15 | declarations: [ 16 | AppComponent 17 | ], 18 | providers: [ 19 | { provide: AuthService, useValue: new AuthServiceSpy() }, 20 | SideMenuService, 21 | UsersService 22 | ], 23 | imports: [ 24 | HttpClientTestingModule, 25 | TranslateModule.forRoot() 26 | ], 27 | schemas: [NO_ERRORS_SCHEMA], 28 | }).compileComponents(); 29 | })); 30 | 31 | it('should create the app', async(() => { 32 | const fixture = TestBed.createComponent(AppComponent); 33 | const app = fixture.debugElement.componentInstance; 34 | expect(app).toBeTruthy(); 35 | })); 36 | }); 37 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AuthService } from './shared/service/auth.service'; 3 | import { UsersService } from './shared/service/users.service'; 4 | import { SideMenuService } from './shared/service/side-menu.service'; 5 | import { TranslateService } from '@ngx-translate/core'; 6 | 7 | @Component({ 8 | selector: 'app-root', 9 | templateUrl: './app.component.html', 10 | styleUrls: ['./app.component.scss'] 11 | }) 12 | export class AppComponent implements OnInit { 13 | 14 | sideMenuClosed = false; 15 | 16 | constructor(private authService: AuthService, 17 | private usersService: UsersService, 18 | private sideMenuService: SideMenuService, 19 | private translate: TranslateService) { 20 | this.translate.use(this.translate.getBrowserCultureLang()); 21 | } 22 | 23 | ngOnInit() { 24 | this.sideMenuService.toggleSideMenu.subscribe(() => { 25 | this.sideMenuClosed = !this.sideMenuClosed; 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | 4 | import { AppComponent } from './app.component'; 5 | import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; 6 | import { HTTP_INTERCEPTORS, HttpClientModule, HttpClient } from '@angular/common/http'; 7 | import { AuthInterceptor } from './shared/auth/AuthInterceptor'; 8 | import { ArtistService } from './shared/service/artist.service'; 9 | import { AlbumsComponent } from './albums/albums.component'; 10 | import { ArtistsComponent } from './artists/artists.component'; 11 | import { AppRoutingModule } from './app-routing.module'; 12 | import { LoginComponent } from './login/login.component'; 13 | import { NotificationService } from './shared/service/notification.service'; 14 | import { AuthService } from './shared/service/auth.service'; 15 | import { FormsModule } from '@angular/forms'; 16 | import { SystemService } from './shared/service/system.service'; 17 | import { AlbumService } from './shared/service/album.service'; 18 | import { AlbumComponent } from './album/album.component'; 19 | import { MusicDirectoryService } from './shared/service/music-directory.service'; 20 | import { TimePipe } from './shared/pipe/time.pipe'; 21 | import { MediaControlsComponent } from './shared/component/media-controls/media-controls.component'; 22 | import { InfiniteScrollModule } from 'ngx-infinite-scroll'; 23 | import { StreamService } from './shared/service/stream.service'; 24 | import { ClickOutsideDirective } from './shared/directive/click-outside.directive'; 25 | import { SearchResultComponent } from './search-result/search-result.component'; 26 | import { SearchService } from './shared/service/search.service'; 27 | import { SongTableComponent } from './shared/component/song-table/song-table.component'; 28 | import { AlbumCardComponent } from './shared/component/album-card/album-card.component'; 29 | import { AUDIO_PROVIDER, AudioProviderFactory } from './shared/provider/audio.provider'; 30 | import { TopBarComponent } from './top-bar/top-bar.component'; 31 | import { SideMenuService } from './shared/service/side-menu.service'; 32 | import { TranslateModule, TranslateLoader, TranslateService } from '@ngx-translate/core'; 33 | import { TranslateHttpLoader } from '@ngx-translate/http-loader'; 34 | import { AuthGuard } from './shared/guards/auth.guard'; 35 | import { RolesGuard } from './shared/guards/roles.guard'; 36 | import { UsersService } from './shared/service/users.service'; 37 | import { ProfileComponent } from './profile/profile.component'; 38 | import { SideMenuComponent } from './side-menu/side-menu.component'; 39 | import { SettingsComponent } from './settings/settings.component'; 40 | import { MediaFoldersSettingsComponent } from './settings/media-folders-settings/media-folders-settings.component'; 41 | 42 | // Ngx-translate loader 43 | export function HttpLoaderFactory(http: HttpClient) { 44 | return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); 45 | } 46 | 47 | @NgModule({ 48 | declarations: [ 49 | AppComponent, 50 | AlbumsComponent, 51 | ArtistsComponent, 52 | LoginComponent, 53 | AlbumComponent, 54 | TimePipe, 55 | MediaControlsComponent, 56 | ClickOutsideDirective, 57 | SearchResultComponent, 58 | SongTableComponent, 59 | AlbumCardComponent, 60 | TopBarComponent, 61 | ProfileComponent, 62 | SideMenuComponent, 63 | SettingsComponent, 64 | MediaFoldersSettingsComponent 65 | ], 66 | imports: [ 67 | BrowserModule, 68 | NgbModule, 69 | HttpClientModule, 70 | AppRoutingModule, 71 | FormsModule, 72 | InfiniteScrollModule, 73 | TranslateModule.forRoot({ 74 | loader: { 75 | provide: TranslateLoader, 76 | useFactory: HttpLoaderFactory, 77 | deps: [HttpClient] 78 | } 79 | }) 80 | ], 81 | providers: [ 82 | { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true }, 83 | ArtistService, 84 | NotificationService, 85 | AuthService, 86 | SystemService, 87 | AlbumService, 88 | MusicDirectoryService, 89 | StreamService, 90 | SearchService, 91 | { provide: AUDIO_PROVIDER, useFactory: AudioProviderFactory }, 92 | SideMenuService, 93 | TranslateService, 94 | AuthGuard, 95 | UsersService, 96 | RolesGuard 97 | ], 98 | bootstrap: [AppComponent] 99 | }) 100 | export class AppModule { } 101 | -------------------------------------------------------------------------------- /src/app/artists/artists.component.html: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /src/app/artists/artists.component.scss: -------------------------------------------------------------------------------- 1 | .card { 2 | margin-top: 0.5em; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/artists/artists.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ArtistsComponent } from './artists.component'; 4 | import { ArtistService } from '../shared/service/artist.service'; 5 | import { ArtistServiceSpy } from '../shared/service/artist.service.spec'; 6 | 7 | describe('ArtistsComponent', () => { 8 | let component: ArtistsComponent; 9 | let fixture: ComponentFixture; 10 | 11 | beforeEach(async(() => { 12 | TestBed.configureTestingModule({ 13 | declarations: [ArtistsComponent], 14 | providers: [ 15 | { provide: ArtistService, useValue: new ArtistServiceSpy() } 16 | ] 17 | }) 18 | .compileComponents(); 19 | })); 20 | 21 | beforeEach(() => { 22 | fixture = TestBed.createComponent(ArtistsComponent); 23 | component = fixture.componentInstance; 24 | fixture.detectChanges(); 25 | }); 26 | 27 | it('should be created', () => { 28 | expect(component).toBeTruthy(); 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /src/app/artists/artists.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ArtistService } from '../shared/service/artist.service'; 3 | import { ArtistIndex } from '../shared/domain/artist.domain'; 4 | 5 | @Component({ 6 | selector: 'app-artists', 7 | templateUrl: './artists.component.html', 8 | styleUrls: ['./artists.component.scss'] 9 | }) 10 | export class ArtistsComponent implements OnInit { 11 | artistIndex: Array; 12 | constructor(private artistService: ArtistService) { } 13 | 14 | ngOnInit() { 15 | this.artistService.getAll().subscribe(data => { 16 | this.artistIndex = data; 17 | }); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/app/login/login.component.html: -------------------------------------------------------------------------------- 1 |
2 | 26 |
27 | -------------------------------------------------------------------------------- /src/app/login/login.component.scss: -------------------------------------------------------------------------------- 1 | #signin { 2 | img { 3 | width: 330px; 4 | } 5 | position: absolute; 6 | left: 0; 7 | top: 0; 8 | right: 0; 9 | bottom: 0; 10 | min-height: 100vh; 11 | min-width: 100vw; 12 | z-index: 2000; 13 | background-color: rgb(20, 20, 20); 14 | 15 | .form-signin { 16 | max-width: 330px; 17 | padding: 15px; 18 | margin: 5rem auto 0; 19 | box-shadow: 0 30px 50px 10px rgba(0,0,0,0.6); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/app/login/login.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LoginComponent } from './login.component'; 4 | import { FormsModule } from '@angular/forms'; 5 | import { AuthService } from '../shared/service/auth.service'; 6 | import { AuthServiceSpy } from '../shared/service/auth.service.spec'; 7 | import { SystemService } from '../shared/service/system.service'; 8 | import { SystemServiceSpy } from '../shared/service/system.service.spec'; 9 | import { RouterTestingModule } from '@angular/router/testing'; 10 | import { TranslateModule } from '@ngx-translate/core'; 11 | 12 | describe('LoginComponent', () => { 13 | let component: LoginComponent; 14 | let fixture: ComponentFixture; 15 | 16 | beforeEach(async(() => { 17 | TestBed.configureTestingModule({ 18 | declarations: [LoginComponent], 19 | imports: [ 20 | FormsModule, 21 | RouterTestingModule, 22 | TranslateModule.forRoot() 23 | ], 24 | providers: [ 25 | { provide: AuthService, useValue: new AuthServiceSpy() }, 26 | { provide: SystemService, useValue: SystemServiceSpy } 27 | ] 28 | }) 29 | .compileComponents(); 30 | })); 31 | 32 | beforeEach(() => { 33 | fixture = TestBed.createComponent(LoginComponent); 34 | component = fixture.componentInstance; 35 | fixture.detectChanges(); 36 | }); 37 | 38 | it('should be created', () => { 39 | expect(component).toBeTruthy(); 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /src/app/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AuthService } from '../shared/service/auth.service'; 3 | import { SystemService } from '../shared/service/system.service'; 4 | import { Location } from '@angular/common'; 5 | import { Router } from '@angular/router'; 6 | 7 | @Component({ 8 | selector: 'app-login', 9 | templateUrl: './login.component.html', 10 | styleUrls: ['./login.component.scss'] 11 | }) 12 | export class LoginComponent implements OnInit { 13 | model = { 14 | user: '', 15 | password: '', 16 | server: '' 17 | }; 18 | constructor(private authService: AuthService, 19 | private systemService: SystemService, 20 | private router: Router) { } 21 | 22 | ngOnInit() { 23 | if (this.authService.hasMyUser()) { 24 | this.router.navigate(['']); 25 | } 26 | } 27 | 28 | onSubmit() { 29 | this.authService.loginMyUser(this.model.user, this.model.password, this.model.server); 30 | this.systemService.ping().subscribe( 31 | success => { 32 | this.router.navigate(['']); 33 | }, 34 | err => console.log(err)); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/app/profile/profile.component.html: -------------------------------------------------------------------------------- 1 |

2 | profile works! 3 |

4 | -------------------------------------------------------------------------------- /src/app/profile/profile.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsonic/airsonic-ui/5bc4ceb0350f296e970fd5c1688f8064797490db/src/app/profile/profile.component.scss -------------------------------------------------------------------------------- /src/app/profile/profile.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ProfileComponent } from './profile.component'; 4 | 5 | describe('ProfileComponent', () => { 6 | let component: ProfileComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ProfileComponent] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ProfileComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/profile/profile.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-profile', 5 | templateUrl: './profile.component.html', 6 | styleUrls: ['./profile.component.scss'] 7 | }) 8 | export class ProfileComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { } 13 | } 14 | -------------------------------------------------------------------------------- /src/app/search-result/search-result.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |
6 |
7 | 8 |
9 |
10 | 11 |
12 |

{{ 'search-result.no-matches-found' | translate }}

13 |
14 |
15 | -------------------------------------------------------------------------------- /src/app/search-result/search-result.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsonic/airsonic-ui/5bc4ceb0350f296e970fd5c1688f8064797490db/src/app/search-result/search-result.component.scss -------------------------------------------------------------------------------- /src/app/search-result/search-result.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SearchResultComponent } from './search-result.component'; 4 | import { NO_ERRORS_SCHEMA } from '@angular/core'; 5 | 6 | describe('SearchResultComponent', () => { 7 | let component: SearchResultComponent; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [SearchResultComponent], 13 | schemas: [NO_ERRORS_SCHEMA] 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(SearchResultComponent); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | xit('should be created', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/search-result/search-result.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { SearchService } from '../shared/service/search.service'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | import { SearchResult2 } from '../shared/domain/search.domain'; 5 | 6 | @Component({ 7 | selector: 'app-search-result', 8 | templateUrl: './search-result.component.html', 9 | styleUrls: ['./search-result.component.scss'] 10 | }) 11 | export class SearchResultComponent implements OnInit { 12 | searchResult: SearchResult2; 13 | 14 | constructor(private route: ActivatedRoute, 15 | private searchService: SearchService) { } 16 | 17 | ngOnInit() { 18 | this.route.params 19 | .subscribe(params => this.getSearchResult(params.query)); 20 | } 21 | 22 | getSearchResult(query: string) { 23 | this.searchService.getSearch2(query) 24 | .subscribe(data => this.searchResult = data); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/app/settings/media-folders-settings/media-folders-settings.component.html: -------------------------------------------------------------------------------- 1 |

2 | media-folders-settings works! 3 |

4 | -------------------------------------------------------------------------------- /src/app/settings/media-folders-settings/media-folders-settings.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsonic/airsonic-ui/5bc4ceb0350f296e970fd5c1688f8064797490db/src/app/settings/media-folders-settings/media-folders-settings.component.scss -------------------------------------------------------------------------------- /src/app/settings/media-folders-settings/media-folders-settings.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { MediaFoldersSettingsComponent } from './media-folders-settings.component'; 4 | 5 | describe('MediaFoldersSettingsComponent', () => { 6 | let component: MediaFoldersSettingsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ MediaFoldersSettingsComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(MediaFoldersSettingsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/settings/media-folders-settings/media-folders-settings.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-media-folders-settings', 5 | templateUrl: './media-folders-settings.component.html', 6 | styleUrls: ['./media-folders-settings.component.scss'] 7 | }) 8 | export class MediaFoldersSettingsComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/settings/settings.component.html: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /src/app/settings/settings.component.scss: -------------------------------------------------------------------------------- 1 | @import "~vars.scss"; 2 | $settings-menu-width: 13em; 3 | 4 | #settings-content, 5 | #settings-menu { 6 | min-height: calc(100vh - #{$media-controls-height} - 44px); 7 | } 8 | 9 | #settings-menu { 10 | width: $settings-menu-width; 11 | background-color: rgba($color: #000000, $alpha: 0.1); 12 | } 13 | 14 | #settings-content { 15 | min-width: calc(100% - #{$settings-menu-width}); 16 | } 17 | -------------------------------------------------------------------------------- /src/app/settings/settings.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SettingsComponent } from './settings.component'; 4 | import { TranslateModule } from '@ngx-translate/core'; 5 | import { NO_ERRORS_SCHEMA } from '@angular/core'; 6 | 7 | describe('SettingsComponent', () => { 8 | let component: SettingsComponent; 9 | let fixture: ComponentFixture; 10 | 11 | beforeEach(async(() => { 12 | TestBed.configureTestingModule({ 13 | declarations: [ 14 | SettingsComponent 15 | ], 16 | imports: [ 17 | TranslateModule.forRoot() 18 | ], 19 | schemas: [NO_ERRORS_SCHEMA] 20 | }) 21 | .compileComponents(); 22 | })); 23 | 24 | beforeEach(() => { 25 | fixture = TestBed.createComponent(SettingsComponent); 26 | component = fixture.componentInstance; 27 | fixture.detectChanges(); 28 | }); 29 | 30 | it('should create', () => { 31 | expect(component).toBeTruthy(); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /src/app/settings/settings.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-settings', 5 | templateUrl: './settings.component.html', 6 | styleUrls: ['./settings.component.scss'] 7 | }) 8 | export class SettingsComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/shared/auth/AuthInterceptor.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { AuthService } from '../service/auth.service'; 5 | import { MyUser, SERVER_URL } from '../domain/auth.domain'; 6 | import { environment } from '../../../environments/environment'; 7 | 8 | @Injectable() 9 | export class AuthInterceptor implements HttpInterceptor { 10 | 11 | constructor(private authService: AuthService) { } 12 | 13 | intercept(req: HttpRequest, next: HttpHandler): Observable> { 14 | if (req.url.startsWith(localStorage.getItem(SERVER_URL))) { 15 | const myUser: MyUser = this.authService.getMyUser(); 16 | const params = req.params 17 | .set('u', myUser.name) 18 | .set('t', myUser.token) 19 | .set('s', myUser.salt) 20 | .set('c', environment.applicationName) 21 | .set('f', 'json') 22 | .set('v', environment.apiVersion); 23 | const authReq = req.clone({ params: params }); 24 | return next.handle(authReq); 25 | } 26 | return next.handle(req); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/app/shared/component/album-card/album-card.component.html: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /src/app/shared/component/album-card/album-card.component.scss: -------------------------------------------------------------------------------- 1 | .album-card { 2 | -webkit-box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2); 3 | -moz-box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2); 4 | box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2); 5 | } 6 | 7 | .album-card, 8 | .card { 9 | min-width: 162px; 10 | max-width: 162px; 11 | } 12 | 13 | .card:hover { 14 | text-decoration: none; 15 | } 16 | 17 | .card-img-top { 18 | width: 160px; 19 | height: 160px; 20 | transition: opacity 0.2s ease-in-out; 21 | } 22 | 23 | .album-card:hover .card-img-top { 24 | opacity: 0.8; 25 | } 26 | 27 | .card-text, 28 | .card-title { 29 | text-overflow: ellipsis; 30 | overflow: hidden; 31 | white-space: nowrap; 32 | font-size: 1rem; 33 | } 34 | -------------------------------------------------------------------------------- /src/app/shared/component/album-card/album-card.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AlbumCardComponent } from './album-card.component'; 4 | import { NO_ERRORS_SCHEMA } from '@angular/core'; 5 | 6 | describe('AlbumCardComponent', () => { 7 | let component: AlbumCardComponent; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(async(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [AlbumCardComponent], 13 | schemas: [NO_ERRORS_SCHEMA] 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(AlbumCardComponent); 20 | component = fixture.componentInstance; 21 | fixture.detectChanges(); 22 | }); 23 | 24 | it('should be created', () => { 25 | expect(component).toBeTruthy(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/shared/component/album-card/album-card.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | import { Albums } from '../../domain/album.domain'; 3 | import { AlbumService } from '../../service/album.service'; 4 | 5 | @Component({ 6 | selector: 'app-album-card', 7 | templateUrl: './album-card.component.html', 8 | styleUrls: ['./album-card.component.scss'] 9 | }) 10 | export class AlbumCardComponent implements OnInit { 11 | @Input() 12 | albums: Array; 13 | 14 | constructor() { } 15 | 16 | ngOnInit() { 17 | } 18 | 19 | getAlbumImageUrl(id: string) { 20 | // TODO: Return a stock image when id is null 21 | if (id != null) { 22 | return AlbumService.getAlbumImageUrl(id); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/app/shared/component/media-controls/media-controls.component.html: -------------------------------------------------------------------------------- 1 | 52 | -------------------------------------------------------------------------------- /src/app/shared/component/media-controls/media-controls.component.scss: -------------------------------------------------------------------------------- 1 | $media-controls-height: 56px; 2 | $range-background: rgba(0, 0, 0, 0.4); 3 | $range-color: #2f7bd9; 4 | $playing-range-height: 8px; 5 | $volume-range-height: 10px; 6 | 7 | #media-controls { 8 | height: $media-controls-height; 9 | -webkit-box-shadow: 0 -5px 20px 0 rgba(0,0,0,0.2); 10 | -moz-box-shadow: 0 -5px 20px 0 rgba(0,0,0,0.2); 11 | box-shadow: 0 -5px 20px 0 rgba(0,0,0,0.2); 12 | } 13 | 14 | #media-controls-top { 15 | height: $playing-range-height; 16 | 17 | input[type=range] { 18 | height: $playing-range-height; 19 | } 20 | } 21 | 22 | #media-controls-bottom { 23 | height: -webkit-calc(#{$media-controls-height} - #{$playing-range-height}); 24 | height: -moz-calc(#{$media-controls-height} - #{$playing-range-height}); 25 | height: calc(#{$media-controls-height} - #{$playing-range-height}); 26 | 27 | #playing-info-text { 28 | div, 29 | span { 30 | height: 20px; 31 | line-height: 20px; 32 | } 33 | } 34 | 35 | #control-volume { 36 | .material-icons { 37 | padding: 11px 0; 38 | } 39 | 40 | input[type=range] { 41 | height: $volume-range-height; 42 | } 43 | } 44 | } 45 | @mixin box-shadow { 46 | box-shadow: none; 47 | } 48 | @mixin border { 49 | border-radius: 0; 50 | border: none; 51 | } 52 | @mixin cursor { 53 | cursor: pointer; 54 | } 55 | /* Reset to transparent range */ 56 | input[type=range] { 57 | @include border; 58 | -webkit-appearance: none; 59 | width: 100%; 60 | background: transparent; 61 | 62 | &:focus { 63 | @include box-shadow; 64 | } 65 | } 66 | 67 | input[type=range]::-webkit-slider-thumb { 68 | -webkit-appearance: none; 69 | } 70 | 71 | input[type=range]::-ms-track { 72 | @include cursor; 73 | width: 100%; 74 | background: transparent; 75 | border-color: transparent; 76 | color: transparent; 77 | } 78 | /* Styling the thumb */ 79 | input[type=range]::-webkit-slider-thumb { 80 | @include cursor; 81 | @include border; 82 | @include box-shadow; 83 | height: $playing-range-height; 84 | width: 4px; 85 | background: $range-color; 86 | } 87 | 88 | input[type=range]::-moz-range-thumb { 89 | @include cursor; 90 | @include border; 91 | @include box-shadow; 92 | height: $playing-range-height; 93 | width: 4px; 94 | background: $range-color; 95 | } 96 | 97 | input[type=range]::-ms-thumb { 98 | @include cursor; 99 | @include border; 100 | @include box-shadow; 101 | height: $playing-range-height; 102 | width: 4px; 103 | background: $range-color; 104 | } 105 | /* Styling the track */ 106 | input[type=range]::-webkit-slider-runnable-track { 107 | @include cursor; 108 | @include border; 109 | @include box-shadow; 110 | width: 100%; 111 | height: $playing-range-height; 112 | background: $range-background; 113 | } 114 | 115 | input[type=range]:focus:-webkit-slider-runnable-track { 116 | background: $range-color; 117 | } 118 | 119 | input[type=range]::-moz-range-track { 120 | @include cursor; 121 | @include border; 122 | @include box-shadow; 123 | width: 100%; 124 | height: $playing-range-height; 125 | background: $range-background; 126 | } 127 | 128 | input[type=range]::-ms-track { 129 | @include cursor; 130 | @include border; 131 | width: 100%; 132 | height: $playing-range-height; 133 | background: transparent; 134 | color: transparent; 135 | } 136 | 137 | input[type=range]::-ms-fill-lower { 138 | @include border; 139 | @include box-shadow; 140 | background: $range-background; 141 | } 142 | 143 | input[type=range]::-ms-fill-upper { 144 | @include border; 145 | @include box-shadow; 146 | background: $range-background; 147 | } 148 | /* Styling the progress */ 149 | input[type=range]::-moz-range-progress { 150 | background: $range-color; 151 | height: $playing-range-height; 152 | } 153 | 154 | input[type=range]::-webkit-range-progress { 155 | background: $range-color; 156 | height: $playing-range-height; 157 | } 158 | 159 | ::-moz-focus-inner, 160 | ::-moz-focus-outer, 161 | :focus { 162 | border: none; 163 | } 164 | -------------------------------------------------------------------------------- /src/app/shared/component/media-controls/media-controls.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { MediaControlsComponent } from './media-controls.component'; 4 | import { TimePipe } from '../../pipe/time.pipe'; 5 | import { StreamService } from '../../service/stream.service'; 6 | import { StreamServiceSpy } from '../../service/stream.service.spec'; 7 | import { FormsModule } from '@angular/forms'; 8 | 9 | describe('MediaControlsComponent', () => { 10 | let component: MediaControlsComponent; 11 | let fixture: ComponentFixture; 12 | 13 | beforeEach(async(() => { 14 | TestBed.configureTestingModule({ 15 | declarations: [MediaControlsComponent, TimePipe], 16 | providers: [ 17 | { provide: StreamService, useValue: new StreamServiceSpy() } 18 | ], 19 | imports: [FormsModule] 20 | }) 21 | .compileComponents(); 22 | })); 23 | 24 | beforeEach(() => { 25 | fixture = TestBed.createComponent(MediaControlsComponent); 26 | component = fixture.componentInstance; 27 | fixture.detectChanges(); 28 | }); 29 | 30 | it('should be created', () => { 31 | expect(component).toBeTruthy(); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /src/app/shared/component/media-controls/media-controls.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { MediaStream, StreamService } from '../../service/stream.service'; 3 | import { AlbumService } from '../../service/album.service'; 4 | 5 | export const VOLUME = 'volume'; 6 | 7 | @Component({ 8 | selector: 'app-media-controls', 9 | templateUrl: './media-controls.component.html', 10 | styleUrls: ['./media-controls.component.scss'] 11 | }) 12 | 13 | export class MediaControlsComponent implements OnInit { 14 | stream: MediaStream; 15 | volume: number; 16 | muted = false; 17 | 18 | constructor(private streamService: StreamService) { } 19 | 20 | ngOnInit() { 21 | this.streamService.onStreamStart(stream => this.stream = stream); 22 | if (localStorage.getItem(VOLUME) === null) { 23 | this.volume = this.streamService.volume; 24 | } else { 25 | this.volume = Number(localStorage.getItem(VOLUME)); 26 | this.volumeChange(this.volume); 27 | } 28 | } 29 | 30 | pause() { 31 | this.streamService.pause(); 32 | } 33 | 34 | play() { 35 | this.streamService.play(); 36 | } 37 | 38 | next() { 39 | this.streamService.next(); 40 | } 41 | 42 | volumeChange(val) { 43 | this.muted = val === 0; 44 | this.streamService.volume = val; 45 | } 46 | 47 | volumeMute() { 48 | if (!this.muted) { 49 | localStorage.setItem(VOLUME, this.volume.toString()); 50 | this.volumeChange(0); 51 | this.volume = 0; 52 | } else { 53 | this.volume = Number(localStorage.getItem(VOLUME)); 54 | this.volumeChange(this.volume); 55 | } 56 | } 57 | 58 | previous() { 59 | this.streamService.previous(); 60 | } 61 | 62 | albumImageUrl(albumImageSize) { 63 | if (this.stream) { 64 | return AlbumService.getAlbumImageUrl(this.stream.mediaFile.id, albumImageSize); 65 | } 66 | return ''; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/app/shared/component/song-table/song-table.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
#{{ 'song-table.title' | translate }}access_time{{ 'song-table.type' | translate }}{{ 'song-table.bitrate' | translate }}music_note
{{song.track}}{{song.title}}{{song.duration | time}}{{song.suffix}}{{song.bitRate}}{{song.playCount}}
25 |
26 |
27 | -------------------------------------------------------------------------------- /src/app/shared/component/song-table/song-table.component.scss: -------------------------------------------------------------------------------- 1 | .card-body { 2 | padding: 0; 3 | } 4 | 5 | .song-row { 6 | cursor: pointer; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/shared/component/song-table/song-table.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SongTableComponent } from './song-table.component'; 4 | import { TimePipe } from '../../pipe/time.pipe'; 5 | import { StreamServiceSpy } from '../../service/stream.service.spec'; 6 | import { StreamService } from '../../service/stream.service'; 7 | import { TranslateModule } from '@ngx-translate/core'; 8 | 9 | describe('SongTableComponent', () => { 10 | let component: SongTableComponent; 11 | let fixture: ComponentFixture; 12 | 13 | beforeEach(async(() => { 14 | TestBed.configureTestingModule({ 15 | declarations: [SongTableComponent, TimePipe], 16 | imports: [ 17 | TranslateModule.forRoot() 18 | ], 19 | providers: [ 20 | { provide: StreamService, useValue: new StreamServiceSpy() } 21 | ] 22 | }) 23 | .compileComponents(); 24 | })); 25 | 26 | beforeEach(() => { 27 | fixture = TestBed.createComponent(SongTableComponent); 28 | component = fixture.componentInstance; 29 | fixture.detectChanges(); 30 | }); 31 | 32 | it('should be created', () => { 33 | expect(component).toBeTruthy(); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /src/app/shared/component/song-table/song-table.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | import { MediaFile } from '../../domain/media-file.domain'; 3 | import { StreamService } from '../../service/stream.service'; 4 | 5 | @Component({ 6 | selector: 'app-song-table', 7 | templateUrl: './song-table.component.html', 8 | styleUrls: ['./song-table.component.scss'] 9 | }) 10 | export class SongTableComponent implements OnInit { 11 | @Input() 12 | songs: Array; 13 | 14 | constructor(private streamService: StreamService) { } 15 | 16 | ngOnInit() { 17 | } 18 | 19 | playSong(song: MediaFile) { 20 | this.streamService.streamFile(song); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/app/shared/directive/click-outside.directive.ts: -------------------------------------------------------------------------------- 1 | import { Directive, ElementRef, EventEmitter, HostListener, Output } from '@angular/core'; 2 | 3 | @Directive({ 4 | selector: '[appClickOutside]' 5 | }) 6 | export class ClickOutsideDirective { 7 | 8 | @Output() 9 | public appClickOutside = new EventEmitter(); 10 | 11 | constructor(private _elementRef: ElementRef) { } 12 | 13 | @HostListener('document:click', ['$event.target']) 14 | public onClick(targetElement) { 15 | const clickedInside = this._elementRef.nativeElement.contains(targetElement); 16 | if (!clickedInside) { 17 | this.appClickOutside.emit(null); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/app/shared/domain/album.domain.ts: -------------------------------------------------------------------------------- 1 | import { MediaFile } from './media-file.domain'; 2 | 3 | export interface AlbumsResponse { 4 | 'subsonic-response': { 5 | status: string, 6 | version: string, 7 | albumList: { 8 | album: Array 9 | } 10 | }; 11 | } 12 | 13 | export interface Albums { 14 | id: string; 15 | parent: string; 16 | isDir: boolean; 17 | title: string; 18 | album: string; 19 | artist: string; 20 | year: string; 21 | genre: string; 22 | playCount: number; 23 | coverArt: number; 24 | created: string; 25 | } 26 | 27 | export interface AlbumResponse { 28 | 'subsonic-response': { 29 | status: string; 30 | version: string; 31 | album: Album; 32 | }; 33 | } 34 | 35 | export interface Album { 36 | id: string; 37 | name: string; 38 | artist: string; 39 | artistId: string; 40 | coverArt: string; 41 | songCount: number; 42 | duration: number; 43 | created: string; 44 | year: string; 45 | genre: string; 46 | song: Array; 47 | } 48 | -------------------------------------------------------------------------------- /src/app/shared/domain/artist.domain.ts: -------------------------------------------------------------------------------- 1 | export interface ArtistsResponse { 2 | 'subsonic-response': { 3 | status: string, 4 | version: string, 5 | artists: { 6 | ignoredArticles: string, 7 | index: Array 8 | } 9 | }; 10 | } 11 | 12 | export interface ArtistIndex { 13 | name: string; 14 | artist: Array; 15 | } 16 | 17 | export interface Artist { 18 | id: string; 19 | name: string; 20 | coverArt: string; 21 | albumCount: string; 22 | } 23 | -------------------------------------------------------------------------------- /src/app/shared/domain/auth.domain.ts: -------------------------------------------------------------------------------- 1 | export interface MyUser { 2 | name: string; 3 | salt: string; 4 | token: string; 5 | server: string; 6 | } 7 | 8 | export interface MyRoles { 9 | adminRole: boolean; 10 | settingsRole: boolean; 11 | downloadRole: boolean; 12 | uploadRole: boolean; 13 | playlistRole: boolean; 14 | coverArtRole: boolean; 15 | commentRole: boolean; 16 | podcastRole: boolean; 17 | streamRole: boolean; 18 | jukeboxRole: boolean; 19 | shareRole: boolean; 20 | videoConversionRole: boolean; 21 | } 22 | 23 | export const USER_INFO = 'user_info'; 24 | export const USER_ROLES = 'user_roles'; 25 | export const USER_FOLDERS = 'user_folders'; 26 | export const SERVER_URL = 'server_url'; 27 | -------------------------------------------------------------------------------- /src/app/shared/domain/media-file.domain.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface MediaFile { 3 | id: string; 4 | parent: string; 5 | title: string; 6 | album: string; 7 | artist: string; 8 | track: number; 9 | year?: number; 10 | genre?: string; 11 | coverArt: string; 12 | size: number; 13 | contentType: string; 14 | suffix: string; 15 | transcodedContentType?: string; 16 | transcodedSuffix?: string; 17 | duration: number; 18 | bitRate: number; 19 | path: string; 20 | isVideo: boolean; 21 | playCount: number; 22 | discNumber?: number; 23 | created: string; 24 | albumId: string; 25 | artistId: string; 26 | type: string; 27 | } 28 | -------------------------------------------------------------------------------- /src/app/shared/domain/music-directory.domain.ts: -------------------------------------------------------------------------------- 1 | import { MediaFile } from './media-file.domain'; 2 | 3 | export interface MusicDirectoryResponse { 4 | 'subsonic-response': { 5 | status: string; 6 | version: string; 7 | directory: MusicDirectory; 8 | }; 9 | } 10 | 11 | export interface MusicDirectory { 12 | id: string; 13 | parent: string; 14 | name: string; 15 | playCount: number; 16 | child: Array; 17 | } 18 | -------------------------------------------------------------------------------- /src/app/shared/domain/search.domain.ts: -------------------------------------------------------------------------------- 1 | export interface SearchResponse { 2 | 'subsonic-response': { 3 | status: string; 4 | version: string; 5 | searchResult2: SearchResult2; 6 | }; 7 | } 8 | 9 | export interface SearchResult2 { 10 | artist: Array; 11 | album: Array; 12 | song: Array; 13 | } 14 | 15 | export interface ArtistResult { 16 | id: string; 17 | name: string; 18 | } 19 | 20 | export interface AlbumResult { 21 | id: string; 22 | parent: string; 23 | isDir: boolean; 24 | title: string; 25 | album: string; 26 | artist: string; 27 | coverArt: string; 28 | playCount: number; 29 | created: string; 30 | } 31 | 32 | export interface SongResult { 33 | id: string; 34 | parent: string; 35 | title: string; 36 | album: string; 37 | artist: string; 38 | track: number; 39 | coverArt: string; 40 | size: number; 41 | contentType: string; 42 | suffix: string; 43 | duration: number; 44 | bitRate: number; 45 | path: string; 46 | isVideo: boolean; 47 | playCount: number; 48 | created: string; 49 | albumId: string; 50 | artistId: string; 51 | type: string; 52 | } 53 | -------------------------------------------------------------------------------- /src/app/shared/domain/user.domain.ts: -------------------------------------------------------------------------------- 1 | export interface UserResponse { 2 | 'subsonic-response': { 3 | status: string; 4 | version: string; 5 | user: User; 6 | }; 7 | } 8 | 9 | export interface User { 10 | username: string; 11 | email: string; 12 | scrobblingEnabled: boolean; 13 | adminRole: boolean; 14 | settingsRole: boolean; 15 | downloadRole: boolean; 16 | uploadRole: boolean; 17 | playlistRole: boolean; 18 | coverArtRole: boolean; 19 | commentRole: boolean; 20 | podcastRole: boolean; 21 | streamRole: boolean; 22 | jukeboxRole: boolean; 23 | shareRole: boolean; 24 | videoConversionRole: boolean; 25 | folder: Array; 26 | } 27 | -------------------------------------------------------------------------------- /src/app/shared/domain/users.domain.ts: -------------------------------------------------------------------------------- 1 | import { User } from './user.domain'; 2 | 3 | export interface UsersResponse { 4 | 'subsonic-response': { 5 | status: string; 6 | version: string; 7 | users: Users; 8 | }; 9 | } 10 | 11 | export interface Users { 12 | user: Array; 13 | } 14 | -------------------------------------------------------------------------------- /src/app/shared/guards/auth.guard.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async, inject } from '@angular/core/testing'; 2 | 3 | import { AuthGuard } from './auth.guard'; 4 | import { RouterTestingModule } from '@angular/router/testing'; 5 | import { HttpClientTestingModule } from '@angular/common/http/testing'; 6 | import { AuthService } from '../service/auth.service'; 7 | import { UsersService } from '../service/users.service'; 8 | import { SystemService } from '../service/system.service'; 9 | 10 | describe('AuthGuard', () => { 11 | beforeEach(() => { 12 | TestBed.configureTestingModule({ 13 | imports: [ 14 | RouterTestingModule, 15 | HttpClientTestingModule 16 | ], 17 | providers: [ 18 | AuthGuard, 19 | AuthService, 20 | UsersService, 21 | SystemService 22 | ] 23 | }); 24 | }); 25 | 26 | it('should ...', inject([AuthGuard], (guard: AuthGuard) => { 27 | expect(guard).toBeTruthy(); 28 | })); 29 | }); 30 | -------------------------------------------------------------------------------- /src/app/shared/guards/auth.guard.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { CanActivate, Router } from '@angular/router'; 3 | import { AuthService } from '../service/auth.service'; 4 | 5 | @Injectable() 6 | export class AuthGuard implements CanActivate { 7 | 8 | constructor(private authService: AuthService, 9 | private router: Router) { } 10 | 11 | canActivate(): boolean { 12 | if (!this.authService.hasMyUser()) { 13 | this.router.navigate(['login']); 14 | return false; 15 | } 16 | return true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/app/shared/guards/roles.guard.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async, inject } from '@angular/core/testing'; 2 | 3 | import { RolesGuard } from './roles.guard'; 4 | import { HttpClientTestingModule } from '@angular/common/http/testing'; 5 | import { AuthService } from '../service/auth.service'; 6 | import { UsersService } from '../service/users.service'; 7 | import { SystemService } from '../service/system.service'; 8 | 9 | describe('RolesGuard', () => { 10 | beforeEach(() => { 11 | TestBed.configureTestingModule({ 12 | providers: [ 13 | RolesGuard, 14 | AuthService, 15 | UsersService, 16 | SystemService 17 | ], 18 | imports: [ 19 | HttpClientTestingModule 20 | ] 21 | }); 22 | }); 23 | 24 | it('should ...', inject([RolesGuard], (guard: RolesGuard) => { 25 | expect(guard).toBeTruthy(); 26 | })); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/shared/guards/roles.guard.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; 3 | import { AuthService } from '../service/auth.service'; 4 | 5 | @Injectable() 6 | export class RolesGuard implements CanActivate { 7 | 8 | constructor(private authService: AuthService) { } 9 | 10 | canActivate( 11 | next: ActivatedRouteSnapshot, 12 | state: RouterStateSnapshot): boolean { 13 | const role = next.data['role'] as string; 14 | return this.authService.hasRole(role); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/app/shared/pipe/time.pipe.spec.ts: -------------------------------------------------------------------------------- 1 | import { TimePipe } from './time.pipe'; 2 | 3 | describe('TimePipe', () => { 4 | const pipe = new TimePipe(); 5 | it('should return minutes and seconds string', () => { 6 | const result = pipe.transform(126); 7 | 8 | expect(result).toBe('2:06'); 9 | }); 10 | 11 | it('should return minutes and 00 for seconds', () => { 12 | const result = pipe.transform(60); 13 | 14 | expect(result).toBe('1:00'); 15 | }); 16 | 17 | it('should show hours field when over 60 minutes', () => { 18 | const result = pipe.transform(60 * 60 + 10); 19 | 20 | expect(result).toBe('1:00:10'); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /src/app/shared/pipe/time.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | /** 4 | * Convert an integer of seconds into hours:minutes:seconds 5 | * 6 | * Example: 7 | * {{ 126 | time }} 8 | * formats to: 2:06 9 | * {{ 3610 | time }} 10 | * formats to: 1:00:10 11 | */ 12 | @Pipe({ 13 | name: 'time' 14 | }) 15 | export class TimePipe implements PipeTransform { 16 | 17 | transform(value: number, args?: any): string { 18 | const hours = Math.floor(value / 3600); 19 | const minutes = Math.floor((value - hours * 3600) / 60); 20 | const seconds = this.padLeft(value - minutes * 60 - hours * 3600); 21 | if (hours !== 0) { 22 | return `${hours}:${this.padLeft(minutes)}:${seconds}`; 23 | } 24 | return `${minutes}:${seconds}`; 25 | } 26 | 27 | private padLeft(value: number): string { 28 | if (value < 10) { 29 | return `0${value}`; 30 | } 31 | return value.toString(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/app/shared/provider/audio.provider.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, InjectionToken } from '@angular/core'; 2 | 3 | @Injectable() 4 | export abstract class AudioProvider { 5 | src: string; 6 | volume: number; 7 | abstract play(); 8 | abstract pause(); 9 | abstract close(); 10 | abstract onEnded(fn: () => void); 11 | } 12 | 13 | @Injectable() 14 | export class WebAudioProvider implements AudioProvider { 15 | private audioContext = new AudioContext(); 16 | 17 | set src(it: string) { 18 | this.currentTrack.src = it; 19 | } 20 | set volume(it: number) { 21 | this.currentTrack.volume = it; 22 | } 23 | private currentTrack; 24 | constructor() { 25 | this.currentTrack = new Audio(); 26 | } 27 | 28 | play() { 29 | this.currentTrack.play(); 30 | } 31 | 32 | pause() { 33 | this.currentTrack.pause(); 34 | } 35 | 36 | close() { 37 | this.currentTrack.load(); 38 | return this.audioContext.close(); 39 | } 40 | 41 | onEnded(fn: () => void) { 42 | this.currentTrack.addEventListener('ended', () => fn()); 43 | } 44 | } 45 | 46 | export let AUDIO_PROVIDER: InjectionToken = new InjectionToken('AudioProvider'); 47 | 48 | 49 | export const AudioProviderFactory = () => { 50 | return new WebAudioProvider(); 51 | }; 52 | -------------------------------------------------------------------------------- /src/app/shared/service/album.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { AlbumService } from './album.service'; 4 | import { HttpClientTestingModule } from '@angular/common/http/testing'; 5 | import {Observable} from 'rxjs/internal/Observable'; 6 | 7 | describe('AlbumService', () => { 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({ 10 | providers: [AlbumService], 11 | imports: [HttpClientTestingModule] 12 | }); 13 | }); 14 | 15 | it('should be created', inject([AlbumService], (service: AlbumService) => { 16 | expect(service).toBeTruthy(); 17 | })); 18 | }); 19 | 20 | export class AlbumServiceSpy { 21 | testAlbum = { 22 | 'subsonic-response': { 23 | album: null 24 | } 25 | }; 26 | getAlbum = jasmine.createSpy('getAlbum').and.callFake((id) => { 27 | return new Observable(observer => { 28 | observer.next(this.testAlbum); 29 | observer.complete(); 30 | }); 31 | }); 32 | getAlbums = jasmine.createSpy('getAlbums').and.callFake(() => { 33 | return new Observable(observer => observer.complete()); 34 | }); 35 | getAlbumImageUrl = jasmine.createSpy('getAlbumImageUrl'); 36 | } 37 | -------------------------------------------------------------------------------- /src/app/shared/service/album.service.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | import {MyUser, SERVER_URL, USER_INFO} from '../domain/auth.domain'; 3 | import {HttpClient, HttpErrorResponse, HttpParams} from '@angular/common/http'; 4 | import {Album, AlbumResponse, Albums, AlbumsResponse} from '../domain/album.domain'; 5 | 6 | import {environment} from '../../../environments/environment'; 7 | import {Observable} from 'rxjs/internal/Observable'; 8 | import {catchError, last, map} from 'rxjs/operators'; 9 | import {throwError} from 'rxjs/internal/observable/throwError'; 10 | 11 | @Injectable() 12 | export class AlbumService { 13 | 14 | constructor(private httpClient: HttpClient) { } 15 | 16 | static getAlbumImageUrl(id: string, size: string = '160') { 17 | const userInfo: MyUser = JSON.parse(localStorage.getItem(USER_INFO)); 18 | if (userInfo === null) { 19 | return ''; 20 | } 21 | return `${userInfo.server}/rest/getCoverArt?id=${id}&v=${environment.apiVersion}&u=${userInfo.name}` + 22 | `&s=${userInfo.salt}&t=${userInfo.token}&c=${environment.applicationName}&size=${size}`.trim(); 23 | } 24 | 25 | getAlbums(options: { 26 | type?: string, 27 | size?: number, 28 | offset?: number, 29 | fromYear?: string, 30 | toYear?: string, 31 | genre?: string, 32 | musicFolderId?: string 33 | }): Observable> { 34 | const defaultOptions = { 35 | type: 'alphabeticalByName' 36 | }; 37 | const sentOptions = Object.assign({}, defaultOptions, options); 38 | const server = localStorage.getItem(SERVER_URL); 39 | let params = new HttpParams(); 40 | for (const option in sentOptions) { 41 | if (sentOptions.hasOwnProperty(option)) { 42 | params = params.set(option, sentOptions[option]); 43 | } 44 | } 45 | return this.httpClient.get(`${server}/rest/getAlbumList`, { params: params }) 46 | .pipe( 47 | map(res => res['subsonic-response'].albumList.album), 48 | last(), 49 | catchError(this.handleError) 50 | ); 51 | } 52 | 53 | getAlbum(id: string): Observable { 54 | const server = localStorage.getItem(SERVER_URL); 55 | const params = new HttpParams() 56 | .set('id', id); 57 | return this.httpClient.get(`${server}/rest/getAlbum`, { params: params }) 58 | .pipe( 59 | map(res => res['subsonic-response'].album), 60 | last(), 61 | catchError(this.handleError) 62 | ); 63 | } 64 | 65 | private handleError(error: HttpErrorResponse) { 66 | if (error.error instanceof ErrorEvent) { 67 | // A client-side or network error occurred. Handle it accordingly. 68 | console.error('An error occurred:', error.error.message); 69 | } else { 70 | // The backend returned an unsuccessful response code. 71 | // The response body may contain clues as to what went wrong, 72 | console.error( 73 | `Backend returned code ${error.status}, ` + 74 | `body was: ${error.error}`); 75 | } 76 | // return an observable with a user-facing error message 77 | return throwError( 78 | 'Something bad happened; please try again later.'); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/app/shared/service/artist.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { ArtistService } from './artist.service'; 4 | import { HttpClientTestingModule } from '@angular/common/http/testing'; 5 | import {Observable} from 'rxjs/internal/Observable'; 6 | 7 | describe('ArtistService', () => { 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({ 10 | providers: [ArtistService], 11 | imports: [HttpClientTestingModule] 12 | }); 13 | }); 14 | 15 | it('should be created', inject([ArtistService], (service: ArtistService) => { 16 | expect(service).toBeTruthy(); 17 | })); 18 | }); 19 | 20 | export class ArtistServiceSpy { 21 | getAll = jasmine.createSpy('getAll').and.callFake(() => { 22 | return new Observable(observer => observer.complete()); 23 | }); 24 | } 25 | -------------------------------------------------------------------------------- /src/app/shared/service/artist.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import {HttpClient, HttpErrorResponse} from '@angular/common/http'; 3 | import { SERVER_URL } from '../domain/auth.domain'; 4 | import { Observable } from 'rxjs'; 5 | import { ArtistIndex, ArtistsResponse } from '../domain/artist.domain'; 6 | import {catchError, last, map} from 'rxjs/operators'; 7 | import {throwError} from 'rxjs/internal/observable/throwError'; 8 | 9 | @Injectable() 10 | export class ArtistService { 11 | 12 | constructor(private httpClient: HttpClient) { } 13 | 14 | getAll(): Observable> { 15 | const server = localStorage.getItem(SERVER_URL); 16 | return this.httpClient.get(`${server}/rest/getArtists`) 17 | .pipe( 18 | map(res => res['subsonic-response'].artists.index), 19 | last(), 20 | catchError(this.handleError) 21 | ); 22 | } 23 | 24 | private handleError(error: HttpErrorResponse) { 25 | if (error.error instanceof ErrorEvent) { 26 | // A client-side or network error occurred. Handle it accordingly. 27 | console.error('An error occurred:', error.error.message); 28 | } else { 29 | // The backend returned an unsuccessful response code. 30 | // The response body may contain clues as to what went wrong, 31 | console.error( 32 | `Backend returned code ${error.status}, ` + 33 | `body was: ${error.error}`); 34 | } 35 | // return an observable with a user-facing error message 36 | return throwError( 37 | 'Something bad happened; please try again later.'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/app/shared/service/auth.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { inject, TestBed } from '@angular/core/testing'; 2 | 3 | import { AuthService } from './auth.service'; 4 | import { HttpClientTestingModule } from '@angular/common/http/testing'; 5 | import { UsersService } from './users.service'; 6 | import { SystemService } from './system.service'; 7 | 8 | describe('AuthService', () => { 9 | beforeEach(() => { 10 | TestBed.configureTestingModule({ 11 | providers: [ 12 | AuthService, 13 | UsersService, 14 | SystemService 15 | ], 16 | imports: [HttpClientTestingModule] 17 | }); 18 | localStorage.clear(); 19 | }); 20 | 21 | it('should be created', inject([AuthService], (service: AuthService) => { 22 | expect(service).toBeTruthy(); 23 | })); 24 | 25 | it('should be false if no user is set', inject([AuthService], (service: AuthService) => { 26 | localStorage.clear(); 27 | expect(service.hasMyUser()).toBeFalsy(); 28 | })); 29 | 30 | it('should be false if no user is set', inject([AuthService], (service: AuthService) => { 31 | service.loginMyUser('username', 'abc123', 'http://localhost'); 32 | expect(service.hasMyUser()).toBeTruthy(); 33 | })); 34 | 35 | it('should sign the user out', inject([AuthService], (service: AuthService) => { 36 | service.loginMyUser('username', 'abc123', 'http://localhost'); 37 | expect(service.hasMyUser()).toBeTruthy(); 38 | service.logoutMyUser(); 39 | expect(service.hasMyUser()).toBeFalsy(); 40 | })); 41 | }); 42 | 43 | export class AuthServiceSpy { 44 | loginMyUser = jasmine.createSpy('loginMyUser'); 45 | hasMyUser = jasmine.createSpy('hasMyUser'); 46 | hasRole = jasmine.createSpy('hasRole'); 47 | getMyUser = jasmine.createSpy('getMyUser'); 48 | } 49 | -------------------------------------------------------------------------------- /src/app/shared/service/auth.service.ts: -------------------------------------------------------------------------------- 1 | import { EventEmitter, Injectable } from '@angular/core'; 2 | import { Md5 } from 'ts-md5/dist/md5'; 3 | import { MyRoles, MyUser, SERVER_URL, USER_FOLDERS, USER_INFO, USER_ROLES } from '../domain/auth.domain'; 4 | import { UsersService } from './users.service'; 5 | import { Observable } from 'rxjs/internal/Observable'; 6 | 7 | export enum AuthEvent { 8 | LOGGED_OUT 9 | } 10 | 11 | @Injectable() 12 | export class AuthService { 13 | 14 | private authEvents = new EventEmitter(); 15 | 16 | constructor(private usersService: UsersService) { } 17 | 18 | loginMyUser(username: string, password: string, server: string) { 19 | // Log user in 20 | const salt = this.generateSalt(); 21 | const token = new Md5().appendStr(password).appendStr(salt).end().toString(); 22 | const myUser: MyUser = { 23 | name: username, 24 | salt: salt, 25 | token: token, 26 | server: server 27 | }; 28 | localStorage.setItem(USER_INFO, JSON.stringify(myUser)); 29 | localStorage.setItem(SERVER_URL, server); 30 | this.loadMyRoles(username); 31 | this.loadMyFolders(username); 32 | } 33 | 34 | loadMyRoles(username: string) { 35 | this.usersService.getUser(username).subscribe( 36 | res => { 37 | // Load user roles 38 | const myRoles: MyRoles = { 39 | adminRole: res.adminRole, 40 | settingsRole: res.settingsRole, 41 | downloadRole: res.downloadRole, 42 | uploadRole: res.uploadRole, 43 | playlistRole: res.playlistRole, 44 | coverArtRole: res.coverArtRole, 45 | commentRole: res.commentRole, 46 | podcastRole: res.podcastRole, 47 | streamRole: res.streamRole, 48 | jukeboxRole: res.jukeboxRole, 49 | shareRole: res.shareRole, 50 | videoConversionRole: res.videoConversionRole 51 | }; 52 | // Save loaded data 53 | localStorage.setItem(USER_ROLES, JSON.stringify(myRoles)); 54 | }); 55 | } 56 | 57 | loadMyFolders(username: string) { 58 | this.usersService.getUser(username).subscribe( 59 | res => { 60 | // Load user folders 61 | const myFolders = res.folder; 62 | // Save loaded data 63 | localStorage.setItem(USER_FOLDERS, JSON.stringify(myFolders)); 64 | }); 65 | } 66 | 67 | getMyUser(): MyUser { 68 | return JSON.parse(localStorage.getItem(USER_INFO)); 69 | } 70 | 71 | getMyRoles(): MyRoles { 72 | return JSON.parse(localStorage.getItem(USER_ROLES)); 73 | } 74 | 75 | getMyFolders(): Array { 76 | return JSON.parse(localStorage.getItem(USER_FOLDERS)); 77 | } 78 | 79 | hasMyUser(): boolean { 80 | return this.getMyUser() !== null; 81 | } 82 | 83 | hasRole(role: string): boolean { 84 | return this.getMyRoles()[role]; 85 | } 86 | 87 | logoutMyUser() { 88 | this.authEvents.emit(AuthEvent.LOGGED_OUT); 89 | localStorage.clear(); 90 | } 91 | 92 | authObservable(): Observable { 93 | return this.authEvents.asObservable(); 94 | } 95 | 96 | private generateSalt() { 97 | const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 98 | let result = ''; 99 | for (let i = 0; i < 20; i++) { 100 | result += chars[Math.floor(Math.random() * chars.length)]; 101 | } 102 | return result; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/app/shared/service/music-directory.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { MusicDirectoryService } from './music-directory.service'; 4 | import { HttpClientTestingModule } from '@angular/common/http/testing'; 5 | import {Observable} from 'rxjs/internal/Observable'; 6 | 7 | describe('MusicDirectoryService', () => { 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({ 10 | providers: [MusicDirectoryService], 11 | imports: [HttpClientTestingModule] 12 | }); 13 | }); 14 | 15 | it('should be created', inject([MusicDirectoryService], (service: MusicDirectoryService) => { 16 | expect(service).toBeTruthy(); 17 | })); 18 | }); 19 | 20 | export class MusicDirectoryServiceSpy { 21 | testDirectory = { 22 | child: [ 23 | { 24 | albumId: 1 25 | } 26 | ] 27 | }; 28 | getMusicDirectory = jasmine.createSpy('getMusicDirectory').and.callFake((id) => { 29 | return new Observable(observer => { 30 | observer.next(this.testDirectory); 31 | observer.complete(); 32 | }); 33 | }); 34 | } 35 | -------------------------------------------------------------------------------- /src/app/shared/service/music-directory.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import {HttpClient, HttpErrorResponse, HttpParams} from '@angular/common/http'; 3 | import { SERVER_URL } from '../domain/auth.domain'; 4 | import { MusicDirectory, MusicDirectoryResponse } from '../domain/music-directory.domain'; 5 | import { Observable } from 'rxjs'; 6 | import {catchError, last, map} from 'rxjs/operators'; 7 | import {throwError} from 'rxjs/internal/observable/throwError'; 8 | 9 | @Injectable() 10 | export class MusicDirectoryService { 11 | 12 | constructor(private httpClient: HttpClient) { } 13 | 14 | getMusicDirectory(id: string): Observable { 15 | const server = localStorage.getItem(SERVER_URL); 16 | const params = new HttpParams().set('id', id); 17 | return this.httpClient.get(`${server}/rest/getMusicDirectory`, { params: params }) 18 | .pipe( 19 | map(res => res['subsonic-response'].directory), 20 | last(), 21 | catchError(this.handleError) 22 | ); 23 | } 24 | 25 | private handleError(error: HttpErrorResponse) { 26 | if (error.error instanceof ErrorEvent) { 27 | // A client-side or network error occurred. Handle it accordingly. 28 | console.error('An error occurred:', error.error.message); 29 | } else { 30 | // The backend returned an unsuccessful response code. 31 | // The response body may contain clues as to what went wrong, 32 | console.error( 33 | `Backend returned code ${error.status}, ` + 34 | `body was: ${error.error}`); 35 | } 36 | // return an observable with a user-facing error message 37 | return throwError( 38 | 'Something bad happened; please try again later.'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/app/shared/service/notification.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { NotificationService } from './notification.service'; 4 | 5 | describe('NotificationService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [NotificationService] 9 | }); 10 | }); 11 | 12 | it('should be created', inject([NotificationService], (service: NotificationService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | 17 | export class NotificationServiceSpy { 18 | notify = jasmine.createSpy('notify'); 19 | } 20 | -------------------------------------------------------------------------------- /src/app/shared/service/notification.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | declare let Notification: any; 3 | 4 | @Injectable() 5 | export class NotificationService { 6 | 7 | constructor() { } 8 | 9 | notify(message: String) { 10 | if (!Notification) { 11 | // TODO: Handle problem where we don't have notifications 12 | } else if (Notification.permission === 'granted') { 13 | Notification(message); 14 | } else if (Notification.permission !== 'denied') { 15 | Notification.requestPermission(permission => { 16 | if (permission === 'granted') { 17 | Notification(message); 18 | } 19 | }); 20 | } else { 21 | // TODO: handle case where user doesn't allow notifications 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/app/shared/service/search.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { SearchService } from './search.service'; 4 | import { HttpClientTestingModule } from '@angular/common/http/testing'; 5 | 6 | describe('SearchService', () => { 7 | beforeEach(() => { 8 | TestBed.configureTestingModule({ 9 | providers: [SearchService], 10 | imports: [HttpClientTestingModule] 11 | }); 12 | }); 13 | 14 | it('should be created', inject([SearchService], (service: SearchService) => { 15 | expect(service).toBeTruthy(); 16 | })); 17 | }); 18 | -------------------------------------------------------------------------------- /src/app/shared/service/search.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import {HttpClient, HttpErrorResponse, HttpParams} from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { SearchResponse, SearchResult2 } from '../domain/search.domain'; 5 | import { SERVER_URL } from '../domain/auth.domain'; 6 | import {catchError, last, map} from 'rxjs/operators'; 7 | import {throwError} from 'rxjs/internal/observable/throwError'; 8 | 9 | @Injectable() 10 | export class SearchService { 11 | 12 | constructor(private httpClient: HttpClient) { } 13 | 14 | getSearch2(query: string): Observable { 15 | const server = localStorage.getItem(SERVER_URL); 16 | const params = new HttpParams() 17 | .set('query', query); 18 | return this.httpClient.get(`${server}/rest/search2`, { params: params }) 19 | .pipe( 20 | map(res => res['subsonic-response'].searchResult2), 21 | last(), 22 | catchError(this.handleError) 23 | ); 24 | } 25 | 26 | private handleError(error: HttpErrorResponse) { 27 | if (error.error instanceof ErrorEvent) { 28 | // A client-side or network error occurred. Handle it accordingly. 29 | console.error('An error occurred:', error.error.message); 30 | } else { 31 | // The backend returned an unsuccessful response code. 32 | // The response body may contain clues as to what went wrong, 33 | console.error( 34 | `Backend returned code ${error.status}, ` + 35 | `body was: ${error.error}`); 36 | } 37 | // return an observable with a user-facing error message 38 | return throwError( 39 | 'Something bad happened; please try again later.'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/app/shared/service/side-menu.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { SideMenuService } from './side-menu.service'; 4 | 5 | describe('SideMenuService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [SideMenuService] 9 | }); 10 | }); 11 | 12 | it('should be created', inject([SideMenuService], (service: SideMenuService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /src/app/shared/service/side-menu.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, EventEmitter } from '@angular/core'; 2 | 3 | @Injectable() 4 | export class SideMenuService { 5 | public toggleSideMenu: EventEmitter = new EventEmitter(); 6 | 7 | constructor() { } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/app/shared/service/stream.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { StreamService } from './stream.service'; 2 | import { AudioProvider } from '../provider/audio.provider'; 3 | import { MyUser, USER_INFO } from '../domain/auth.domain'; 4 | import { MediaFile } from '../domain/media-file.domain'; 5 | import { Observable } from 'rxjs/internal/Observable'; 6 | import { AuthEvent, AuthService } from './auth.service'; 7 | import { EventEmitter } from '@angular/core'; 8 | import SpyObj = jasmine.SpyObj; 9 | 10 | export class StreamServiceSpy { 11 | streamFile = jasmine.createSpy('streamFile'); 12 | onStreamStart = jasmine.createSpy('onStreamStart').and.callFake(() => { 13 | return new Observable(observer => observer.complete()); 14 | }); 15 | } 16 | 17 | class TestAudioProvider implements AudioProvider { 18 | src: string; 19 | volume: number; 20 | play = jasmine.createSpy('play'); 21 | pause = jasmine.createSpy('pause'); 22 | close = jasmine.createSpy('close'); 23 | onEnded = jasmine.createSpy('onEnded').and.callFake((fn) => this.onEndedFunction = fn); 24 | onEndedFunction: () => void; 25 | } 26 | 27 | const mediaFile: MediaFile = { 28 | id: '12345', 29 | parent: '1234', 30 | title: 'Test Song', 31 | album: 'Test Album', 32 | artist: 'Test Artist', 33 | track: 1, 34 | coverArt: '1234', 35 | size: 1.3, 36 | contentType: 'audio/mpeg', 37 | suffix: 'mp3', 38 | duration: 360, 39 | bitRate: 360, 40 | path: 'home/audio', 41 | isVideo: false, 42 | playCount: 2, 43 | created: '2017-08-09T03:59:13.000Z', 44 | albumId: '1234', 45 | artistId: '1234', 46 | type: 'music' 47 | }; 48 | const mediaFile2: MediaFile = Object.assign({}, mediaFile, { id: 'media-file-2' }); 49 | describe('StreamService', () => { 50 | let streamService: StreamService; 51 | let audioProvider: TestAudioProvider; 52 | let authService: SpyObj; 53 | const authEvents = new EventEmitter(); 54 | const myUser: MyUser = { 55 | name: 'username', 56 | salt: 'abc123', 57 | token: 'abc123', 58 | server: 'localhost', 59 | }; 60 | beforeEach(() => { 61 | localStorage.setItem(USER_INFO, JSON.stringify(myUser)); 62 | audioProvider = new TestAudioProvider(); 63 | authService = jasmine.createSpyObj(['loginMyUser', 'hasMyUser', 'hasRole', 'authObservable']); 64 | authService.authObservable.and.returnValue(authEvents.asObservable()); 65 | streamService = new StreamService(audioProvider, authService); 66 | }); 67 | 68 | it('should start streaming on streamFile', done => { 69 | streamService.onStreamStart(data => { 70 | expect(data.isPlaying).toBeTruthy(); 71 | expect(data.mediaFile).toBe(mediaFile); 72 | done(); 73 | }); 74 | streamService.streamFile(mediaFile); 75 | expect(audioProvider.play).toHaveBeenCalled(); 76 | }); 77 | 78 | it('should start streaming first item added to queue', done => { 79 | streamService.onStreamStart(data => { 80 | expect(data.isPlaying).toBeTruthy(); 81 | expect(data.mediaFile).toBe(mediaFile); 82 | done(); 83 | }); 84 | streamService.addToQueue([mediaFile]); 85 | expect(audioProvider.play).toHaveBeenCalled(); 86 | }); 87 | 88 | it('should stream the second file after the first is finished', () => { 89 | const mediaFiles = [mediaFile, mediaFile2]; 90 | streamService.addToQueue(mediaFiles); 91 | expect(audioProvider.src).toContain(mediaFile.id); 92 | audioProvider.onEndedFunction(); 93 | expect(audioProvider.play).toHaveBeenCalledTimes(2); 94 | expect(audioProvider.src).toContain(mediaFile2.id); 95 | expect(mediaFiles).toContain(mediaFile, mediaFile2); 96 | }); 97 | 98 | it('should not start stream if another file is streaming', () => { 99 | streamService.streamFile(mediaFile); 100 | streamService.addToQueue([mediaFile2]); 101 | expect(audioProvider.play).toHaveBeenCalledTimes(1); 102 | expect(audioProvider.src).not.toContain(mediaFile2.id); 103 | }); 104 | 105 | it('should skip to the next song in the queue', () => { 106 | const mediaFiles = [mediaFile, mediaFile2]; 107 | streamService.addToQueue(mediaFiles); 108 | expect(audioProvider.src).toContain(mediaFile.id); 109 | streamService.next(); 110 | expect(audioProvider.play).toHaveBeenCalledTimes(2); 111 | expect(audioProvider.src).toContain(mediaFile2.id); 112 | }); 113 | 114 | it('should play the previous song', () => { 115 | const mediaFiles = [mediaFile, mediaFile2]; 116 | streamService.addToQueue(mediaFiles); 117 | expect(audioProvider.src).toContain(mediaFile.id); 118 | streamService.next(); 119 | expect(audioProvider.play).toHaveBeenCalledTimes(2); 120 | expect(audioProvider.src).toContain(mediaFile2.id); 121 | streamService.previous(); 122 | expect(audioProvider.play).toHaveBeenCalledTimes(3); 123 | expect(audioProvider.src).toContain(mediaFile.id); 124 | }); 125 | 126 | it('should stop the stream if user logs out', () => { 127 | streamService.streamFile(mediaFile); 128 | expect(audioProvider.play).toHaveBeenCalled(); 129 | authEvents.emit(AuthEvent.LOGGED_OUT); 130 | expect(audioProvider.close).toHaveBeenCalled(); 131 | }); 132 | }); 133 | -------------------------------------------------------------------------------- /src/app/shared/service/stream.service.ts: -------------------------------------------------------------------------------- 1 | import { Inject, Injectable } from '@angular/core'; 2 | import { MyUser, USER_INFO } from '../domain/auth.domain'; 3 | import { environment } from '../../../environments/environment'; 4 | import { MediaFile } from '../domain/media-file.domain'; 5 | import { Subject, Subscription } from 'rxjs'; 6 | import { AUDIO_PROVIDER, AudioProvider } from '../provider/audio.provider'; 7 | import { AuthEvent, AuthService } from './auth.service'; 8 | 9 | @Injectable() 10 | export class StreamService { 11 | set volume(it: number) { 12 | this._volume = it; 13 | this.audioProvider.volume = it; 14 | } 15 | get volume(): number { 16 | return this._volume; 17 | } 18 | private _volume = 1.0; 19 | private streamObserver = new Subject(); 20 | private currentMediaFile: MediaFile; 21 | private mediaQueue: Array = []; 22 | private previousMediaQueue: Array = []; 23 | 24 | constructor(@Inject(AUDIO_PROVIDER) private audioProvider: AudioProvider, private authService: AuthService) { 25 | this.audioProvider.onEnded(() => { 26 | if (this.mediaQueue.length > 0) { 27 | this.previousMediaQueue.push(this.currentMediaFile); 28 | this.streamFile(this.mediaQueue.pop()); 29 | } else { 30 | this.currentMediaFile = null; 31 | this.updateStream(false, null); 32 | } 33 | }); 34 | 35 | this.authService.authObservable() 36 | .subscribe(event => { 37 | if (event === AuthEvent.LOGGED_OUT) { 38 | this.audioProvider.close(); 39 | } 40 | }); 41 | } 42 | 43 | streamFile(mediaFile: MediaFile) { 44 | this.audioProvider.pause(); 45 | const userInfo: MyUser = JSON.parse(localStorage.getItem(USER_INFO)); 46 | const streamUrl = `${userInfo.server}/rest/stream?id=${mediaFile.id}&v=${environment.apiVersion}&u=${userInfo.name}` + 47 | `&s=${userInfo.salt}&t=${userInfo.token}&c=${environment.applicationName}`; 48 | this.audioProvider.src = streamUrl; 49 | try { 50 | this.audioProvider.play(); 51 | this.updateStream(true, mediaFile); 52 | } catch (e) { 53 | // Browser doesn't support what we are playing? 54 | console.log(e); 55 | } 56 | } 57 | 58 | addToQueue(mediaFiles: Array) { 59 | const reversed = mediaFiles.slice().reverse(); 60 | if (!this.currentMediaFile) { 61 | this.streamFile(reversed.pop()); 62 | } 63 | this.mediaQueue.push(...reversed); 64 | } 65 | 66 | onStreamStart(fn: (mediaStream: MediaStream) => void): Subscription { 67 | return this.streamObserver.subscribe(fn); 68 | } 69 | 70 | pause() { 71 | this.audioProvider.pause(); 72 | this.updateStream(false); 73 | } 74 | 75 | play() { 76 | if (this.currentMediaFile) { 77 | this.audioProvider.play(); 78 | this.updateStream(true); 79 | } 80 | } 81 | 82 | next() { 83 | if (this.mediaQueue.length > 0) { 84 | this.previousMediaQueue.push(this.currentMediaFile); 85 | this.streamFile(this.mediaQueue.pop()); 86 | } 87 | } 88 | 89 | previous() { 90 | if (this.currentMediaFile) { 91 | this.mediaQueue.push(this.currentMediaFile); 92 | } 93 | if (this.previousMediaQueue.length > 0) { 94 | this.streamFile(this.previousMediaQueue.pop()); 95 | } 96 | } 97 | 98 | private updateStream(isPlaying: boolean, mediaFile?: MediaFile) { 99 | if (mediaFile) { 100 | this.currentMediaFile = mediaFile; 101 | } 102 | this.streamObserver.next({ 103 | isPlaying: isPlaying, 104 | mediaFile: this.currentMediaFile 105 | }); 106 | } 107 | } 108 | 109 | export interface MediaStream { 110 | isPlaying: boolean; 111 | mediaFile?: MediaFile; 112 | } 113 | -------------------------------------------------------------------------------- /src/app/shared/service/system.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { SystemService } from './system.service'; 4 | import { HttpClientTestingModule } from '@angular/common/http/testing'; 5 | import {Observable} from 'rxjs/internal/Observable'; 6 | 7 | describe('SystemService', () => { 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({ 10 | providers: [SystemService], 11 | imports: [HttpClientTestingModule] 12 | }); 13 | }); 14 | 15 | it('should be created', inject([SystemService], (service: SystemService) => { 16 | expect(service).toBeTruthy(); 17 | })); 18 | }); 19 | 20 | export class SystemServiceSpy { 21 | ping = jasmine.createSpy('ping').and.callFake(() => { 22 | return new Observable(observer => observer.complete()); 23 | }); 24 | } 25 | -------------------------------------------------------------------------------- /src/app/shared/service/system.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { SERVER_URL } from '../domain/auth.domain'; 4 | 5 | @Injectable() 6 | export class SystemService { 7 | 8 | constructor(private http: HttpClient) { } 9 | 10 | ping() { 11 | const server = localStorage.getItem(SERVER_URL); 12 | return this.http.get(server + '/rest/ping'); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/app/shared/service/users.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { UsersService } from './users.service'; 4 | import { HttpClientTestingModule } from '@angular/common/http/testing'; 5 | 6 | describe('UsersService', () => { 7 | beforeEach(() => { 8 | TestBed.configureTestingModule({ 9 | imports: [ 10 | HttpClientTestingModule 11 | ], 12 | providers: [UsersService] 13 | }); 14 | }); 15 | 16 | it('should be created', inject([UsersService], (service: UsersService) => { 17 | expect(service).toBeTruthy(); 18 | })); 19 | }); 20 | -------------------------------------------------------------------------------- /src/app/shared/service/users.service.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | import {HttpClient, HttpErrorResponse, HttpParams} from '@angular/common/http'; 3 | import {SERVER_URL} from '../domain/auth.domain'; 4 | import {UsersResponse} from '../domain/users.domain'; 5 | import {User, UserResponse} from '../domain/user.domain'; 6 | import {Observable} from 'rxjs'; 7 | import {catchError, last, map} from 'rxjs/operators'; 8 | import {throwError} from 'rxjs/internal/observable/throwError'; 9 | 10 | @Injectable() 11 | export class UsersService { 12 | 13 | constructor(private httpClient: HttpClient) { } 14 | 15 | getUser(username: string): Observable { 16 | const server = localStorage.getItem(SERVER_URL); 17 | const params = new HttpParams() 18 | .set('username', username); 19 | return this.httpClient.get(`${server}/rest/getUser`, { params: params }) 20 | .pipe( 21 | map(res => res['subsonic-response'].user), 22 | last(), 23 | catchError(this.handleError) 24 | ); 25 | } 26 | 27 | getUsers(): Observable> { 28 | const server = localStorage.getItem(SERVER_URL); 29 | return this.httpClient.get(`${server}/rest/getUsers`) 30 | .pipe( 31 | map(res => res['subsonic-response'].users.user), 32 | last(), 33 | catchError(this.handleError) 34 | ); 35 | } 36 | 37 | createUser(options: { 38 | username: string, 39 | password: string, 40 | email: string, 41 | ldapAuthenticated?: boolean, 42 | adminRole?: boolean, 43 | settingsRole?: boolean, 44 | downloadRole?: boolean, 45 | uploadRole?: boolean, 46 | playlistRole?: boolean, 47 | coverArtRole?: boolean, 48 | commentRole?: boolean, 49 | podcastRole?: boolean, 50 | streamRole?: boolean, 51 | jukeboxRole?: boolean, 52 | shareRole?: boolean, 53 | videoConversionRole?: boolean 54 | }, 55 | musicFolderId?: Array) { 56 | const server = localStorage.getItem(SERVER_URL); 57 | let params = new HttpParams(); 58 | for (const option in options) { 59 | if (options.hasOwnProperty(option)) { 60 | params = params.set(option, options[option]); 61 | } 62 | } 63 | for (const id in musicFolderId) { 64 | if (musicFolderId.hasOwnProperty(id)) { 65 | params = params.set('musicFolderId', id); 66 | } 67 | } 68 | return this.httpClient.get(`${server}/rest/createUser`, { params: params }); 69 | } 70 | 71 | updateUser(options: { 72 | username: string, 73 | password?: string, 74 | email?: string, 75 | ldapAuthenticated?: boolean, 76 | adminRole?: boolean, 77 | settingsRole?: boolean, 78 | downloadRole?: boolean, 79 | uploadRole?: boolean, 80 | playlistRole?: boolean, 81 | coverArtRole?: boolean, 82 | commentRole?: boolean, 83 | podcastRole?: boolean, 84 | streamRole?: boolean, 85 | jukeboxRole?: boolean, 86 | shareRole?: boolean, 87 | videoConversionRole?: boolean, 88 | maxBitRate?: number 89 | }, 90 | musicFolderId?: Array) { 91 | const server = localStorage.getItem(SERVER_URL); 92 | let params = new HttpParams(); 93 | for (const option in options) { 94 | if (options.hasOwnProperty(option)) { 95 | params = params.set(option, options[option]); 96 | } 97 | } 98 | for (const id in musicFolderId) { 99 | if (musicFolderId.hasOwnProperty(id)) { 100 | params = params.set('musicFolderId', id); 101 | } 102 | } 103 | return this.httpClient.get(`${server}/rest/updateUser`, { params: params }); 104 | } 105 | 106 | deleteUser(username: string) { 107 | const server = localStorage.getItem(SERVER_URL); 108 | const params = new HttpParams() 109 | .set('username', username); 110 | return this.httpClient.get(`${server}/rest/deleteUser`, { params: params }); 111 | } 112 | 113 | changePassword(username: string, password: string) { 114 | const server = localStorage.getItem(SERVER_URL); 115 | const params = new HttpParams() 116 | .set('username', username) 117 | .set('password', password); 118 | return this.httpClient.get(`${server}/rest/changePassword`, { params: params }); 119 | } 120 | 121 | private handleError(error: HttpErrorResponse) { 122 | if (error.error instanceof ErrorEvent) { 123 | // A client-side or network error occurred. Handle it accordingly. 124 | console.error('An error occurred:', error.error.message); 125 | } else { 126 | // The backend returned an unsuccessful response code. 127 | // The response body may contain clues as to what went wrong, 128 | console.error( 129 | `Backend returned code ${error.status}, ` + 130 | `body was: ${error.error}`); 131 | } 132 | // return an observable with a user-facing error message 133 | return throwError( 134 | 'Something bad happened; please try again later.'); 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /src/app/side-menu/side-menu.component.html: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /src/app/side-menu/side-menu.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsonic/airsonic-ui/5bc4ceb0350f296e970fd5c1688f8064797490db/src/app/side-menu/side-menu.component.scss -------------------------------------------------------------------------------- /src/app/side-menu/side-menu.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SideMenuComponent } from './side-menu.component'; 4 | import { TranslateModule } from '@ngx-translate/core'; 5 | import { SideMenuService } from '../shared/service/side-menu.service'; 6 | 7 | describe('SideMenuComponent', () => { 8 | let component: SideMenuComponent; 9 | let fixture: ComponentFixture; 10 | 11 | beforeEach(async(() => { 12 | TestBed.configureTestingModule({ 13 | declarations: [ 14 | SideMenuComponent 15 | ], 16 | imports: [ 17 | TranslateModule.forRoot() 18 | ], 19 | providers: [ 20 | SideMenuService 21 | ] 22 | }) 23 | .compileComponents(); 24 | })); 25 | 26 | beforeEach(() => { 27 | fixture = TestBed.createComponent(SideMenuComponent); 28 | component = fixture.componentInstance; 29 | fixture.detectChanges(); 30 | }); 31 | 32 | // it('should create', () => { 33 | // expect(component).toBeTruthy(); 34 | // }); 35 | }); 36 | -------------------------------------------------------------------------------- /src/app/side-menu/side-menu.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { SideMenuService } from '../shared/service/side-menu.service'; 3 | 4 | @Component({ 5 | selector: 'app-side-menu', 6 | templateUrl: './side-menu.component.html', 7 | styleUrls: ['./side-menu.component.scss'] 8 | }) 9 | export class SideMenuComponent implements OnInit { 10 | 11 | sideMenuClosed = false; 12 | 13 | constructor(private sideMenuService: SideMenuService) { } 14 | 15 | ngOnInit() { 16 | this.sideMenuService.toggleSideMenu.subscribe(() => { 17 | this.sideMenuClosed = !this.sideMenuClosed; 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/app/top-bar/top-bar.component.html: -------------------------------------------------------------------------------- 1 | 40 | -------------------------------------------------------------------------------- /src/app/top-bar/top-bar.component.scss: -------------------------------------------------------------------------------- 1 | /* Fix boostrap underline on link hover */ 2 | a:hover { 3 | text-decoration: none; 4 | } 5 | 6 | #side-menu-toggle { 7 | .material-icons { 8 | transition: transform 0.4s ease; 9 | } 10 | } 11 | 12 | .side-menu-toggled { 13 | transform: rotate(180deg); 14 | } 15 | -------------------------------------------------------------------------------- /src/app/top-bar/top-bar.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TopBarComponent } from './top-bar.component'; 4 | import { RouterTestingModule } from '@angular/router/testing'; 5 | import { FormsModule } from '@angular/forms'; 6 | import { SideMenuService } from '../shared/service/side-menu.service'; 7 | import { AuthService } from '../shared/service/auth.service'; 8 | import { AuthServiceSpy } from '../shared/service/auth.service.spec'; 9 | import { TranslateModule } from '@ngx-translate/core'; 10 | 11 | describe('TopBarComponent', () => { 12 | let component: TopBarComponent; 13 | let fixture: ComponentFixture; 14 | const router = { 15 | navigateByUrl: jasmine.createSpy('navigateByUrl'), 16 | navigate: jasmine.createSpy('navigate') 17 | }; 18 | 19 | beforeEach(async(() => { 20 | TestBed.configureTestingModule({ 21 | declarations: [ TopBarComponent ], 22 | providers: [ 23 | { provide: AuthService, useValue: new AuthServiceSpy() }, 24 | { provide: router, useValue: router }, 25 | SideMenuService 26 | ], 27 | imports: [ 28 | RouterTestingModule, 29 | FormsModule, 30 | TranslateModule.forRoot() 31 | ] 32 | }) 33 | .compileComponents(); 34 | })); 35 | 36 | beforeEach(() => { 37 | fixture = TestBed.createComponent(TopBarComponent); 38 | component = fixture.componentInstance; 39 | fixture.detectChanges(); 40 | }); 41 | 42 | it('should create', () => { 43 | expect(component).toBeTruthy(); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /src/app/top-bar/top-bar.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AuthService } from '../shared/service/auth.service'; 3 | import { Router } from '@angular/router'; 4 | import { SideMenuService } from '../shared/service/side-menu.service'; 5 | import { MyUser } from '../shared/domain/auth.domain'; 6 | 7 | @Component({ 8 | selector: 'app-top-bar', 9 | templateUrl: './top-bar.component.html', 10 | styleUrls: ['./top-bar.component.scss'] 11 | }) 12 | export class TopBarComponent implements OnInit { 13 | user: MyUser; 14 | profilMenuOpen = false; 15 | sideMenuClosed = false; 16 | collapsed = true; 17 | query: string; 18 | 19 | constructor(private authService: AuthService, 20 | private router: Router, 21 | private sideMenuService: SideMenuService) {} 22 | 23 | ngOnInit() { 24 | this.user = this.authService.getMyUser(); 25 | } 26 | 27 | logout() { 28 | this.authService.logoutMyUser(); 29 | this.router.navigateByUrl('/login').then(() => { 30 | this.closeProfilMenu(); 31 | }); 32 | } 33 | 34 | hasRole(role: string): boolean { 35 | return this.authService.hasRole(role); 36 | } 37 | 38 | openProfilMenu() { 39 | this.profilMenuOpen = !this.profilMenuOpen; 40 | } 41 | 42 | closeProfilMenu() { 43 | this.profilMenuOpen = false; 44 | } 45 | 46 | collapseOpen() { 47 | this.collapsed = !this.collapsed; 48 | } 49 | 50 | onSearch(query: string) { 51 | this.router.navigate(['/search', query]); 52 | } 53 | 54 | toggleSideMenu() { 55 | this.sideMenuService.toggleSideMenu.emit(); 56 | this.sideMenuClosed = !this.sideMenuClosed; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsonic/airsonic-ui/5bc4ceb0350f296e970fd5c1688f8064797490db/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/assets/i18n/en-US.json: -------------------------------------------------------------------------------- 1 | { 2 | "login": { 3 | "username": "Username", 4 | "password": "Password", 5 | "server": "Server location", 6 | "sign-in": "Sign in" 7 | }, 8 | "search-result": { 9 | "no-matches-found": "No matches found" 10 | }, 11 | "settings": { 12 | "media_folders": "Media folders", 13 | "sharing": "Sharing" 14 | }, 15 | "song-table": { 16 | "title": "Title", 17 | "type": "Type", 18 | "bitrate": "Bitrate" 19 | }, 20 | "app": { 21 | "home": "Home", 22 | "playing": "Playing", 23 | "starred": "Starred", 24 | "playlists": "Playlists", 25 | "settings": "Settings" 26 | }, 27 | "top-bar": { 28 | "search": "Search", 29 | "logout": "Logout", 30 | "profile": "Profile" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/assets/i18n/fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "login": { 3 | "username": "Nom d'utilisateur", 4 | "password": "Mot de passe", 5 | "server": "URL du serveur", 6 | "sign-in": "Se connecter" 7 | }, 8 | "search-result": { 9 | "no-matches-found": "Aucun résultat" 10 | }, 11 | "settings": { 12 | "media_folders": "Dossiers de musique", 13 | "sharing": "Partage" 14 | }, 15 | "song-table": { 16 | "title": "Titre", 17 | "type": "Format", 18 | "bitrate": "Bitrate" 19 | }, 20 | "app": { 21 | "home": "Accueil", 22 | "playing": "Joué", 23 | "starred": "Favoris", 24 | "playlists": "Listes de lectures", 25 | "settings": "Paramètres" 26 | }, 27 | "top-bar": { 28 | "search": "Rechercher", 29 | "logout": "Se déconnecter", 30 | "profile": "Profil" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/assets/images/logo/airsonic-dark-350x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsonic/airsonic-ui/5bc4ceb0350f296e970fd5c1688f8064797490db/src/assets/images/logo/airsonic-dark-350x100.png -------------------------------------------------------------------------------- /src/assets/images/logo/airsonic-grey-350x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsonic/airsonic-ui/5bc4ceb0350f296e970fd5c1688f8064797490db/src/assets/images/logo/airsonic-grey-350x100.png -------------------------------------------------------------------------------- /src/assets/images/logo/airsonic-light-350x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsonic/airsonic-ui/5bc4ceb0350f296e970fd5c1688f8064797490db/src/assets/images/logo/airsonic-light-350x100.png -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | applicationName: 'Airsonic UI', 4 | apiVersion: '1.15.0' 5 | }; 6 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false, 8 | applicationName: 'Airsonic UI', 9 | apiVersion: '1.15.0' 10 | }; 11 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsonic/airsonic-ui/5bc4ceb0350f296e970fd5c1688f8064797490db/src/favicon.ico -------------------------------------------------------------------------------- /src/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsonic/airsonic-ui/5bc4ceb0350f296e970fd5c1688f8064797490db/src/favicon.png -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Airsonic UI 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /** 5 | * Required to support Web Animations `@angular/platform-browser/animations`. 6 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation 7 | **/ 8 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 9 | 10 | 11 | 12 | /*************************************************************************************************** 13 | * Zone JS is required by default for Angular itself. 14 | */ 15 | import 'zone.js/dist/zone'; // Included with Angular CLI. 16 | 17 | 18 | 19 | /*************************************************************************************************** 20 | * APPLICATION IMPORTS 21 | */ 22 | -------------------------------------------------------------------------------- /src/styles.scss: -------------------------------------------------------------------------------- 1 | @import "~vars.scss"; 2 | 3 | /**************************************************************** 4 | default / fixes 5 | ****************************************************************/ 6 | 7 | html, body, .min-width { min-width: 600px; } 8 | 9 | /* Always keep scrollbar */ 10 | body { overflow-y: scroll; } 11 | 12 | /* Rules for sizing the icon. */ 13 | .material-icons.md-18 { font-size: 18px; } 14 | .material-icons.md-24 { font-size: 24px; } 15 | .material-icons.md-36 { font-size: 36px; } 16 | .material-icons.md-48 { font-size: 48px; } 17 | 18 | /* Rules for using icons as black on a light background. */ 19 | .material-icons.md-dark { color: rgba(0, 0, 0, 0.54); } 20 | .material-icons.md-dark.md-inactive { color: rgba(0, 0, 0, 0.26); } 21 | 22 | /* Rules for using icons as white on a dark background. */ 23 | .material-icons.md-light { color: rgba(255, 255, 255, 1); } 24 | .material-icons.md-light.md-inactive { color: rgba(255, 255, 255, 0.3); } 25 | 26 | /* Fix bad vertical align with icons */ 27 | * > i.material-icons { vertical-align: middle; } 28 | 29 | /* Boostrap fix: Use pointer when hovering a button */ 30 | button, a { cursor: pointer; } 31 | 32 | /* Fix firefox outline on focus */ 33 | :focus, ::-moz-focus-inner, ::-moz-focus-outer { outline: none; } 34 | 35 | /**************************************************************** 36 | tools 37 | ****************************************************************/ 38 | 39 | .custom-left-border { 40 | border-left: 3px solid transparent; 41 | transition : border 0.2s ease-in-out, background-color 0.2s ease-in-out; 42 | } 43 | 44 | .custom-left-border:hover { 45 | background-color: rgba($color: #2f7bd9, $alpha: 0.1) 46 | } 47 | 48 | .custom-left-border-active { 49 | border-color: #2f7bd9; 50 | background-color: rgba($color: #000000, $alpha: 0.2) 51 | } 52 | 53 | /**************************************************************** 54 | side-menu / content 55 | ****************************************************************/ 56 | 57 | #side-menu, #content { 58 | transition: margin 0.8s ease; 59 | min-height: calc(100vh - #{$media-controls-height}); 60 | margin: 0; 61 | } 62 | 63 | #side-menu { 64 | position: fixed; 65 | top: 0; 66 | width: $side-menu-width; 67 | overflow-y: auto; 68 | .nav { 69 | .nav-link, .material-icons { 70 | font-size: 15px; 71 | } 72 | .nav-brand img { 73 | height: 48px; 74 | } 75 | } 76 | } 77 | 78 | #content { 79 | min-width: calc(600px - #{$side-menu-width}); 80 | margin-left: $side-menu-width; 81 | margin-bottom: $media-controls-height; 82 | } 83 | 84 | /* Toggle side-menu */ 85 | .hide-side-menu { margin-left: -$side-menu-width !important; } 86 | .expand-content { margin-left: 0 !important; } 87 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts", 15 | "polyfills.ts" 16 | ], 17 | "include": [ 18 | "**/*.spec.ts", 19 | "**/*.d.ts" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /src/vars.scss: -------------------------------------------------------------------------------- 1 | $side-menu-width: 13em; 2 | $media-controls-height: 56px; 3 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "importHelpers": true, 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "moduleResolution": "node", 9 | "emitDecoratorMetadata": true, 10 | "experimentalDecorators": true, 11 | "target": "es5", 12 | "typeRoots": [ 13 | "node_modules/@types" 14 | ], 15 | "lib": [ 16 | "es2017", 17 | "dom" 18 | ], 19 | "module": "es2015", 20 | "baseUrl": "./" 21 | } 22 | } -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs/Rx" 22 | ], 23 | "import-spacing": true, 24 | "indent": [ 25 | true, 26 | "spaces" 27 | ], 28 | "interface-over-type-literal": true, 29 | "label-position": true, 30 | "max-line-length": [ 31 | true, 32 | 140 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-arg": true, 47 | "no-bitwise": true, 48 | "no-console": [ 49 | true, 50 | "debug", 51 | "info", 52 | "time", 53 | "timeEnd", 54 | "trace" 55 | ], 56 | "no-construct": true, 57 | "no-debugger": true, 58 | "no-duplicate-super": true, 59 | "no-empty": false, 60 | "no-empty-interface": true, 61 | "no-eval": true, 62 | "no-inferrable-types": [ 63 | true, 64 | "ignore-params" 65 | ], 66 | "no-misused-new": true, 67 | "no-non-null-assertion": true, 68 | "no-shadowed-variable": true, 69 | "no-string-literal": false, 70 | "no-string-throw": true, 71 | "no-switch-case-fall-through": true, 72 | "no-trailing-whitespace": true, 73 | "no-unnecessary-initializer": true, 74 | "no-unused-expression": true, 75 | "no-use-before-declare": true, 76 | "no-var-keyword": true, 77 | "object-literal-sort-keys": false, 78 | "one-line": [ 79 | true, 80 | "check-open-brace", 81 | "check-catch", 82 | "check-else", 83 | "check-whitespace" 84 | ], 85 | "prefer-const": true, 86 | "quotemark": [ 87 | true, 88 | "single" 89 | ], 90 | "radix": true, 91 | "semicolon": [ 92 | true, 93 | "always" 94 | ], 95 | "triple-equals": [ 96 | true, 97 | "allow-null-check" 98 | ], 99 | "typedef-whitespace": [ 100 | true, 101 | { 102 | "call-signature": "nospace", 103 | "index-signature": "nospace", 104 | "parameter": "nospace", 105 | "property-declaration": "nospace", 106 | "variable-declaration": "nospace" 107 | } 108 | ], 109 | "unified-signatures": true, 110 | "variable-name": false, 111 | "whitespace": [ 112 | true, 113 | "check-branch", 114 | "check-decl", 115 | "check-operator", 116 | "check-separator", 117 | "check-type" 118 | ], 119 | "directive-selector": [ 120 | true, 121 | "attribute", 122 | "app", 123 | "camelCase" 124 | ], 125 | "component-selector": [ 126 | true, 127 | "element", 128 | "app", 129 | "kebab-case" 130 | ], 131 | "no-output-on-prefix": true, 132 | "use-input-property-decorator": true, 133 | "use-output-property-decorator": true, 134 | "use-host-property-decorator": true, 135 | "no-input-rename": true, 136 | "no-output-rename": true, 137 | "use-life-cycle-interface": true, 138 | "use-pipe-transform-interface": true, 139 | "component-class-suffix": true, 140 | "directive-class-suffix": true 141 | } 142 | } 143 | --------------------------------------------------------------------------------