forked from Qortal/qortal
Browse Source
SysTray pop-up menu now includes entry for launching https://time.is so node owners can check their system clocks against internet time. Windows installs also have additional systray menu entry which runs ntpcfg.bat script, included in resources. Also available as download via node-UI servlet, e.g. http://localhost:9880/downloads/ntpcfg.bat ntpcfg.bat reconfigures Windows Time Service with many NTP servers, restarts the service, and also makes sure it auto-starts on boot. Added DEBUG-level logging when rejecting nodes due to excessive time difference (during PROOF handshake stage). Bumped default settings values for minOutboundPeers from 10 to 20. Bumped default settings values for maxPeers from 30 to 50.split-DB
catbref
5 years ago
8 changed files with 186 additions and 12 deletions
@ -0,0 +1,46 @@
|
||||
package org.qora.ui; |
||||
|
||||
import java.io.IOException; |
||||
import java.util.Enumeration; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
import org.eclipse.jetty.http.HttpContent; |
||||
import org.eclipse.jetty.http.HttpHeader; |
||||
import org.eclipse.jetty.server.ResourceService; |
||||
import org.eclipse.jetty.util.URIUtil; |
||||
|
||||
/** |
||||
* Replace ResourceService that delivers content as "attachments", typically forcing download instead of rendering. |
||||
* <p> |
||||
* Sets <tt>Content-Type</tt> header to <tt>application/octet-stream</tt><br> |
||||
* Sets <tt>Content-Disposition</tt> header to <tt>attachment; filename="<i>basename</i>"</tt><br> |
||||
* where <i>basename</i> is that last component of requested URI path. |
||||
* <p> |
||||
* Example usage:<br> |
||||
* <br> |
||||
* <tt>... = new ServletHolder("servlet-name", new DefaultServlet(new DownloadResourceService()));</tt> |
||||
*/ |
||||
public class DownloadResourceService extends ResourceService { |
||||
|
||||
@Override |
||||
protected boolean sendData(HttpServletRequest request, HttpServletResponse response, boolean include, final HttpContent content, Enumeration<String> reqRanges) throws IOException { |
||||
final boolean _pathInfoOnly = super.isPathInfoOnly(); |
||||
String servletPath = _pathInfoOnly ? "/" : request.getServletPath(); |
||||
String pathInfo = request.getPathInfo(); |
||||
String pathInContext = URIUtil.addPaths(servletPath,pathInfo); |
||||
|
||||
// Find basename of requested content
|
||||
final int slashIndex = pathInContext.lastIndexOf(URIUtil.SLASH); |
||||
if (slashIndex != -1) |
||||
pathInContext = pathInContext.substring(slashIndex + 1); |
||||
|
||||
// Add appropriate headers
|
||||
response.setHeader(HttpHeader.CONTENT_TYPE.asString(), "application/octet-stream"); |
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + pathInContext + "\""); |
||||
|
||||
return super.sendData(request, response, include, content, reqRanges); |
||||
} |
||||
|
||||
} |
@ -1,7 +1,15 @@
|
||||
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/) |
||||
# SysTray pop-up menu |
||||
OPEN_NODE_UI=Open Node UI |
||||
|
||||
CHECK_TIME_ACCURACY = Check time accuracy |
||||
|
||||
EXIT = Exit |
||||
|
||||
# Nagging about lack of NTP time sync |
||||
NTP_NAG_CAPTION = No connections? |
||||
|
||||
NTP_NAG_TEXT = Please enable Windows automatic time synchronization |
||||
|
||||
OPEN_NODE_UI = Open Node UI |
||||
|
||||
SYNCHRONIZE_CLOCK = Synchronize clock |
||||
|
@ -1,7 +1,15 @@
|
||||
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/) |
||||
# SysTray pop-up menu |
||||
OPEN_NODE_UI=\u5F00\u542F\u754C\u9762 |
||||
|
||||
CHECK_TIME_ACCURACY = \u68C0\u67E5\u65F6\u95F4\u51C6\u786E\u6027 |
||||
|
||||
EXIT = \u9000\u51FA\u8F6F\u4EF6 |
||||
|
||||
# Nagging about lack of NTP time sync |
||||
NTP_NAG_CAPTION = \u6CA1\u6709\u8FDE\u63A5\u4E0A\u8282\u70B9\uFF1F |
||||
|
||||
NTP_NAG_TEXT = \u8BF7\u542F\u7528Windows\u81EA\u52A8\u65F6\u95F4\u540C\u6B65\u3002 |
||||
|
||||
OPEN_NODE_UI = \u5F00\u542F\u754C\u9762 |
||||
|
||||
SYNCHRONIZE_CLOCK = \u540C\u6B65\u65F6\u949F |
||||
|
@ -0,0 +1,33 @@
|
||||
@echo off |
||||
|
||||
:: BatchGotAdmin |
||||
:------------------------------------- |
||||
REM --> Check for permissions |
||||
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" |
||||
|
||||
REM --> If error flag set, we do not have admin. |
||||
if '%errorlevel%' NEQ '0' ( |
||||
echo Requesting administrative privileges... |
||||
goto UACPrompt |
||||
) else ( goto gotAdmin ) |
||||
|
||||
:UACPrompt |
||||
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" |
||||
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" |
||||
|
||||
"%temp%\getadmin.vbs" |
||||
exit /B |
||||
|
||||
:gotAdmin |
||||
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" ) |
||||
pushd "%CD%" |
||||
CD /D "%~dp0" |
||||
:-------------------------------------- |
||||
|
||||
net stop "Windows Time" |
||||
|
||||
w32tm /config "/manualpeerlist:pool.ntp.org 0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org cn.pool.ntp.org 0.cn.pool.ntp.org 1.cn.pool.ntp.org 2.cn.pool.ntp.org 3.cn.pool.ntp.org" |
||||
|
||||
net start "Windows Time" |
||||
|
||||
sc config w32time start= auto |
Loading…
Reference in new issue