Skip to content
Permalink
Browse files

Minor changes

  • Loading branch information...
Paco Avila
Paco Avila committed Oct 8, 2019
1 parent 513dc9f commit d3ef78f947564b9740385255c1d954e1f0102084
Showing with 45 additions and 12 deletions.
  1. +17 −0 .editorconfig
  2. +13 −0 src/main/java/com/openkm/util/NetworkUtils.java
  3. +15 −12 src/main/java/com/openkm/util/Update.java
@@ -0,0 +1,17 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.java]
tab_width = 4
indent_style = tab

[*.{js,jsp,xml,html}]
indent_size = 2
indent_style = space
@@ -24,8 +24,21 @@
import org.xbill.DNS.*;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

public class NetworkUtils {
/**
* Get hostname
*/
public static String getHostname() {
try {
return InetAddress.getLocalHost().getCanonicalHostName();
} catch (UnknownHostException e) {
return "unknown";
}
}

public static String reverseDns(String hostIp) throws IOException {
Resolver res = new ExtendedResolver();

@@ -42,21 +42,24 @@ public static String checkVersion() {
try {
URL url = new URL("http://update.openkm.com/");
HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
String hostname = NetworkUtils.getHostname();
AppVersion av = WarUtils.getAppVersion();

// @formatter:off
String content = "okm_uuid=" + URLEncoder.encode(Repository.getUuid(), "UTF-8") +
"&okm_version=" + URLEncoder.encode(av.getVersion(), "UTF-8") +
"&okm_build=" + URLEncoder.encode(av.getBuild(), "UTF-8") +
"&os_name=" + URLEncoder.encode(System.getProperty("os.name"), "UTF-8") +
"&os_version=" + URLEncoder.encode(System.getProperty("os.version"), "UTF-8") +
"&java_vendor=" + URLEncoder.encode(System.getProperty("java.vm.vendor"), "UTF-8") +
"&java_version=" + URLEncoder.encode(System.getProperty("java.version"), "UTF-8") +
"&hbm_dialect=" + URLEncoder.encode(Config.HIBERNATE_DIALECT, "UTF-8") +
"&doc_num=" + RepositoryInfo.getDocumentsByContext().getTotal() +
"&fld_num=" + RepositoryInfo.getFoldersByContext().getTotal() +
"&mail_num=" + RepositoryInfo.getMailsByContext().getTotal() +
"&doc_size=" + RepositoryInfo.getDocumentsSizeByContext().getTotal() +
"&user_num=" + CommonAuthModule.getPrincipalAdapter().getUsers().size();
"&okm_version=" + URLEncoder.encode(av.getVersion(), "UTF-8") +
"&okm_build=" + URLEncoder.encode(av.getBuild(), "UTF-8") +
"&srv_name=" + URLEncoder.encode(hostname, "UTF-8") +
"&os_name=" + URLEncoder.encode(System.getProperty("os.name"), "UTF-8") +
"&os_version=" + URLEncoder.encode(System.getProperty("os.version"), "UTF-8") +
"&java_vendor=" + URLEncoder.encode(System.getProperty("java.vm.vendor"), "UTF-8") +
"&java_version=" + URLEncoder.encode(System.getProperty("java.version"), "UTF-8") +
"&hbm_dialect=" + URLEncoder.encode(Config.HIBERNATE_DIALECT, "UTF-8") +
"&doc_num=" + RepositoryInfo.getDocumentsByContext().getTotal() +
"&fld_num=" + RepositoryInfo.getFoldersByContext().getTotal() +
"&mail_num=" + RepositoryInfo.getMailsByContext().getTotal() +
"&doc_size=" + RepositoryInfo.getDocumentsSizeByContext().getTotal() +
"&user_num=" + CommonAuthModule.getPrincipalAdapter().getUsers().size();
// @formatter:on

urlConn.setDoInput(true);

0 comments on commit d3ef78f

Please sign in to comment.
You can’t perform that action at this time.