Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
8e8a4ce482 | |||
19c2845222 | |||
a4cc579fe3 | |||
3941d4761d | |||
fb405dc55c | |||
0cc4a8a92f |
@ -60,9 +60,9 @@ type AlpineLinuxPackageUpdate struct {
|
||||
|
||||
func (u *AlpineLinuxPackageUpdate) Update() {
|
||||
|
||||
u.apkLock.Lock()
|
||||
log.Println("Updating packages...")
|
||||
cmd := exec.Command("apk", u.Packages...)
|
||||
u.apkLock.Lock()
|
||||
stdout, err := cmd.Output()
|
||||
u.apkLock.Unlock()
|
||||
if err != nil {
|
||||
|
21
main.go
21
main.go
@ -183,21 +183,12 @@ func handleDownload(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
ctx.DownloadURL = downloadURL
|
||||
w.Header().Add(
|
||||
"Hx-Redirect",
|
||||
fmt.Sprintf("/download-direct?URL=%s&filename=%s",
|
||||
ctx.DownloadURL = fmt.Sprintf("/download-direct?URL=%s&filename=%s",
|
||||
url.QueryEscape(ctx.DownloadURL),
|
||||
url.QueryEscape(filename)),
|
||||
url.QueryEscape(filename),
|
||||
)
|
||||
|
||||
err = templates.ExecuteTemplate(w,"download-result.html", ctx)
|
||||
if err != nil {
|
||||
log.Println(err.Error())
|
||||
ctx.StatusCode = 500
|
||||
ctx.Err = &err
|
||||
err = templates.ExecuteTemplate(w,"download-result.html", ctx)
|
||||
return
|
||||
}
|
||||
w.Header().Add("Hx-Redirect", ctx.DownloadURL)
|
||||
}
|
||||
|
||||
func handleDirectDownload(w http.ResponseWriter, r *http.Request) {
|
||||
@ -276,7 +267,7 @@ func handleDirectDownload(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func handleRoot(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/" && r.URL.Path != "" {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
http.Redirect(w, r, "/", http.StatusPermanentRedirect)
|
||||
return
|
||||
}
|
||||
|
||||
@ -376,8 +367,8 @@ func main() {
|
||||
|
||||
wrappedHandler := NewLogger(handler)
|
||||
srv := http.Server{
|
||||
ReadTimeout: 60 * time.Second,
|
||||
WriteTimeout: 60 * time.Second,
|
||||
ReadTimeout: 1 * time.Minute,
|
||||
WriteTimeout: 1 * time.Minute,
|
||||
Addr: ":" + DEFAULT_HTTP_PORT,
|
||||
Handler: wrappedHandler,
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
<form hx-post="/download" hx-target="#get-btn" hx-swap="outerHTML" hx-indicator="#progress">
|
||||
<div class="grid">
|
||||
<div hx-target="this" hx-swap="outerHTML">
|
||||
<label data-tooltip="Link can be on any platform!">Link
|
||||
<label>Link
|
||||
<input
|
||||
type="url" id="URL" name="URL"
|
||||
hx-post="/valid-link"
|
||||
@ -45,17 +45,12 @@
|
||||
Convert to MP3 audio
|
||||
</label>
|
||||
</fieldset>
|
||||
<button class=" outline" id="get-btn" role="button">Get
|
||||
<button class="outline" id="get-btn" role="button">Get
|
||||
<!-- <a class="htmx-indicator" href="#" aria-busy="true"></a> -->
|
||||
</button>
|
||||
|
||||
</form>
|
||||
<progress class="htmx-indicator" id="progress"></progress>
|
||||
</div>
|
||||
<div>
|
||||
<img src="/assets/images/play.png">
|
||||
</div>
|
||||
<script data-cfasync="false" type="text/javascript" src="//brightadnetwork.com/a/display.php?r=7440414"></script>
|
||||
<script data-cfasync="false" type="text/javascript" data-adel="atag" src="//acscdn.com/script/atg.js" czid="gobrl6fkye"></script>
|
||||
</main>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user