-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Logger, Validator initial progress, htmx initial progress
- Loading branch information
Showing
12 changed files
with
232 additions
and
45 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
root = "." | ||
testdata_dir = "testdata" | ||
tmp_dir = "tmp" | ||
|
||
[build] | ||
args_bin = [] | ||
bin = "./tmp/main" | ||
cmd = "go build -o ./tmp/main ." | ||
delay = 0 | ||
exclude_dir = ["assets", "tmp", "vendor", "testdata"] | ||
exclude_file = [] | ||
exclude_regex = ["_test.go"] | ||
exclude_unchanged = false | ||
follow_symlink = false | ||
full_bin = "" | ||
include_dir = [] | ||
include_ext = ["go", "tpl", "tmpl", "html"] | ||
include_file = [] | ||
kill_delay = "0s" | ||
log = "build-errors.log" | ||
poll = false | ||
poll_interval = 0 | ||
rerun = false | ||
rerun_delay = 500 | ||
send_interrupt = false | ||
stop_on_error = false | ||
|
||
[color] | ||
app = "" | ||
build = "yellow" | ||
main = "magenta" | ||
runner = "green" | ||
watcher = "cyan" | ||
|
||
[log] | ||
main_only = false | ||
time = false | ||
|
||
[misc] | ||
clean_on_exit = false | ||
|
||
[screen] | ||
clear_on_rebuild = false | ||
keep_scroll = true |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
tmp |
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package main | ||
|
||
import ( | ||
"runtime" | ||
"strconv" | ||
"strings" | ||
|
||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
var log = logrus.New() | ||
|
||
func SetupLogger() { | ||
|
||
log.SetFormatter(&logrus.TextFormatter{ | ||
ForceColors: true, // Enable colors in the console output | ||
FullTimestamp: true, // Show full timestamp with date and time | ||
TimestampFormat: "2006-01-02 15:04:05", | ||
CallerPrettyfier: func(f *runtime.Frame) (string, string) { | ||
// Get the filename and the function name from the file path | ||
slash := strings.LastIndex(f.File, "/") | ||
filename := f.File[slash+1:] | ||
return "", "[" + filename + ":" + strconv.Itoa(f.Line) + "]" | ||
}, | ||
}) | ||
|
||
log.SetReportCaller(true) | ||
log.SetLevel(logrus.TraceLevel) | ||
} |
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 |
---|---|---|
|
@@ -6,6 +6,20 @@ | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>imapsync-web</title> | ||
<script src="https://cdn.tailwindcss.com"></script> | ||
<script src="https://unpkg.com/[email protected]" | ||
integrity="sha384-xcuj3WpfgjlKF+FXhSQFQ0ZNr39ln+hwjN3npfM9VBnUskLolQAcN80McRIVOPuO" | ||
crossorigin="anonymous"></script> | ||
|
||
<style> | ||
#error-notification { | ||
transition: all 0.5s ease; | ||
} | ||
|
||
#error-notification.hidden { | ||
transform: translateX(100%); | ||
} | ||
</style> | ||
|
||
</head> | ||
|
||
<body class="bg-gray-100 dark:bg-gray-900 text-gray-800 dark:text-white p-2"> | ||
|
@@ -18,30 +32,33 @@ <h1 class="text-4xl font-semibold text-center my-4">imapsync-web</h1> | |
<!-- Source details --> | ||
<div class="w-1/2 bg-white dark:bg-gray-800 rounded-lg p-4 shadow-md"> | ||
<h2 class="text-2xl font-semibold mb-4">Source Details</h2> | ||
<form> | ||
|
||
<form hx-post="/api/validate" hx-target="#error-notification" hx-swap="outerHTML"> | ||
<div class="grid gap-4"> | ||
<div> | ||
<label for="source_server" class="block font-semibold">Server</label> | ||
<input type="text" id="source_server" name="source_server" placeholder="Source Server" class="w-full border-2 border-gray-300 dark:border-gray-700 p-2 rounded-lg | ||
<input type="text" id="source_server" name="server" placeholder="Source Server" class="w-full border-2 border-gray-300 dark:border-gray-700 p-2 rounded-lg | ||
focus:outline-none focus:border-blue-500 dark:focus:border-blue-500 text-black" required | ||
value="{{.SourceDetails.Server}}"> | ||
</div> | ||
<div> | ||
<label for="source_account" class="block font-semibold">Account</label> | ||
<input type="text" id="source_account" name="source_account" placeholder="Source Account" class="w-full border-2 border-gray-300 dark:border-gray-700 p-2 rounded-lg | ||
<input type="text" id="source_account" name="account" placeholder="Source Account" class="w-full border-2 border-gray-300 dark:border-gray-700 p-2 rounded-lg | ||
focus:outline-none focus:border-blue-500 dark:focus:border-blue-500 text-black" required | ||
value="{{.SourceDetails.Account}}"> | ||
</div> | ||
<div> | ||
<label for="source_password" class="block font-semibold">Password</label> | ||
<input type="password" id="source_password" name="source_password" placeholder="Source Password" | ||
class="w-full border-2 border-gray-300 dark:border-gray-700 p-2 rounded-lg | ||
<input type="password" id="source_password" name="password" placeholder="Source Password" class="w-full border-2 border-gray-300 dark:border-gray-700 p-2 rounded-lg | ||
focus:outline-none focus:border-blue-500 dark:focus:border-blue-500 text-black" required | ||
value="{{.SourceDetails.Password}}"> | ||
</div> | ||
|
||
</div> | ||
<button type="submit" class="w-full bg-blue-500 text-white p-2 rounded-lg mt-4"> | ||
Validate Credentials | ||
</button> | ||
</form> | ||
|
||
</div> | ||
<!-- Destination details --> | ||
<div class="w-1/2 bg-white dark:bg-gray-800 rounded-lg p-4 shadow-md"> | ||
|
@@ -50,26 +67,24 @@ <h2 class="text-2xl font-semibold mb-4">Destination Details</h2> | |
<div class="grid gap-4"> | ||
<div> | ||
<label for="destination_server" class="block font-semibold">Server</label> | ||
<input type="text" id="destination_server" name="destination_server" | ||
placeholder="Destination Server" class="w-full border-2 border-gray-300 dark:border-gray-700 p-2 rounded-lg | ||
<input type="text" id="destination_server" name="server" placeholder="Destination Server" class="w-full border-2 border-gray-300 dark:border-gray-700 p-2 rounded-lg | ||
focus:outline-none focus:border-blue-500 dark:focus:border-blue-500 text-black" required | ||
value="{{.DestinationDetails.Server}}"> | ||
</div> | ||
<div> | ||
<label for="destination_account" class="block font-semibold">Account</label> | ||
<input type="text" id="destination_account" name="destination_account" | ||
placeholder="Destination Account" class="w-full border-2 border-gray-300 dark:border-gray-700 p-2 rounded-lg | ||
<input type="text" id="destination_account" name="account" placeholder="Destination Account" | ||
class="w-full border-2 border-gray-300 dark:border-gray-700 p-2 rounded-lg | ||
focus:outline-none focus:border-blue-500 dark:focus:border-blue-500 text-black" required | ||
value="{{.DestinationDetails.Account}}"> | ||
</div> | ||
<div> | ||
<label for="destination_password" class="block font-semibold">Password</label> | ||
<input type="password" id="destination_password" name="destination_password" | ||
<input type="password" id="destination_password" name="password" | ||
placeholder="Destination Password" class="w-full border-2 border-gray-300 dark:border-gray-700 p-2 rounded-lg | ||
focus:outline-none focus:border-blue-500 dark:focus:border-blue-500 text-black" required | ||
value="{{.DestinationDetails.Password}}"> | ||
</div> | ||
|
||
</div> | ||
</form> | ||
</div> | ||
|
@@ -82,6 +97,8 @@ <h2 class="text-2xl font-semibold mb-4">Destination Details</h2> | |
Validate Credentials | ||
</button> | ||
</div> | ||
<div id="error-notification" class="hidden bg-red-500 text-white p-2 rounded absolute top-0 right-0 mt-4 mr-4"> | ||
Error Validating Credentials</div> | ||
<div> | ||
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"> | ||
Sync | ||
|
@@ -108,4 +125,11 @@ <h2 class="text-2xl font-semibold mb-4">Log Output</h2> | |
<div class="container mx-auto flex justify-center p-4"> | ||
<p class="text-center text-gray-500 dark:text-gray-400">imapsync-web</p> | ||
</div> | ||
|
||
<script> | ||
var errorNotification = document.getElementById("error-notification"); | ||
errorNotification.addEventListener("click", function () { | ||
errorNotification.classList.add("hidden"); | ||
}); | ||
</script> | ||
</body> |
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package main | ||
|
||
func transferFiles(sourceDetails Credentials, destinationDetails Credentials, files []string) error { | ||
return nil | ||
} |
Oops, something went wrong.