added clear cache button to edit page
This commit is contained in:
parent
1a880edd74
commit
f2996e90bd
5 changed files with 50 additions and 5 deletions
5
main.go
5
main.go
|
@ -535,9 +535,8 @@ func (web *Web) cacheView(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (web *Web) cacheClear(c *gin.Context) {
|
func (web *Web) cacheClear(c *gin.Context) {
|
||||||
url := c.PostForm("url")
|
web.urlCache = make(map[string]string, 5)
|
||||||
delete(web.urlCache, url)
|
c.JSON(http.StatusOK, gin.H{"status": "ok"})
|
||||||
c.Redirect(http.StatusSeeOther, "/cache/view")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (web *Web) exportWatch(c *gin.Context) {
|
func (web *Web) exportWatch(c *gin.Context) {
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
function clearCache() {
|
||||||
|
var confirmed = confirm("Do you want to clear the URL cache?");
|
||||||
|
if (!confirmed) {
|
||||||
|
return; // do nothing
|
||||||
|
}
|
||||||
|
var data = new URLSearchParams();
|
||||||
|
fetch("/cache/clear", {
|
||||||
|
method: "POST"
|
||||||
|
}).then(function (response) {
|
||||||
|
if (response.ok) {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
alert("Could not clear cache");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function clearCacheButtonInit() {
|
||||||
|
var clearCacheButton = document.getElementById("clearCacheButton");
|
||||||
|
clearCacheButton.onclick = clearCache;
|
||||||
|
}
|
||||||
|
document.addEventListener('DOMContentLoaded', clearCacheButtonInit, false);
|
|
@ -0,0 +1,21 @@
|
||||||
|
function clearCache(){
|
||||||
|
let confirmed = confirm("Do you want to clear the URL cache?");
|
||||||
|
if (!confirmed){
|
||||||
|
return // do nothing
|
||||||
|
}
|
||||||
|
let data = new URLSearchParams();
|
||||||
|
fetch("/cache/clear", {
|
||||||
|
method: "POST"
|
||||||
|
}).then((response) => {
|
||||||
|
if(response.ok){
|
||||||
|
window.location.reload()
|
||||||
|
} else {
|
||||||
|
alert("Could not clear cache");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function clearCacheButtonInit(){
|
||||||
|
let clearCacheButton = document.getElementById("clearCacheButton") as HTMLElement;
|
||||||
|
clearCacheButton.onclick = clearCache;
|
||||||
|
}
|
||||||
|
document.addEventListener('DOMContentLoaded', clearCacheButtonInit, false);
|
|
@ -43,6 +43,11 @@ GoWatch Edit {{ .Watch.Name }}
|
||||||
Import Watch
|
Import Watch
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" id="clearCacheButton" class="btn btn-info btn-sm">
|
||||||
|
Clear Cache
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="/watch/view/{{ .Watch.ID }}" class="btn btn-outline-secondary btn-sm">
|
<a href="/watch/view/{{ .Watch.ID }}" class="btn btn-outline-secondary btn-sm">
|
||||||
View Watch
|
View Watch
|
||||||
|
@ -226,6 +231,5 @@ function canvasInit() {
|
||||||
document.addEventListener('DOMContentLoaded', canvasInit, false);
|
document.addEventListener('DOMContentLoaded', canvasInit, false);
|
||||||
|
|
||||||
var notifiers = {{ .Notifiers }};
|
var notifiers = {{ .Notifiers }};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{{ end }}
|
{{ end }}
|
1
todo.md
1
todo.md
|
@ -14,5 +14,4 @@
|
||||||
- walmart
|
- walmart
|
||||||
- etsy
|
- etsy
|
||||||
- aliexpress.com
|
- aliexpress.com
|
||||||
- clear cache button on edit page
|
|
||||||
- add apprise/Shoutrrr ?
|
- add apprise/Shoutrrr ?
|
Loading…
Add table
Reference in a new issue