Skip to content

Commit

Permalink
Enable the button once the loading of drivers is complete, new build
Browse files Browse the repository at this point in the history
  • Loading branch information
rtfmkiesel committed Sep 10, 2024
1 parent 94ad221 commit 6bc34fd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Binary file modified assets/loldrivers-webclient.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h1>LOLDrivers-webclient</h1>
<li>C:\Windows\System32\DriverStore\FileRepository</li>
<li>C:\WINDOWS\inf</li>
</ul>
<button id="select-folder-button">Select Folder</button>
<button id="select-folder-button" disabled>Loading...</button>
<div id="results" style="display: none">
<h2>Results</h2>
<p>Processed files: <span id=file-counter>0</span></p>
Expand Down
11 changes: 10 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,24 @@ func MatchHashWrapper(this js.Value, p []js.Value) interface{} {
}

func main() {
// Get the button from the DOM
jsDoc := js.Global().Get("document")
folderButton := jsDoc.Call("getElementById", "select-folder-button")

fmt.Println("Loading drivers")
if err := loldrivers.LoadDrivers(); err != nil {
fmt.Println(err)
folderButton.Set("innerHTML", "There was an error fetching the driver data, check the console")
return
}

fmt.Println("Registering lookupHash")
fmt.Println("Registering lookupHash function")
js.Global().Set("lookupHash", js.FuncOf(MatchHashWrapper))

// Enable the button if we get here
folderButton.Set("innerHTML", "Select folder")
folderButton.Set("disabled", false)

// Do not quit
select {}
}

0 comments on commit 6bc34fd

Please sign in to comment.