-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reworked webui reader #156
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
package httpcontroller | ||
|
||
import ( | ||
"bufio" | ||
"io/fs" | ||
"mime" | ||
"net/http" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
|
||
|
@@ -34,3 +36,30 @@ func customFileServer(e *echo.Echo, fileSystem fs.FS, root string) { | |
fileServer.ServeHTTP(w, r) | ||
}))) | ||
} | ||
|
||
// readWebLog reads the content of the web.log file from the root directory and returns it as a string. | ||
// It returns an error if there is an issue opening or reading the file. | ||
func readWebLog() (string, error) { | ||
// Open the web.log file | ||
file, err := os.Open("webui.log") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider making the file path for |
||
if err != nil { | ||
return "", err | ||
} | ||
defer file.Close() | ||
|
||
var content string | ||
scanner := bufio.NewScanner(file) | ||
|
||
// Read the file line by line and append each line to the content string | ||
for scanner.Scan() { | ||
content += scanner.Text() + "\n" | ||
} | ||
|
||
// Check if there was an error during scanning | ||
if err := scanner.Err(); err != nil { | ||
return "", err | ||
} | ||
|
||
// Return the content of the file | ||
return content, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,57 @@ | ||
{{define "logs"}} | ||
|
||
<span class="col-span-12">Nothing here yet ..</span> | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
{{end}} | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>BirdNET-Go Logs</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link href="/assets/tailwind.css" rel="stylesheet" /> | ||
<link href="/assets/custom.css" rel="stylesheet" /> | ||
<!-- htmx --> | ||
<script src="/assets/htmx.min.js" defer></script> | ||
<!-- alpine.js --> | ||
<script src="/assets/alpinejs.min.js" defer></script> | ||
</head> | ||
|
||
<body class="drawer min-h-screen bg-base-200 lg:drawer-open"> | ||
<input id="my-drawer" type="checkbox" class="drawer-toggle" /> | ||
|
||
<div class="drawer-content"> | ||
<div class="grid grid-cols-12 grid-rows-[min-content] gap-y-0 p-3 lg:pt-4 lg:pr-8 lg:pl-8 lg:pb-0"> | ||
{{ template "header" . }} | ||
</div> | ||
|
||
<!-- content --> | ||
<main> | ||
<div id="mainContent" class="grid grid-cols-12 grid-rows-[min-content] gap-y-8 p-3 lg:p-8" > | ||
<span class="col-span-12"> | ||
{{if .LogContent}} | ||
<pre>{{.LogContent}}</pre> | ||
{{else}} | ||
It didn't work | ||
{{end}} | ||
</span> | ||
</div> | ||
<!-- Placeholder for dynamic notifications --> | ||
<div id="status-message"></div> | ||
</main> | ||
</div> | ||
|
||
{{ template "sidebar" . }} | ||
|
||
<script> | ||
// Set the date picker to today's date | ||
setTimeout(function () { | ||
var datePicker = document.getElementById('datePicker'); | ||
var today = new Date().toLocaleString('sv').split(' ')[0]; | ||
datePicker.value = today; | ||
}, 0); // Set timeout for 0ms | ||
|
||
</script> | ||
</body> | ||
|
||
</html> | ||
|
||
{{end}} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what's going on here.