out, err := exec.Command("/bin/sh", "-c", "sudo docker ps -aqf ancestor=sis50binb:latest").Output()
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
+ w.Write([]byte("Failed to find the id of the docker container that is running: " + err.Error()))
return
}
err = exec.Command("/bin/sh", "-c", "sudo docker stop", id).Run()
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
+ w.Write([]byte("Failed to stop the docker container that is running sis50binb: " + err.Error()))
return
}
err = exec.Command("/bin/sh", "-c", "sudo docker rm", id).Run()
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
+ w.Write([]byte("Failed to delete dockere container that is running sis50binb: " + err.Error()))
return
}
err = exec.Command("/bin/sh", "-c", "sudo", dbw.BinbLocation + "./launch.sh").Run()
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
+ w.Write([]byte("Failed to launch sis50binb at the given Binblocation: " + err.Error()))
return
}
font-family: sans-serif;
}
+button {
+ padding: 5px;
+ border: none;
+ border-radius: 6px;
+ background-color: #bcdee0;
+}
+
+button:hover {
+ background-color: #4be8f2;
+}
+
#innerSongList, #innerSongFileList {
- max-height: 50vh;
overflow-y: scroll;
+ height: 50vh;
+ max-width: 50vw;
+ border: 1px solid grey;
+ border-radius: 10px;
}
.songElement {
display: flex;
margin: 10px;
+ max-width: 40vw;
+ border-radius: 5px;
+ box-shadow: grey 3px 3px 2px;
+ border: 1px solid grey;
+ padding: 4px;
* {
margin: auto 10px auto 10px;
.songFileElement {
display: flex;
+ margin: 10px;
+ max-width: 40vw;
+ border-radius: 5px;
+ box-shadow: grey 3px 3px 2px;
+ border: 1px solid grey;
+ padding: 4px;
}
.success {
<input placeholder="Name of a song..." id="songFilterName"></input>
<input placeholder="Name of an artist..." id="songFilterArtist"></input>
<input id="songFilterInDB" type="checkbox">In DB</input>
+ <input id="songFilterNotInDB" type="checkbox">Not In DB</input>
<button id="" onclick="getSongList()">Update Songs</button>
</div>
</div>
</div>
- <div id="songFileFilterInputs">
- <input placeholder="File name..." id="songFileFilterName"></input>
- </div>
- <div id="innerSongFileList">
+ <hr>
+ <div>
+ <h1><u>File List</u></h1>
+ <div id="songFileFilterInputs">
+ <input placeholder="File name..." id="songFileFilterName"></input>
+ </div>
+ <div id="innerSongFileList">
+ </div>
</div>
</body>
let songFilterName = document.getElementById("songFilterName")
let songFilterArtist = document.getElementById("songFilterArtist")
let songFilterInDB = document.getElementById("songFilterInDB")
+let songFilterNotInDB = document.getElementById("songFilterNotInDB")
/**
* Get the current state of filters, with fields NameFilter, ArtistFilter, DBFilter
filterStates.NameFilter = songFilterName.value.toLowerCase()
filterStates.ArtistFilter = songFilterArtist.value.toLowerCase()
filterStates.DBFilter = songFilterInDB.checked
+ filterStates.NotDBFilter = songFilterNotInDB.checked
return filterStates
}
// get the filter states
let filters = getFilterStates()
+ if (filters.DBFilter && filters.NotDBFilter) {
+ alert("Contradicting filters.")
+ return
+ }
+
// deep copy
let filteredList = [...songList]
filteredList = filteredList.filter((v, _1, _2) => { return SongURLExists(v.PreviewURL)})
}
+ if (filters.NotDBFilter) {
+ filteredList = filteredList.filter((v, _1, _2) => { return !SongURLExists(v.PreviewURL)})
+ }
+
if (filters.NameFilter != "") {
filteredList = filteredList.filter((v, _1, _2) => {
return v.TrackName.toLowerCase().includes(filters.NameFilter.toLowerCase())
songFilterName.oninput = (event) => {updateSongListWithFilter(event)}
songFilterArtist.oninput = (event) => {updateSongListWithFilter(event)}
songFilterInDB.oninput = (event) => {updateSongListWithFilter(event)}
+songFilterNotInDB.oninput = (event) => {updateSongListWithFilter(event)}
/**
* EDIT MENU FOR SONGS
+/**
+ * RESTART
+ **/
+let restartButton = document.getElementById("restartButton")
+
+restartButton.addEventListener("click", async (_) => {
+ let response = await fetch("/rebootapp")
+ if (response.status != 200) {
+ alert(await response.text())
+ return
+ }
+
+ alert("Rebooted the app.")
+})
+
+
/**
* ROOM CREATION
**/
<body>
<a href="/">Home</a>
+ <button id="restartButton">Restart (should update rooms)</button>
<button id="createRoomButton">Make a New Room</button>
<label for="rooms">Select a Room to View</label>
<select name="rooms" id="roomSelect">