aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-04-29 19:29:12 +0200
committerlonkaars <loek@pipeframe.xyz>2021-04-29 19:29:12 +0200
commit8abb448b0b67e2c823b96a949446bce909e9452d (patch)
tree47da028d13be88570c18868a34e6edd935ab43b8
parent9eba5d3e5da90987bb38ee33b505e0c26ea310d9 (diff)
added readme
-rw-r--r--index.ts8
-rw-r--r--readme.md45
2 files changed, 51 insertions, 2 deletions
diff --git a/index.ts b/index.ts
index 17aa551..07013ce 100644
--- a/index.ts
+++ b/index.ts
@@ -51,10 +51,14 @@ downloads.each(async (i, el) => {
minecraftVersions[version.minecraft] = [];
minecraftVersions[version.minecraft].push(version);
- if (!latest && version.preview == false)
+ if (!latest && version.preview == false) {
latest = version;
- if (!latestPre && version.preview == true)
+ await writeFileAsync("./out/latest", JSON.stringify(version));
+ }
+ if (!latestPre && version.preview == true) {
latestPre = version;
+ await writeFileAsync("./out/latestPre", JSON.stringify(version));
+ }
}
for(var mcVersion in minecraftVersions) {
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..a10c3a0
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,45 @@
+# of-api
+
+This is an unofficial Optifine download API. It just scrapes the Optifine
+website and creates JSON files with download links and metadata about each
+Optifine version. This doesn't technically go against Optifine's copyright
+policy because you're still downloading from their servers. The only thing this
+does is make it easier to programmatically download optifine.
+
+This 'API' is designed to generate files periodically and then host them using
+a static serving web server like nginx or apache. A live version can be found
+on <https://of.pipeframe.xyz>, all endpoints will then be used with this base
+URL. Please open an issue if you have any questions regarding the API, or if
+any links are broken since I'm currently too lazy to setup a systemd timer that
+runs it automatically.
+
+## Endpoints:
+
+All response types are documented in [types.ts](./types.ts)
+
+### `/all`
+
+```
+{ APIResponse }
+```
+
+### `/latest`
+
+```
+{ OptifineVersion }
+```
+
+### `/latestPre`
+
+```
+{ OptifineVersion }
+```
+
+### `/[mc version]`
+
+`[mc version]` can be any valid Minecraft version string, eg. `1.7.10` or `1.8.9`.
+
+```
+[ OptifineVersion ]
+```
+