diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md new file mode 100644 index 00000000..fb075d19 --- /dev/null +++ b/DOCUMENTATION.md @@ -0,0 +1,10 @@ + + +Documentation +============= + +Documentation is stored in a [dedicated repository](https://github.com/Libresonic/documentation). + diff --git a/README.md b/README.md index 4c5b853d..fa32d076 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Libresonic can be downloaded from [GitHub](https://github.com/Libresonic/libresonic/releases) for personal usage. Packagers can also reference the [release repository](https://libresonic.org/release/). -Please see the [INSTALL document](https://github.com/Libresonic/libresonic/blob/stable/documentation/INSTALL.md) for instructions on running Libresonic. +Please see the [INSTALL document](https://github.com/Libresonic/documentation/blob/stable/install.md) for instructions on running Libresonic. Community diff --git a/documentation/CONFIGURATION.md b/documentation/CONFIGURATION.md deleted file mode 100644 index d7379f82..00000000 --- a/documentation/CONFIGURATION.md +++ /dev/null @@ -1,52 +0,0 @@ -# Startup Configuration Guide - -Libresonic has some system-wide configuration. These configurations are stored in the -`libresonic.properties` file. There are some exceptions, such as the `libresonic.home` parameter, which -are supplied as a Java System Property. - -## libresonic.properties Parameters -These parameters are simple key-value pairs stored in a list. It is recommended that these parameters -are changed through the web interface settings page. However, they can also be modified directly. Shutdown -your server first, modify, then start it for changes to take effect. - -## Java Parameters -These parameters are not modifiable through the web interface. See below for steps for setting Java Parameters. - -#### `libresonic.home` -This parameter dictates the folder where Libresonic will store its logs, -settings, transcode binaries, index and database if using the default H2 -database. As such it is recommended to backup this folder. - -*default: `/var/libresonic` or `C:\\music`* - -### Spring Boot/Standlone Specific Configs -The following configs only apply when running libresonic as a standalone package (i.e. without Tomcat or Jetty). These are only a subset of the connfigurations for spring-boot, the full list can be found [here](https://docs.spring.io/spring-boot/docs/1.4.5.RELEASE/reference/htmlsingle/#common-application-properties). Not that not all configurations apply to libresonic, but the important section is the `# EMBEDDED SERVER CONFIGURATION` section. - -#### `server.port` -This property only applies for spring boot/standalone config. It changes the port that the standalone package listens on. - -*default: 8080* - -#### `server.address` -This property only applies for spring boot/standalone config. It changes the address that the standalone package listens on. - -*default: not set and listens to all addresses* - -### Setting Java Parameters on Tomcat -As described in the [RUNNING.txt](http://tomcat.apache.org/tomcat-8.0-doc/RUNNING.txt) doc provided by tomcat, -you can create a file named `setenv.sh` or for windows `setenv.bat` in the Tomcat home `bin` folder to modify the -java args. - -Here is an example of a `setenv.sh` file (`setenv.bat` has slightly different syntax): -``` -export JAVA_OPTS="$JAVA_OPTS -Dlibresonic.home=/home/andrew/.cache/libresonic-test" -``` - -### Setting Java Parameters for Standalone Package (SpringBoot) -When running the standalone package, add `-Dlibresonic.home=YOUR_PATH_HERE` to the `java` command line right before the -`-jar` argument. Here is an example for linux (windows users will want to use their OS specific path syntax i.e. -`C:\\your\path`) - -``` -java -Dlibresonic.home=/home/andrew/libresonichome -jar libresonic.war -``` diff --git a/documentation/DATABASE.md b/documentation/DATABASE.md deleted file mode 100644 index c02dd769..00000000 --- a/documentation/DATABASE.md +++ /dev/null @@ -1,90 +0,0 @@ -# Database Selection - -Libresonic is built with generic ANSI SQL (for the most part) and uses [Liquibase](http://www.liquibase.org/) -for database migrations in a database agnostic way and should be -able to run against a variety of databases. However, not all databases have been verified to -work and you may run into issues with the liquibase migrations or runtime SQL issues. Here is -a list of community tested setups: - -| Database | Version | Liquibase | Runtime | Notes | -|:----------:|:-------:|:---------:|:-------:|:------:| -| HyperSQL | 1.8 | ✔ | ✔ | Default| -| HyperSQL | 2.X | ✕ | ✕ | No curent plans to support, look into SQLite instead? | -| PostgreSQL | 9.5 | ✔ | ✔ | | -| MariaDB | 10.2 | ✔ | ✔ | | -| MySQL | 5.7.17 | ✔ | ✕ | WIP | - -If you wish to continue using the current hsql 1.8 database driver, no action is needed. If you wish to use another -database, read on. - -# Database Configuration - -*Before doing anything, make sure your database is properly backed up. Ensure your server is shutdown* - -For those that wish to change their database, instructions differ based on -whether you wish for your database connection to be managed by your container (tomcat), -or whether you wish Libresonic to manage it for you. The former may offer some performance -gains in the case of many concurrent users with connection pooling while the latter is easiest. - -We will refer to container managed configuration as jndi and libresonic managed configuration as embedded. - -## Embedded -*Before doing anything, make sure your database is properly backed up. Ensure your server is shutdown* - -In your libresonic.properties file, you will need to add the following settings (this is just an example): - -``` -DatabaseConfigType=embed -DatabaseConfigEmbedDriver=org.hsqldb.jdbcDriver -DatabaseConfigEmbedUrl=jdbc:hsqldb:file:/tmp/libre/db/libresonic -DatabaseConfigEmbedUsername=sa -DatabaseConfigEmbedPassword= -``` - -In addition, you will need to ensure that a jdbc driver suitable for your -database is on the -[classpath](https://docs.oracle.com/javase/8/docs/technotes/tools/windows/classpath.html). - -*Note adding to the classpath is currently pretty difficult for spring-boot. Tomcat is easy, just copy into tomcat home -/lib. TODO: provide prebuilt artifacts with tested databases built in?* - -## JNDI -*Before doing anything, make sure your database is properly backed up. Ensure your server is shutdown* - -In your libresonic.properties file, you will need to add the following settings (this is just an example): - -``` -DatabaseConfigType=jndi -DatabaseConfigJNDIName=jdbc/libresonicDB -``` - -Then in your context.xml in your tomcat directory, add the jndi config: - -``` - - -``` - -Finally, copy the jdbc driver from the database vendor website to the `lib` directory in your tomcat folder. - -## Database Vendor Specific Notes - -### PostgreSQL - -`stringtype=unspecified` on your jdbc url string is necessary. - -You will also need to add `DatabaseUsertableQuote=\"` to your properties -file. This is due to the fact that our `user` table is a keyword for postgres. - -## Troubleshooting - -In the event that you change these settings, restart your server and it fails to start, you can remedy this by reverting -to the LEGACY config by removing all `Database*` settings from your `libresonic.properties` file. diff --git a/documentation/FreeBSD-FreeNAS-Install.md b/documentation/FreeBSD-FreeNAS-Install.md deleted file mode 100644 index 0edaa6c2..00000000 --- a/documentation/FreeBSD-FreeNAS-Install.md +++ /dev/null @@ -1,143 +0,0 @@ -# Installing Libresonic on FreeBSD 10.3 and FreeNAS 9.10 - -### Preamble -This guide will wallk you through the process of deploying Libresonic on FreeBSD either in a Jail on on the main system. The prerequisites are you have root access on your FreeBSD machine (or jail), the ip address of the machine (or jail) and the Libresonic war available at the [Libresonic github page](https://github.com/Libresonic/libresonic/releases) - -If on FreeNAS create a standard jail in the web interface and enter the shell. - -### 1. Install Tomcat -To run Libresonic we need a server to run it in. Log into your machine and then run these commands either as root or with sudo - - #pkg install tomcat8 nano - -Hit y on all prompts to complete installation of Tomcat - -### 2.Configure Tomcat -Edit Tomcat's user configuration file with your favourite text editor. We installed nano in step 1. - - #rm /usr/local/apache-tomcat-8.0/conf/tomcat-users.xml - #nano /usr/local/apache-tomcat-8.0/conf/tomcat-users.xml - - -Copy this - - - - - - - - - - - - - -Use Ctrl-O to save and y to confirm. Ctrl-X to exit Nano. - -If you wish to use a different username and password please append the second last line to contain your preferred username and password. - - - -### 3. Start and test Tomcat - #echo tomcat8_enable="YES" >> /etc/rc.conf - #service tomcat8 start - -Test Tomcat is listening on port 8080 - - # netstat -an | grep 8080 -It should return a line containing the IP address of your system (or jail). ie mine returns - - tcp4 0 0 10.0.0.10.8080 *.* LISTEN -If in a jail it may also return the line "netstat: kvm not available: /dev/mem: No such file or directory" This can be ignored. - -### 4. Create directories and set up permissions - #mkdir /var/libresonic - #chown -R www:www /var/libresonic - #chown -R www:www /usr/local/apache-tomcat-8.0/webapps - -### 5. Deploy Libresonic -Open a web browser and enter your servers IP address in the url bar followed by :8080 eg - - 10.0.0.10:8080 - -You should be greeted by the Apache Tomcat page. Click on the Manager App button on the right of the page and enter the username and password used in step 3. Default was username: admin and password: admin - -Scroll down to Deploy and the subheading "WAR file to deploy" hit choose file and select the libresonic.war downloaded in the preamble. After selecting press the deploy button. Scroll up and press start. When the page refreshes a message "OK - Started application at context path /libresonic-v6.1" should be visible. - -### 6. Navigate to Libresonic - -In a browser. Take your server IP address and port and append the the context path from above - -ie if the War deployed was called libresonic-v6.1.war navigate to: - - 10.0.0.10:8080/libresonic-v6.1/ - -### 7. Log into Libresonic - -Log in. The default is username: admin password: admin -Follow the prompts on the web page to change the password. This will log you out. Please re-login with your new password - -### 8. Set up media -If you are on FreeBSD in a jail, consult the documentation for your Jail Manager tool on how to pass through storage. If using FreeNAS please use the FreeNAS webui to pass through the dataset containing your music. - -In Libresonic click 2. Setup Media folders. - -Name your media folder and put in the path to your music. Then click "Scan media folders now" - -Congratulations you have set up Libresonic - -##Transcoding Support - -If you want transcoding and DON'T need mp3 support - - #pkg install ffmpeg - #ln -s /usr/local/bin/ffmpeg /var/libresonic/transcode/ffmpeg - #service tomcat8 restart - -Congratulations you have transcoding enabled - -If you need mp3 support and most likely you will the process is more arduous as FreeBSD's ffmpeg doesn't contain mp3 support by default and must be configured and compiled by the user. - -### 1. Install ffmpeg dependencies and Ports Tree - -Install the dependencies required to build and use ffmpeg - - #pkg install yasm binutils texi2html frei0r v4l_compat gmake pkgconf perl5 fontconfig freetype2 opencv-core schroedinger libtheora libv4l libva libvdpau libvorbis libvpx libx264 xvid gnutls libiconv - -Now install the FreeBSD Ports Tree - - #portsnap fetch - #portsnap extract - - -### 2. Build ffmpeg -Navigate to the ffmpeg port directory - - #cd /usr/ports/multimedia/ffmpeg - -Configure ffmpeg build - - #make configure - -This will bring up a menu. Scroll down using arrow keys to "LAME" and hit the spacebar to enable it. Press enter to continue. -The ffmpeg source files will automatically be downloaded then you will be presented with an additional prompt to install documentation. I uncheck with spacebar then press enter to continue. - -Commence build and installation of ffmpeg - - #make install clean - -Building ffmpeg will take some time depending on the capabilities of your machine, please be patient. - -Link ffmpeg to where Libresonic expects the transcoder to be. - - #ln -s /usr/local/bin/ffmpeg /var/libresonic/transcode/ffmpeg - -Finally restart tomcat - - #service tomcat8 restart - -Congratulations you have ffmpeg with mp3 support installed ready for Libresonic to use. diff --git a/documentation/INSTALL.md b/documentation/INSTALL.md deleted file mode 100644 index 3a3ca08d..00000000 --- a/documentation/INSTALL.md +++ /dev/null @@ -1,152 +0,0 @@ - - -# Installing Libresonic - -This document is designed to explain how to run Libresonic. Although the -commands here are tailored to Linux, these steps should be easy to also perform -on Windows. If you find something that could be improved in this documentation, please help -contribute on the github project at [https://github.com/Libresonic/libresonic](https://github.com/Libresonic/libresonic). - -This document aims to provide steps to install Libresonic in a quick fashion. -However, there are other documents detailing specifics on running Libresonic. -It is recommended to also read them after this document but before actually -running Libresonic. To list some of the important ones: - - * [PROXY](PROXY.md) - Recommended if you plan on exposing Libresonic to the internet - * [CONFIGURATION](CONFIGURATION.md) - Documents some startup configurations that cannot be changed in the Libresonic Settings Page - * [DATABASE](DATABASE.md) - Provides guidance on using a database other than HSQL 1.8. Strongly recommended for long term / heavy use. - * [MIGRATE](MIGRATE.md) - Documents upgrading from an old Subsonic installation - * [TRANSCODE](TRANSCODE.md) - Mandatory setup if you want Libresonic to convert between formats on the fly - -## Installing From Pre-Compiled Package - -Libresonic is packaged in a [WAR format](https://en.wikipedia.org/wiki/WAR_(file_format)). -This format is suitable for any OS running Java. Although the WAR format -typically requires an application container such as -[Tomcat](http://tomcat.apache.org/), Libresonic produces an executable WAR that -can be run standalone. - -### Prerequisites - -In order to install and run Libresonic, you will need: - - * A JDK installation. 1.8.x series of OpenJDK or Oracle JDK 8+ should work. - -### Download Libresonic - -WAR files are available on the [Releases Page](https://github.com/Libresonic/libresonic/releases). Choose either stable or develop. - -### Tomcat Method - -You will need a running [Tomcat](http://tomcat.apache.org/) server. If you're unfamiliar with Tomcat, there are many [guides](https://www.linode.com/docs/websites/frameworks/apache-tomcat-on-ubuntu-16-04) on it. For debian/ubuntu like distributions, you may need to ensure /etc/default/tomcat8 has the correct JAVA\_HOME set. - -1. Download the latest war file: - - wget https://github.com/Libresonic/libresonic/releases/download/v6.2/libresonic-v6.2.war -O /var/lib/tomcat8/webapps/libresonic.war - - Note that this command copies the war file directly to the Tomcat webapps directory, and renames it to `libresonic.war`. - -2. Create the libresonic directory and assign ownership to the Tomcat system user (if running tomcat as a service): - - mkdir /var/libresonic - chown tomcat8:tomcat8 /var/libresonic/ - -3. Start Tomcat, or restart it if running as a service, as in the example below using Systemd: - - systemctl restart tomcat8.service - - Note that it may take ~30 seconds after the service restarts for Tomcat to fully deploy the app. You can monitor /var/log/tomcat8/catalina.out for the following message: - - INFO: Deployment of web application archive /var/lib/tomcat8/webapps/libresonic.war has finished in 46,192 ms - -4. In your web browser, navigate to `http://IP_ADDRESS:8080/libresonic/`, replacing `IP_ADDRESS` with your server's IP address, or `127.0.0.1` if installing locally. - -### SpringBoot Alternative to Tomcat - -If you'd prefer not to use a Tomcat container, you can also run Libresonic as a standalone application. -Note that, in that case, libresonic will available at `http://IP_ADDRESS:8080` (and not `IP_ADDRESS:8080/libresonic/`). - -Download the Libresonic Pre-Compiled Package as explained above and put it -anywhere. Then create the libresonic directory. You may have to change the -permissions on the folder to align with the user you will run libresonic as. - -``` -mkdir /var/libresonic/ -``` - -Now you can simply run java against the libresonic.war package using a command like: - -``` -java -jar libresonic.war -``` - -## Installing From Source - -### Prerequisites - -In order to build, install, and run Libresonic, you will need: - - * A recent version of [Maven](http://maven.apache.org/). - * A JDK installation. 1.8.x series of OpenJDK or Oracle JDK 8+ should work. - * A running [Tomcat](http://tomcat.apache.org/) server. If you're unfamiliar with Tomcat, there are many [guides](https://www.linode.com/docs/websites/frameworks/apache-tomcat-on-ubuntu-16-04) on it. - -On a Debian-based system, you can install all these prerequisites at once with: - - apt-get update; apt-get install tomcat8 openjdk-7-jdk maven - -### Test Your System - -1. Confirm your Maven installation: - - which mvn - -2. Confirm that the $JAVA_HOME environment variable is set: - - echo $JAVA_HOME - -3. If Java is installed, but the `JAVA_HOME` variable not set, be sure to [set it](http://www.cyberciti.biz/faq/linux-unix-set-java_home-path-variable/) before you continue. - - -### Download and Build Libresonic - -1. Clone the Libresonic repo: - - git clone git://github.com/Libresonic/libresonic.git - cd libresonic - - If you don't have a GitHub account, use https://github.com/Libresonic/libresonic.git instead. - -2. At the time of this writing, we reccomend building from the development branch, as Libresonic has not had a stable release since being forked. - - git checkout develop - -3. Using Maven, build Libresonic: - - mvn clean package - -4. You should know have a war file: - - ls libresonic-main/target/libresonic.war - libresonic-main/target/libresonic.war - -5. Copy the war file to the Tomcat webapps directory: - - cp libresonic-main/target/libresonic.war /var/lib/tomcat8/webapps - -6. Create the libresonic directory and assign ownership to the Tomcat system user (if running tomcat as a service): - - mkdir /var/libresonic - chown tomcat8:tomcat8 /var/libresonic/ - -7. Start Tomcat, or restart it if running as a service, as in the example below using Systemd: - - systemctl restart tomcat8.service - - Note that it may take ~30 seconds after the service restarts for Tomcat to fully deploy the app. You can monitor /var/log/tomcat8/catalina.out for the following message: - - INFO: Deployment of web application archive /var/lib/tomcat8/webapps/libresonic.war has finished in 46,192 ms - -8. In your web browser, navigate to `192.0.2.10:8080/libresonic/`, replacing `192.0.2.0` with your server's IP address, or `127.0.0.1` if installing locally. diff --git a/documentation/MIGRATE.md b/documentation/MIGRATE.md deleted file mode 100644 index 3f1e2990..00000000 --- a/documentation/MIGRATE.md +++ /dev/null @@ -1,36 +0,0 @@ -Upgrade to Libresonic from Subsonic -================ - -This guide helps you to migrate your data from Subsonic to Libresonic. It has been tested with Subsonic 5 to Libresonic 6. - -Install Libresonic as described in INSTALL.md. The author of this guide used the standalone solution without Java Tomcat. - -After installation of Libresonic, the database needs to be migrated. In preperation for that, stop the Libresonic service - - sudo service libresonic stop - -If you ran Subsonic before, your data will be (by default) stored in `/var/subsonic`. Assuming you did not use Libresonic before, we will delete all data from Libresonic - - sudo rm -r /var/libresonic # WARNING: DELETES all Libresonic data (Subsonic data will be kept) - -We then copy Subsonic data to Libresonic location. Be aware that a couple of files need to be renamed: - - sudo cp -a /var/subsonic /var/libresonic - sudo mv /var/libresonic/subsonic_sh.log libresonic_sh.log - sudo mv /var/libresonic/subsonic.log libresonic.log - sudo mv /var/libresonic/subsonic.properties libresonic.properties - sudo mv /var/libresonic/db/subsonic.backup /var/libresonic/db/libresonic.backup - sudo mv /var/libresonic/db/subsonic.data /var/libresonic/db/libresonic.data - sudo mv /var/libresonic/db/subsonic.lck /var/libresonic/db/libresonic.lck - sudo mv /var/libresonic/db/subsonic.log /var/libresonic/db/libresonic.log - sudo mv /var/libresonic/db/subsonic.properties /var/libresonic/db/libresonic.properties - sudo mv /var/libresonic/db/subsonic.script /var/libresonic/db/libresonic.script - -Then start Libresonic service again. - - sudo service libresonic start - -Your old settings will be there. If you wish, you can delete subsonic data - - sudo rm -r /var/subsonic # Optional, THIS WILL DELETE SUBSONIC DATA - diff --git a/documentation/PROXY.md b/documentation/PROXY.md deleted file mode 100644 index 8ff6d5a6..00000000 --- a/documentation/PROXY.md +++ /dev/null @@ -1,153 +0,0 @@ -# Setting up a reverse proxy - -A reverse proxy is a public-facing web server sitting in front of an internal -server such as Libresonic. The Libresonic server never communicates with the -outside ; instead, the reverse proxy handles all HTTP(S) requests and forwards -them to Libresonic. - -This is useful in many ways, such as gathering all web configuration in the -same place. It also handles some options (HTTPS) much better than the bundled -Libresonic server or a servlet container such as Tomcat. - -This guide assumes you already have a working Libresonic installation after -following the [installation guide](documentation/INSTALL.md). - -## Getting a TLS certificate - -This guide assumes you already have a TLS certificate. [Let's -Encrypt](https://letsencrypt.org) currently provides such certificates for -free. - -## Libresonic configuration - -A few settings should be tweaked via Spring Boot or Tomcat -configuration: - - - Set the context path to `/libresonic` - - Set the correct address to listen to - - Set the correct port to listen to - -#### Spring Boot - -Add the following java args: - -```java -Dserver.port=4040 -Dserver.address=127.0.0.1 -Dserver.contextPath=/libresonic -jar libresonic.war``` - -#### Tomcat -Modify your `` with the proper address and port: - -``` - - ServerName example.com - ErrorDocument 404 /404.html - DocumentRoot /var/www - ProxyPass /libresonic http://localhost:4040/libresonic - ProxyPassReverse /libresonic http://localhost:4040/libresonic - -``` - -### HAProxy - -The following configuration works for HAProxy (HTTP and HTTPS): - -```haproxy - -defaults - - # Use HTTP protocole - mode http - -frontend https - - # Listen on the HTTPS and HTTP ports - bind :80 - bind :443 ssl crt /etc/haproxy/certs/cert_key.pem - - # Add X-Headers necessary for HTTPS; include :[port] if not running on port 443 - http-request set-header X-Forwarded-Host %[req.hdr(Host)] - http-request set-header X-Forwarded-Proto https - - # (OPTIONAL) Force HTTPS - redirect scheme https if !{ ssl_fc } - - # Bind URL with the right backend - acl is_libresonic path_beg -i /libresonic - use_backend libresonic-backend if is_libresonic - -backend libresonic-backend - - # Rewrite all redirects to use HTTPS, similar to what Nginx does in the - # proxy_redirect directive. - http-response replace-value Location ^http://(.*)$ https://\1 - - # Forward requests to Libresonic running on localhost on port 4040 - server libresonic 127.0.0.1:4040 check -``` diff --git a/documentation/TRANSCODE.md b/documentation/TRANSCODE.md deleted file mode 100644 index ffa188a9..00000000 --- a/documentation/TRANSCODE.md +++ /dev/null @@ -1,47 +0,0 @@ -# Setting up Transcoding Binaries - -## About Transcoding -Transcoders are used by Libresonic to convert media from their on disk format -to a format that can be consumed by clients. This is done not only for compatibility -but also to save bandwidth when dealing with heavier file types. For example, although your -library might use the flac format, bandwidth can be saved by converting to mp3 before -transmission. - -## Bare Minimum setup (Linux) - -*Commands provided below are illustrative* - -Install ffmpeg using your distributions package manager. - -``` -sudo yum install ffmpeg -``` - -In the case that ffmpeg is not available, you have two options. -- Add a repository that provides ffmpeg -- Build the binary from source - - Outdated documentation for this can be found at [TRANSCODE.TXT](developer/TRANSCODE.TXT) - -Create a `transcode` directory within your `libresonic.home` directory: - -``` -mkdir /var/libresonic/transcode -``` - -Ensure it has the correct permissions: - -``` --bash-4.2$ ls -alhd transcode/ -drwxr-xr-x. 2 tomcat tomcat 41 Jan 7 13:45 transcode/ -``` - -Within the `transcode` directory symlink to ffmpeg and verify correct permissions -``` --bash-4.2$ cd transcode/ --bash-4.2$ ln -s /usr/bin/ffmpeg --bash-4.2$ ls -alh -total 4.0K -drwxr-xr-x. 2 tomcat tomcat 41 Jan 7 13:45 . -drwxr--r--. 7 tomcat tomcat 4.0K Feb 23 19:23 .. -lrwxrwxrwx. 1 tomcat tomcat 15 Jan 7 13:45 ffmpeg -> /usr/bin/ffmpeg -``` diff --git a/documentation/contrib/Libresonic.Tomcat.HTTPS.Freebsd.pdf b/documentation/contrib/Libresonic.Tomcat.HTTPS.Freebsd.pdf deleted file mode 100644 index 06e93de8..00000000 Binary files a/documentation/contrib/Libresonic.Tomcat.HTTPS.Freebsd.pdf and /dev/null differ diff --git a/documentation/developer/Performance-Metrics.md b/documentation/developer/Performance-Metrics.md deleted file mode 100644 index eca7bdb3..00000000 --- a/documentation/developer/Performance-Metrics.md +++ /dev/null @@ -1,18 +0,0 @@ - -The Libresonic framework contains a convenient class (called MetricsManager) to add inner metrics that constructs in real time some performance indicators. - -The use of MetricsManager is illustrated in the org.libresonic.player.filter.MetricsFilter class. - -The MetricsFilter adds a metric based on the time spent by each /main.view HTTP request. This is interesting as the main.view request is invoqued when something is displayed in the main Libresonic web frame. - -By default, the MetricsManager is deactivated; it does nothing. -It can be activated only by adding the following line inside the livresonic.properties configuration file : - -``` -Metrics= -``` - -Once the MetricsManager as been activated this way, each metric can be inspected using a jmx console like VisualVM. -Each metric is registered as a MBean as shown below. - -![](metrics-visualvm-screenshot.png) \ No newline at end of file diff --git a/documentation/developer/Performance-jmeter.md b/documentation/developer/Performance-jmeter.md deleted file mode 100644 index 2be23e1f..00000000 --- a/documentation/developer/Performance-jmeter.md +++ /dev/null @@ -1,26 +0,0 @@ -#Performance test using Apache JMeter - -This document explains how to run performance tests on Libresonic using [Apache JMeter](http://jmeter.apache.org/). -The installation and setup of JMeter is not documented bellow; please refer to the JMeter web site. - -##Main test plan -The Libresonic sources come with a main performance test case defined in file libresonic-main/src/test/resources/jmeter/libresonicMainTestPlan.jmx. -This is a JMeter test plan file. - -This test plan simulates a single user that picks up a random album id (xxx) every 5 second and run the main.view?id=xxx http request. - -To run the test plan, open the libresonicMainTestPlan.jmx file in JMeter. -Run Libresonic. Note that the default configuration of this test plan expects Libresonic to be reached at the http://localhost:8080 URL. -Then run the test plan in JMeter. -After a while, you'll obtain a beautiful graph like this - -![](jmeter-main-test-plan.png) - -If you want to run the test with more than one user, just change the _Number of Threads_ property in the main _Thread Group_ configuration. - -If you want to change the delay between each request, change the value in the _Wait next request Timer_ _Constant Timer_ definition. - - - - - diff --git a/documentation/developer/TRANSCODE.TXT b/documentation/developer/TRANSCODE.TXT deleted file mode 100644 index a3be63f3..00000000 --- a/documentation/developer/TRANSCODE.TXT +++ /dev/null @@ -1,72 +0,0 @@ -Upgrade ffmpeg - http://ffmpegmac.net/ - http://www.activeobjects.no/libresonic/forum/viewtopic.php?t=5466&highlight= - FFmpeg now accesses x264 presets via libx264. This extends functionality by introducing several new libx264 options including -preset, -tune, and -profile. You can read more detailed information about these options with "x264 --fullhelp". - The syntax has changed so be sure to update your commands. Example: - ffmpeg -i input -vcodec libx264 -preset fast -tune film -profile main -crf 22 -threads 0 output - Use baseline profile - ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -vcodec libx264 -preset fast -threads 0 - - - http://mewiki.project357.com/wiki/X264_Settings - One-step audio encoding without lame - More compact transcoding format. - Create new transcoding packs. - Downsampling using only ffmpeg? - Test h264 with Android. - Create universal binary for mac. - Update all installers. - -HOW TO BUILD FFMPEG (Ubuntu 11.04) ----------------------------------- -http://ubuntuforums.org/showthread.php?t=786095 - -sudo apt-get remove ffmpeg x264 libx264-dev -sudo apt-get update -sudo apt-get install build-essential checkinstall git libfaac-dev libjack-jackd2-dev \ - libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev \ - libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev texi2html \ - yasm zlib1g-dev - -cd -cd projects -git clone git://git.videolan.org/x264 -cd x264 -./configure --enable-static -make -sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes --fstrans=no --default - -cd -cd projects -sudo apt-get remove libvpx-dev -git clone git://review.webmproject.org/libvpx -cd libvpx -./configure -make -sudo checkinstall --pkgname=libvpx --pkgversion="1:$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default - -cd -cd projects -git clone git://git.videolan.org/ffmpeg -cd ffmpeg -./configure --disable-ffplay --disable-ffprobe --disable-ffserver --enable-gpl --enable-nonfree --enable-postproc \ - --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libvpx --enable-libtheora --enable-libvorbis \ - --enable-libx264 --enable-libxvid --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb \ - --enable-libvpx --enable-version3 --enable-bzlib \ - --enable-static --disable-shared --extra-libs=-static --extra-cflags=--static -make -sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default -hash x264 ffmpeg - - -HOW TO BUILD LAME (Ubuntu 11.04) ----------------------------------- -cd -cd projects -sudo apt-get install nasm -wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz -tar xzvf lame-3.98.4.tar.gz -cd lame-3.98.4 -./configure --enable-nasm --disable-shared -make - - diff --git a/documentation/developer/jmeter-main-test-plan.png b/documentation/developer/jmeter-main-test-plan.png deleted file mode 100644 index 0a92e7c8..00000000 Binary files a/documentation/developer/jmeter-main-test-plan.png and /dev/null differ diff --git a/documentation/developer/metrics-visualvm-screenshot.png b/documentation/developer/metrics-visualvm-screenshot.png deleted file mode 100644 index 7da35438..00000000 Binary files a/documentation/developer/metrics-visualvm-screenshot.png and /dev/null differ diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/M3UController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/M3UController.java index ebce4af3..eeb697a4 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/M3UController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/M3UController.java @@ -22,9 +22,9 @@ package org.libresonic.player.controller; import org.libresonic.player.domain.MediaFile; import org.libresonic.player.domain.PlayQueue; import org.libresonic.player.domain.Player; +import org.libresonic.player.service.JWTSecurityService; import org.libresonic.player.service.NetworkService; import org.libresonic.player.service.PlayerService; -import org.libresonic.player.service.SettingsService; import org.libresonic.player.service.TranscodingService; import org.libresonic.player.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -32,6 +32,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.util.UriComponentsBuilder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -52,9 +53,9 @@ public class M3UController { @Autowired private PlayerService playerService; @Autowired - private SettingsService settingsService; - @Autowired private TranscodingService transcodingService; + @Autowired + private JWTSecurityService jwtSecurityService; @RequestMapping(method = RequestMethod.GET) public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { @@ -89,7 +90,12 @@ public class M3UController { duration = -1; } out.println("#EXTINF:" + duration + "," + mediaFile.getArtist() + " - " + mediaFile.getTitle()); - out.println(url + "player=" + player.getId() + "&id=" + mediaFile.getId() + "&suffix=." + transcodingService.getSuffix(player, mediaFile, null)); + + String urlNoAuth = url + "player=" + player.getId() + "&id=" + mediaFile.getId() + "&suffix=." + + transcodingService.getSuffix(player, mediaFile, null); + String urlWithAuth = jwtSecurityService.addJWTToken(UriComponentsBuilder.fromUriString(urlNoAuth)).build().toUriString(); + out.println(urlWithAuth); + out.println(); } } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/RatingDao.java b/libresonic-main/src/main/java/org/libresonic/player/dao/RatingDao.java index d8f5d225..aa050967 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/RatingDao.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/RatingDao.java @@ -59,7 +59,7 @@ public class RatingDao extends AbstractDao { String sql = "select user_rating.path from user_rating, media_file " + "where user_rating.path=media_file.path and media_file.present and media_file.type = :type and media_file.folder in (:folders) " + - "group by path " + + "group by user_rating.path " + "order by avg(rating) desc limit :count offset :offset"; return namedQueryForStrings(sql, args); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/security/GlobalSecurityConfig.java b/libresonic-main/src/main/java/org/libresonic/player/security/GlobalSecurityConfig.java index 4af3aae0..9302edcf 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/security/GlobalSecurityConfig.java +++ b/libresonic-main/src/main/java/org/libresonic/player/security/GlobalSecurityConfig.java @@ -94,7 +94,7 @@ public class GlobalSecurityConfig extends GlobalAuthenticationConfigurerAdapter .csrf().requireCsrfProtectionMatcher(csrfSecurityRequestMatcher).and() .headers().frameOptions().sameOrigin().and() .authorizeRequests() - .antMatchers("/ext/stream/**", "/ext/coverArt.view", "/ext/share/**", "/ext/hls/**") + .antMatchers("/ext/stream/**", "/ext/coverArt*", "/ext/share/**", "/ext/hls/**") .hasAnyRole("TEMP", "USER").and() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() .exceptionHandling().and() @@ -125,29 +125,29 @@ public class GlobalSecurityConfig extends GlobalAuthenticationConfigurerAdapter .frameOptions() .sameOrigin() .and().authorizeRequests() - .antMatchers("/recover.view", "/accessDenied.view", + .antMatchers("/recover*", "/accessDenied*", "/style/**", "/icons/**", "/flash/**", "/script/**", "/sonos/**", "/crossdomain.xml", "/login", "/error") .permitAll() - .antMatchers("/personalSettings.view", "/passwordSettings.view", - "/playerSettings.view", "/shareSettings.view", "/passwordSettings.view") + .antMatchers("/personalSettings*", "/passwordSettings*", + "/playerSettings*", "/shareSettings*", "/passwordSettings*") .hasRole("SETTINGS") - .antMatchers("/generalSettings.view", "/advancedSettings.view", "/userSettings.view", - "/musicFolderSettings.view", "/databaseSettings.view") + .antMatchers("/generalSettings*", "/advancedSettings*", "/userSettings*", + "/musicFolderSettings*", "/databaseSettings*") .hasRole("ADMIN") - .antMatchers("/deletePlaylist.view", "/savePlaylist.view") + .antMatchers("/deletePlaylist*", "/savePlaylist*", "/db*") .hasRole("PLAYLIST") - .antMatchers("/download.view") + .antMatchers("/download*") .hasRole("DOWNLOAD") - .antMatchers("/upload.view") + .antMatchers("/upload*") .hasRole("UPLOAD") - .antMatchers("/createShare.view") + .antMatchers("/createShare*") .hasRole("SHARE") - .antMatchers("/changeCoverArt.view", "/editTags.view") + .antMatchers("/changeCoverArt*", "/editTags*") .hasRole("COVERART") - .antMatchers("/setMusicFileInfo.view") + .antMatchers("/setMusicFileInfo*") .hasRole("COMMENT") - .antMatchers("/podcastReceiverAdmin.view") + .antMatchers("/podcastReceiverAdmin*") .hasRole("PODCAST") .antMatchers("/**") .hasRole("USER") @@ -155,7 +155,7 @@ public class GlobalSecurityConfig extends GlobalAuthenticationConfigurerAdapter .and().formLogin() .loginPage("/login") .permitAll() - .defaultSuccessUrl("/index.view", true) + .defaultSuccessUrl("/index", true) .failureUrl(FAILURE_URL) .usernameParameter("j_username") .passwordParameter("j_password") diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/NetworkService.java b/libresonic-main/src/main/java/org/libresonic/player/service/NetworkService.java index adf190b2..8f44b513 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/NetworkService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/NetworkService.java @@ -61,8 +61,21 @@ public class NetworkService { private static URI calculateProxyUri(HttpServletRequest request) throws URISyntaxException { String xForardedHost = request.getHeader(X_FORWARDED_HOST); + // If the request has been through multiple reverse proxies, + // We need to return the original Host that the client used + if (xForardedHost != null) { + xForardedHost = xForardedHost.split(",")[0]; + } + if(!isValidXForwardedHost(xForardedHost)) { xForardedHost = request.getHeader(X_FORWARDED_SERVER); + + // If the request has been through multiple reverse proxies, + // We need to return the original Host that the client used + if (xForardedHost != null) { + xForardedHost = xForardedHost.split(",")[0]; + } + if(!isValidXForwardedHost(xForardedHost)) { throw new RuntimeException("Cannot calculate proxy uri without HTTP header " + X_FORWARDED_HOST); } @@ -72,6 +85,9 @@ public class NetworkService { String host = proxyHost.getHost(); int port = proxyHost.getPort(); String scheme = request.getHeader(X_FORWARDED_PROTO); + if(StringUtils.isBlank(scheme)) { + throw new RuntimeException("Scheme not provided"); + } return new URI(scheme, null, host, port, urlPathHelper.getContextPath(request), null, null); } diff --git a/libresonic-main/src/main/resources/liquibase/legacy/schema52.xml b/libresonic-main/src/main/resources/liquibase/legacy/schema52.xml index 16656d75..d472107d 100644 --- a/libresonic-main/src/main/resources/liquibase/legacy/schema52.xml +++ b/libresonic-main/src/main/resources/liquibase/legacy/schema52.xml @@ -17,6 +17,7 @@ 7:8fde86035edbca443a54b1861ae70819 + 7:e7e0f04cd4691ec2b5d955b449e0154b diff --git a/libresonic-main/src/main/resources/org/libresonic/player/i18n/ResourceBundle_de.properties b/libresonic-main/src/main/resources/org/libresonic/player/i18n/ResourceBundle_de.properties index 10a8eabb..2873693f 100644 --- a/libresonic-main/src/main/resources/org/libresonic/player/i18n/ResourceBundle_de.properties +++ b/libresonic-main/src/main/resources/org/libresonic/player/i18n/ResourceBundle_de.properties @@ -317,6 +317,7 @@ advancedsettings.ldapsearchfilter = LDAP Suchfilter advancedsettings.ldapmanagerdn = LDAP Manager DN
(Optional)
advancedsettings.ldapmanagerpassword = Passwort advancedsettings.ldapautoshadowing = Automatische Erstellung von Benutzern in {0} +advancedsettings.ldapRequiresRestart = \u00C4nderungen an den LDAP Einstellungen erfordern einen Neustart # personalSettings.jsp personalsettings.title = Layout Einstellungen f\u00FCr {0} @@ -409,7 +410,7 @@ transcodingsettings.info =

(%s = Die Datei die transcodiert wi Festplattenspeicher.

\

Das Transcoding wird von Drittanbieter-Kommandozeilenprogrammen \u00FCbernommen, welche in {0} installiert sein m\u00FCssen. \ Mehr \u00FCber das Transcoding erf\u00E4hrst du \ - hier hier. Du kannst deinen eigenen Transcoder verwenden, wenn er \ + hier hier. Du kannst deinen eigenen Transcoder verwenden, wenn er \ folgende Funktionen erf\u00FCllt: \

    \
  • Er muss ein Kommandozeilen-Interface haben.
  • \ @@ -636,7 +637,7 @@ podcastreceiver.status.deleted = Gel\u00F6scht podcastreceiver.status.skipped = Abgebrochen podcastreceiver.downloadselected= Ausgew\u00E4hlte downloaden podcastreceiver.deleteselected= L\u00F6sche ausgew\u00E4hlte -podcastreceiver.confirmdelete= Ausgew\u00C4hlte Podcasts wirklich l\u00F6schen? +podcastreceiver.confirmdelete= Ausgew\u00E4hlte Podcasts wirklich l\u00F6schen? podcastreceiver.check = Suche nach neuen Episoden podcastreceiver.refresh = Seite neu laden podcastreceiver.settings = Podcast Einstellungen