Skip to content

Instantly share code, notes, and snippets.

@ProjectMoon
Last active January 6, 2023 17:31
Show Gist options
  • Star 25 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • 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() {
@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