Commit Graph

32 Commits

Author SHA1 Message Date
Sergey Krashevich
23e8f7e0aa refactor(api): move port extraction logic to Init function for prevent data race 2024-07-28 05:34:49 +03:00
Alex X
cf4f6468f3 Simplify restart func 2024-04-29 10:41:53 +03:00
Sergey Krashevich
e1ebed4859 fix(api): fix potential Slowloris Attack 2024-04-16 17:22:06 +03:00
Alex X
d3bc18c369 Logs refactoring after #780 2023-12-11 18:07:38 +03:00
Alex X
1f3a32023f Merge pull request #780 from 'skrashevich/log-viewer' 2023-12-11 18:07:25 +03:00
Sergey Krashevich
fc5b36acd3 actualise godoc comment for api.logHandler func 2023-12-05 17:54:53 +03:00
Sergey Krashevich
b60000ac34 Refactor log handling to use in-memory Logger 2023-12-05 17:44:32 +03:00
MPTres
0da8b46148 remove empty lines. 2023-12-05 13:52:34 +01:00
MPTres
39b614fb0f Remove X-PINGOTHER from allowed headers. 2023-12-05 13:37:05 +01:00
MPTres
84469dcd25 CORS. Add support for OPTIONS requests. 2023-12-04 17:14:18 +01:00
Sergey Krashevich
7ac5b4f114 Ensure exit code is within valid range
The exitHandler function now properly validates the exit code provided
in the query string. It checks for conversion errors and ensures the
code is within the valid range of 0 to 125. If the validation fails,
it responds with an HTTP 400 Bad Request error. This prevents potential
misuse of the exit endpoint by restricting the exit codes to expected
values.
2023-11-29 10:03:39 +03:00
Sergey Krashevich
ab47d5718f Refactor log handling and add UI auto-update toggle
This commit refactors the log handling in the API to use a switch statement for improved readability and maintainability. It also introduces error messages with more context when reading or truncating the log file fails.

On the frontend, a new auto-update toggle button has been added to the log viewer, allowing users to enable or disable automatic log updates. The button's appearance changes based on its state, providing a clear visual indication of whether auto-update is active. Additionally, the button styling has been updated to ensure consistency across the interface.
2023-11-28 22:55:50 +03:00
Sergey Krashevich
8d382afa0f Add log file handling and viewing capabilities
This commit introduces the ability to handle log files through the API and
provides a new log viewing page. The API now supports GET and DELETE methods
for log file operations, allowing retrieval and deletion of log contents.
A new log.html page has been added for viewing logs in the browser, with
automatic refresh every 5 seconds and styling based on log levels.

The app.go file has been updated to include a GetLogFilepath function that
retrieves or generates the log file path. The NewLogger function now accepts
a file parameter to enable file logging. The main.js file has been updated
to include a link to the new log.html page.

This enhancement improves the observability and management of the application
by providing real-time access to logs and the ability to clear them directly
from the web interface.
2023-11-26 23:21:57 +03:00
Alex X
43449e7b08 Fix api port for homekit module 2023-11-18 11:48:19 +03:00
Alex X
28830a697d Add support unix socket for api module 2023-11-12 21:50:29 +03:00
Alex X
39645cb3d8 Remove unnecessary 0.0.0.0 from listeners 2023-11-03 12:45:40 +03:00
Alex X
36ee2b29fb Update TLS files handling 2023-10-14 15:51:43 +03:00
Alex X
3ae15d8f80 Add support TLS cert/key as file path #680 2023-10-11 11:50:30 +03:00
Alex X
9a2e9dd6d1 Add support /api/restart #652 2023-10-09 17:12:25 +03:00
Alexey Khit
9f404d965f Rewrite HomeKit pairing API 2023-09-01 22:48:06 +03:00
Alexey Khit
0621b82aff Change response sources API 2023-09-01 22:32:49 +03:00
Alexey Khit
69da64a49c Rename streams to sources in the discovery API 2023-09-01 10:17:58 +03:00
Alexey Khit
189f142fae Restore IPv6 support for API and RTSP #532 2023-07-20 22:09:11 +03:00
Alexey Khit
e4b68518e5 Remove all listeners from IPv6 interface 2023-07-17 18:28:15 +03:00
Alexey Khit
bc6e4f40bf Code refactoring after #352 2023-06-29 21:39:31 +03:00
Alexey Khit
ac5bcda492 Merge pull request #352 from skrashevich/patch-listen-tls 2023-06-29 21:35:19 +03:00
Alexey Khit
9de980a63c Fix config tab showing byte string instead of text #479 2023-06-29 16:16:08 +03:00
Alexey Khit
888159d2b6 Update API response mime type 2023-05-31 14:41:57 +03:00
Alexey Khit
0e270081fe Add content-type to API responses 2023-05-30 22:02:16 +03:00
Alexey Khit
59555cfe1d Move WS API to separate module 2023-05-23 14:21:39 +03:00
Sergey Krashevich
c94d1e237d Merge remote-tracking branch 'remotes/upstream/master' into patch-listen-tls 2023-05-21 23:29:08 +03:00
Alexey Khit
75f61b38ac Move cmd module to internal 2023-05-01 12:55:14 +03:00