Add update links to each master index

Flenarn provided a spreadsheet mapping our master indexes to the
corresponding update.

Signed-off-by: Graham <gpe@openrs2.org>
bzip2
Graham 3 years ago
parent f2dc8beeec
commit 0781e23874
  1. 21
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheExporter.kt
  2. 7
      archive/src/main/resources/org/openrs2/archive/migrations/V4__updates.sql
  3. 9
      archive/src/main/resources/org/openrs2/archive/templates/caches/show.html

@ -98,6 +98,7 @@ public class CacheExporter @Inject constructor(
public data class Cache( public data class Cache(
val id: Int, val id: Int,
val sources: List<Source>, val sources: List<Source>,
val updates: List<String>,
val stats: Stats?, val stats: Stats?,
val masterIndex: Js5MasterIndex val masterIndex: Js5MasterIndex
) )
@ -284,7 +285,25 @@ public class CacheExporter @Inject constructor(
} }
} }
Cache(id, sources, stats, masterIndex) val updates = mutableListOf<String>()
connection.prepareStatement(
"""
SELECT url
FROM updates
WHERE master_index_id = ?
""".trimIndent()
).use { stmt ->
stmt.setInt(1, id)
stmt.executeQuery().use { rows ->
while (rows.next()) {
updates += rows.getString(1)
}
}
}
Cache(id, sources, updates, stats, masterIndex)
} }
} }

@ -0,0 +1,7 @@
-- @formatter:off
CREATE TABLE updates (
master_index_id INTEGER NOT NULL REFERENCES master_indexes (id),
url TEXT NOT NULL,
PRIMARY KEY (master_index_id, url)
);
-- @formatter:on

@ -69,6 +69,15 @@
</div> </div>
</td> </td>
</tr> </tr>
<tr>
<th class="table-dark">Update(s)</th>
<td>
<span th:each="update, it : ${cache.updates}" th:remove="tag">
<a th:href="${update}" th:text="${update}">https://www.example.com/</a>
<br th:remove="${it.last}? 'all' : 'none'" />
</span>
</td>
</tr>
</table> </table>
<h2>Sources</h2> <h2>Sources</h2>

Loading…
Cancel
Save