Added support for versions, made slightly prettier

This commit is contained in:
Tracker-Friendly 2024-10-15 20:03:34 +01:00
parent b0d5b191ce
commit 2210185f33
3 changed files with 5 additions and 2 deletions

View File

@ -491,7 +491,7 @@ func Main(information library.ServiceInitializationInformation) *chi.Mux {
router.Get("/api/rfc/list", func(w http.ResponseWriter, r *http.Request) {
// Get the list of RFCs
rows, err := conn.DB.Query("SELECT name, id, year, version FROM rfc")
rows, err := conn.DB.Query("SELECT name, id, year, version FROM rfc ORDER BY year DESC, id DESC")
if err != nil {
renderJSON(500, w, map[string]interface{}{"error": "Internal server error", "code": "01"}, information)
return

View File

@ -14,6 +14,7 @@
<input type="text" id="rfcTitle" placeholder="Title">
<input type="text" id="rfcYear" placeholder="Year">
<input type="text" id="rfcId" placeholder="ID">
<input type="text" id="rfcVersion" placeholder="Version">
<textarea id="rfcText"></textarea>
<button id="submitRfc">Submit</button>
<h2>Remove an RFC</h2>
@ -26,6 +27,7 @@
const year = document.getElementById("rfcYear").value;
const id = document.getElementById("rfcId").value;
const text = document.getElementById("rfcText").value;
const version = document.getElementById("rfcVersion").value;
fetch("/api/rfc/add", {
method: "POST",
headers: {
@ -35,7 +37,7 @@
name: title,
year: parseInt(year),
id: parseInt(id),
version: "1.0.0",
version: version,
content: text,
token: localStorage.getItem("SECRET-token")
})

View File

@ -25,6 +25,7 @@
height: 50px;
border: 1px solid black;
background-color: white;
margin-bottom: 5px;
}
#rfcList button:hover {