about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgunadhya <6939749+gunadhya@users.noreply.github.com>2021-01-16 01:34:11 +0530
committerCaleb Cartwright <calebcartwright@users.noreply.github.com>2021-08-17 21:55:26 -0500
commit042c2ec369a61d52cef935cbb67ae9b81da03d0f (patch)
treec274d914aca3eec0f61f3366d4c94db9d202d96f
parent3c36a0c0b74c2e5cb4c27a53e596b5729a5b3c65 (diff)
downloadrust-042c2ec369a61d52cef935cbb67ae9b81da03d0f.tar.gz
rust-042c2ec369a61d52cef935cbb67ae9b81da03d0f.zip
Added Updated default version to Rustfmt docs config
-rw-r--r--docs/index.html11
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/index.html b/docs/index.html
index bab4d2ec63b..f31c695f7ca 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -87,6 +87,7 @@
         </div>
         <script>
             const RusfmtTagsUrl = 'https://api.github.com/repos/rust-lang/rustfmt/tags';
+            const RustfmtLatestUrl = 'https://api.github.com/repos/rust-lang/rustfmt/releases/latest';
             const UrlHash = window.location.hash.replace(/^#/, '');
             const queryParams = new URLSearchParams(window.location.search);
             const searchParam = queryParams.get('search');
@@ -112,6 +113,16 @@
                 scrolledOnce: false,
               },
               asyncComputed: {
+                async updateVersion() {
+                  let latest;
+                  try {
+                    latest = (await axios.get(RustfmtLatestUrl)).data;
+                  } catch(err) {
+                      console.log(err);
+                    return;
+                  }
+                  this.version = latest.name;
+                },
                 async outputHtml() {
                   if (this.version !== this.oldVersion) {
                     const ConfigurationMdUrl =