-
-
Save Rovanion/3767624 to your computer and use it in GitHub Desktop.
| diff --git a/subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java b/subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java | |
| index f7031bf..39ee5b4 100644 | |
| --- a/subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java | |
| +++ b/subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java | |
| @@ -620,14 +620,11 @@ public class SettingsService { | |
| } | |
| public boolean isLicenseValid() { | |
| - return isLicenseValid(getLicenseEmail(), getLicenseCode()) && licenseValidated; | |
| + return true; | |
| } | |
| public boolean isLicenseValid(String email, String license) { | |
| - if (email == null || license == null) { | |
| - return false; | |
| - } | |
| - return license.equalsIgnoreCase(StringUtil.md5Hex(email.toLowerCase())); | |
| + return true; | |
| } | |
| public String getDownsamplingCommand() { | |
| @@ -1223,33 +1220,7 @@ public class SettingsService { | |
| } | |
| private void validateLicense() { | |
| - String email = getLicenseEmail(); | |
| - Date date = getLicenseDate(); | |
| - | |
| - if (email == null || date == null) { | |
| - licenseValidated = false; | |
| - return; | |
| - } | |
| - | |
| licenseValidated = true; | |
| - | |
| - HttpClient client = new DefaultHttpClient(); | |
| - HttpConnectionParams.setConnectionTimeout(client.getParams(), 120000); | |
| - HttpConnectionParams.setSoTimeout(client.getParams(), 120000); | |
| - HttpGet method = new HttpGet("http://subsonic.org/backend/validateLicense.view" + "?email=" + StringUtil.urlEncode(email) + | |
| - "&date=" + date.getTime() + "&version=" + versionService.getLocalVersion()); | |
| - try { | |
| - ResponseHandler<String> responseHandler = new BasicResponseHandler(); | |
| - String content = client.execute(method, responseHandler); | |
| - licenseValidated = content != null && content.contains("true"); | |
| - if (!licenseValidated) { | |
| - LOG.warn("License key is not valid."); | |
| - } | |
| - } catch (Throwable x) { | |
| - LOG.warn("Failed to validate license.", x); | |
| - } finally { | |
| - client.getConnectionManager().shutdown(); | |
| - } | |
| } | |
| public void validateLicenseAsync() { |
This works if you can be assed into patching it yourself, if not, just add a
127.0.0.1 subsonic.org
line to /etc/hosts
and then make a file on your local webserver (for the subsonic.org vhost if you're using them) called /backend/validateLicense.view with the content of 'true'.
Then activate it with a key of md5hex(email).
This way you can use the subsonic.org provided binaries.
Or you could be a nice person and donate.
Thanks for this ultramancool. I had donated but my license would not apply correctly, I couldn't wait for a response from the devs/forums so I implemented your solution in a slightly modified way.
In my case, Subsonic is hosted on a Windows Server which has IIS running on port 80 (hosting another app), this means subsonic needs to run on a different port (I used the default 4040). Subsonic expects the /backend/validateLicense.view file to be on a server on port 80. So, when creating your solution, it is necessary to modify the following:
- hosts file (127.0.0.1 subsonic.org) as you had done, on Windows, the location is "C:\Windows\System32\Drivers\Etc\hosts"
- In the default folder for IIS which is "C:\inetpub\wwwroot" create the folder called "backend"
- Within this folder, create the plain text file called "licenseValidate.view" and within it, just have the word "true"
- Go into the IIS admin console, drill down the config list on the left to "Default Web Site", click the "Handler Mappings" icon
- Click "Add Managed Handler" link in the right pane, set the Request Path to "*.view", set the type to "System.Web.DefaultHttpHandler" and give it any name you like.
These instructions are written for Windows Server 2012, I believe Server 2008 should be similar if not the same, other Windows servers may differ but I'm sure anyone setting up a Subsonic server can figure it out :)
How do I patch this? Is it possible to patch it without root?
Or you can pull this repo: https://github.com/Rovanion/supersonic/tree/upstream