Skip to content

Instantly share code, notes, and snippets.

@Rovanion
Created September 22, 2012 19:58

Revisions

  1. Rovanion created this gist Sep 22, 2012.
    55 changes: 55 additions & 0 deletions noLicense.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,55 @@
    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() {