mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-12-20 01:11:03 +08:00
Pull request 2510: AGDNS-2591-web-start-time
Some checks failed
build / test (macOS-latest) (push) Has been cancelled
build / test (ubuntu-latest) (push) Has been cancelled
build / test (windows-latest) (push) Has been cancelled
lint / go-lint (push) Has been cancelled
lint / eslint (push) Has been cancelled
build / build-release (push) Has been cancelled
build / notify (push) Has been cancelled
lint / notify (push) Has been cancelled
Some checks failed
build / test (macOS-latest) (push) Has been cancelled
build / test (ubuntu-latest) (push) Has been cancelled
build / test (windows-latest) (push) Has been cancelled
lint / go-lint (push) Has been cancelled
lint / eslint (push) Has been cancelled
build / build-release (push) Has been cancelled
build / notify (push) Has been cancelled
lint / notify (push) Has been cancelled
Squashed commit of the following: commit 5dfdf2aec4951e0483765f4a66091112ab901781 Merge:c4b2a5652594849b5aAuthor: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Sat Nov 1 15:16:17 2025 +0300 Merge branch 'master' into AGDNS-2591-web-start-time commitc4b2a5652eMerge:a0466dd493bebde610Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Oct 31 15:50:34 2025 +0300 Merge branch 'master' into AGDNS-2591-web-start-time commita0466dd49aAuthor: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Oct 24 09:47:20 2025 +0300 all: imp code commit5e093562bbAuthor: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Oct 23 09:14:32 2025 +0300 all: web start time
This commit is contained in:
@@ -18,6 +18,10 @@ See also the [v0.107.70 GitHub milestone][ms-v0.107.70].
|
||||
NOTE: Add new changes BELOW THIS COMMENT.
|
||||
-->
|
||||
|
||||
### Added
|
||||
|
||||
- New field `"start_time"` in the `GET /control/status` response.
|
||||
|
||||
<!--
|
||||
NOTE: Add new changes ABOVE THIS COMMENT.
|
||||
-->
|
||||
|
||||
@@ -222,7 +222,7 @@ const checkStatus = async (handleRequestSuccess: any, handleRequestError: any, a
|
||||
};
|
||||
|
||||
export const getUpdate = () => async (dispatch: any, getState: any) => {
|
||||
const { dnsVersion } = getState().dashboard;
|
||||
const { dnsVersion, dnsStartTime } = getState().dashboard;
|
||||
|
||||
dispatch(getUpdateRequest());
|
||||
const handleRequestError = () => {
|
||||
@@ -238,8 +238,9 @@ export const getUpdate = () => async (dispatch: any, getState: any) => {
|
||||
|
||||
const handleRequestSuccess = (response: any) => {
|
||||
const responseVersion = response.data?.version;
|
||||
const responseStartTime = response.data?.start_time;
|
||||
|
||||
if (dnsVersion !== responseVersion) {
|
||||
if (dnsVersion !== responseVersion || dnsStartTime !== responseStartTime) {
|
||||
dispatch(getUpdateSuccess());
|
||||
|
||||
window.location.reload();
|
||||
|
||||
@@ -128,6 +128,7 @@ export type DashboardData = {
|
||||
dnsPort: number;
|
||||
dnsAddresses: string[];
|
||||
dnsVersion: string;
|
||||
dnsStartTime: number | null;
|
||||
clients: Client[];
|
||||
autoClients: AutoClient[];
|
||||
supportedTags: string[];
|
||||
@@ -445,6 +446,7 @@ export const initialState: RootState = {
|
||||
dnsPort: STANDARD_DNS_PORT,
|
||||
dnsAddresses: [],
|
||||
dnsVersion: '',
|
||||
dnsStartTime: null,
|
||||
clients: [],
|
||||
autoClients: [],
|
||||
supportedTags: [],
|
||||
|
||||
@@ -21,6 +21,7 @@ const dashboard = handleActions(
|
||||
[actions.dnsStatusSuccess.toString()]: (state: any, { payload }: any) => {
|
||||
const {
|
||||
version,
|
||||
start_time: dnsStartTime,
|
||||
dns_port: dnsPort,
|
||||
dns_addresses: dnsAddresses,
|
||||
protection_enabled: protectionEnabled,
|
||||
@@ -33,6 +34,7 @@ const dashboard = handleActions(
|
||||
isCoreRunning: true,
|
||||
processing: false,
|
||||
dnsVersion: version,
|
||||
dnsStartTime,
|
||||
dnsPort,
|
||||
dnsAddresses,
|
||||
protectionEnabled,
|
||||
@@ -183,6 +185,7 @@ const dashboard = handleActions(
|
||||
dnsPort: STANDARD_DNS_PORT,
|
||||
dnsAddresses: [],
|
||||
dnsVersion: '',
|
||||
dnsStartTime: null,
|
||||
clients: [],
|
||||
autoClients: [],
|
||||
supportedTags: [],
|
||||
|
||||
@@ -107,6 +107,9 @@ type statusResponse struct {
|
||||
// milliseconds.
|
||||
ProtectionDisabledDuration int64 `json:"protection_disabled_duration"`
|
||||
|
||||
// StartTime is the start time of the web API server in Unix milliseconds.
|
||||
StartTime aghhttp.JSONTime `json:"start_time"`
|
||||
|
||||
ProtectionEnabled bool `json:"protection_enabled"`
|
||||
// TODO(e.burkov): Inspect if front-end doesn't requires this field as
|
||||
// openapi.yaml declares.
|
||||
@@ -158,6 +161,7 @@ func (web *webAPI) handleStatus(w http.ResponseWriter, r *http.Request) {
|
||||
DNSPort: config.DNS.Port,
|
||||
HTTPPort: config.HTTPConfig.Address.Port(),
|
||||
ProtectionDisabledDuration: protectionDisabledDuration,
|
||||
StartTime: aghhttp.JSONTime(web.startTime),
|
||||
ProtectionEnabled: protEnabled,
|
||||
IsRunning: isRunning(),
|
||||
}
|
||||
|
||||
@@ -158,6 +158,9 @@ type webAPI struct {
|
||||
// httpsServer is the server that handles HTTPS traffic. If it is not nil,
|
||||
// [Web.http3Server] must also not be nil.
|
||||
httpsServer httpsServer
|
||||
|
||||
// startTime is the start time of the web API server in Unix milliseconds.
|
||||
startTime time.Time
|
||||
}
|
||||
|
||||
// newWebAPI creates a new instance of the web UI and API server. conf must be
|
||||
@@ -176,6 +179,7 @@ func newWebAPI(ctx context.Context, conf *webConfig) (w *webAPI) {
|
||||
baseLogger: conf.baseLogger,
|
||||
tlsManager: conf.tlsManager,
|
||||
auth: conf.auth,
|
||||
startTime: time.Now(),
|
||||
}
|
||||
|
||||
clientFS := http.FileServer(http.FS(conf.clientFS))
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
<!-- TODO(a.garipov): Reformat in accordance with the KeepAChangelog spec. -->
|
||||
|
||||
## v0.107.70: API changes
|
||||
|
||||
### New `"start_time"` field in 'GET /control/status'
|
||||
|
||||
- New field `"start_time"` indicates the start time of the web API server (Unix time in milliseconds).
|
||||
|
||||
## v0.107.68: API changes
|
||||
|
||||
### New HTTP APIs 'GET /control/rewrite/settings' and 'PUT /control/rewrite/settings/update'
|
||||
|
||||
@@ -1500,6 +1500,11 @@
|
||||
'language':
|
||||
'type': 'string'
|
||||
'example': 'en'
|
||||
'start_time':
|
||||
'type': 'number'
|
||||
'format': 'double'
|
||||
'example': 1700000000000
|
||||
'description': 'Start time of the web API server (Unix time in milliseconds).'
|
||||
'DNSConfig':
|
||||
'type': 'object'
|
||||
'description': 'DNS server configuration'
|
||||
|
||||
Reference in New Issue
Block a user