Skip to content

Instantly share code, notes, and snippets.

@ProjectMoon
Last active January 6, 2023 17:31
Show Gist options
  • Save ProjectMoon/1318300 to your computer and use it in GitHub Desktop.
Save ProjectMoon/1318300 to your computer and use it in GitHub Desktop.
Patch that disables Subsonic license checking and validation

Update 2020 Edition: Use something like Airsonic instead. Subsonic's code is closed source at this point, and thus this patch is useless, unless you are using a 9 year old verison of Subsonic for some reason.


A patch to disable the licensing functionality in Subsonic, a GPL-licensed media streaming server/web interface. Use of the mobile apps requires you to get a license after 30 days of trial. You obtain a license via donation.

Except that's not a donation. So, here's a patch to fix that. Support the Subsonic project with a donation that's actually a donation. The program is developed and maintained very well.

Steps to victory

svn co https://subsonic.svn.sourceforge.net/svnroot/subsonic/trunk subsonic

Check out a different branch if you want a specific version.

From the branch root:

patch -p0 < nolicense.patch
mvn install
cd subsonic-booter/
mvn install

Replace the downloaded subsonic.war and subsonic-booter-with-dependencies.jar with the newly compiled ones. Compilation of subsonic-booter is probably optional. It's just a precaution in case the branch you are compiling is newer than whatever version you downloaded.

Index: subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java
===================================================================
--- subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java (revision 2462)
+++ subsonic-main/src/main/java/net/sourceforge/subsonic/service/SettingsService.java (working copy)
@@ -589,10 +589,7 @@
}
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() {
@@ -1136,31 +1133,7 @@
}
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=" + 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");
- LOG.debug("License validated: " + licenseValidated);
- } catch (Throwable x) {
- LOG.warn("Failed to validate license.", x);
- } finally {
- client.getConnectionManager().shutdown();
- }
}
public void validateLicenseAsync() {
@ProjectMoon
Copy link
Author

Instructions would be the same as they are in this gist, minus the part about applying the patch. You need to install maven and then do mvn install on the root of the repository and in the subsonic-booter subproject.

@ProjectMoon
Copy link
Author

Also, just randomly found this: http://forum.subsonic.org/forum/viewtopic.php?f=3&t=3521&start=15

Edit: Ok, apparently this is another fork. See the GitHub repo here: https://github.com/Mach5/supersonic

That one already has 16 followers.

@EugeneKay
Copy link

I was not aware of that fork, but they appear to be doing quite a bit of rebranding and modification. I'm unsure what effect that will have on the end product, but I happen to like the lil yellow submarine logo. The license on this code is GPL v3, with none of the Section 7 terms being applied, which would restrict said branding. I nevertheless will be making some effort to indicate that this is not a subsonic.org release, on the Downloads page I will be putting up and in the About page in the software.

I will do what I can to get some more formats built & uploaded today - I put up the .war because that's what I use(I have an existing Tomcat6 server).

@oktane
Copy link

oktane commented Aug 30, 2012

so I had no luck with replacing the WAR, nor finding a complete supersonic download, and I do not think that recompiling the thing every time, not to mention setting up the development environment, is an easy thing for most non-dev people. The simplest solution for me was to fool the license check via a hosts DNS redirect to a local (or remote) server that serves up /backend/validateLicense.view, and returns true.

A killer solution would be to integrate this hack into subsonic itself, by placing the file into installdir/jetty/3081/webapp (varies I think) so that it's own server would serve it up, then just applying the dns change via whatever means. (local HOSTS file on server, router, dnsmasq) But I couldn't get that to work, since if a GET is made for a .view file on subsonic's jetty, it does it's java function lookup instead of delivering the file. (lookup fails since there is no backend classes obviously) Does anyone know any jetty voodoo like similar to an apache redirect, which could be installed by simply placing a file in that jetty 'server-root' folder? For now, I just used a different server to host the file, and it validates the license check fine. (success is donation link/heart goes away) But it would be nice if the solution was all in one, more elegant I suppose.

Note that this kills the following (fairly useless) features: remote settings storage, new version alerts, etc.. that DNS redirect will prevent all phoning home.

Cheers, from a person that would donate if they could.

@Rovanion
Copy link

Here's a current diff for upstream version 4.7 of Subsonic: https://gist.github.com/3767624

@aijcoa
Copy link

aijcoa commented Jun 4, 2013

I can't get this to work. I've installed subsonic from source in my home dir ~/subsonic, I make a file in this dir called noLicence.patch and run the commands, but I get "Hunk #1 Failed [...]" errors. How can I fix this?

@EugeneKay
Copy link

In case anybody is still encountering this Gist on Google, please note that there have been recent changes to licensing code which invalidates this patch entirely. My Fork is the only one I'm aware of that is keeping current with upstream Subsonic and does not add bells+whistles.

@denilsonsa
Copy link

Also for anyone also finding this Gist from search engines, consider looking at https://github.com/airsonic/airsonic , which is a fork based on the latest open-source subsonic code.

@ProjectMoon
Copy link
Author

Didn't even realize this was still relevant. In fact, forgot it even existed. I updated the gist again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment