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