aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-02-28 21:31:42 -0600
committermat <27899617+mat-1@users.noreply.github.com>2021-02-28 21:31:42 -0600
commite4018a7008da265b9d642dcb5039ab7eeb2026d2 (patch)
tree2d00b4d15748e9569b195e57a287ba96aac996d6 /build
parent19a6844cafd84cff79f5df08f7a9f08504f67e70 (diff)
downloadskyblock-api-e4018a7008da265b9d642dcb5039ab7eeb2026d2.tar.gz
skyblock-api-e4018a7008da265b9d642dcb5039ab7eeb2026d2.tar.bz2
skyblock-api-e4018a7008da265b9d642dcb5039ab7eeb2026d2.zip
actually fix cache
Diffstat (limited to 'build')
-rw-r--r--build/constants.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/build/constants.js b/build/constants.js
index 5e09240..961e998 100644
--- a/build/constants.js
+++ b/build/constants.js
@@ -57,6 +57,7 @@ async function fetchFile(path) {
sha: data.sha
};
fileCache.set(path, file);
+ return file;
}
/**
* Edit a file on skyblock-constants
@@ -65,13 +66,18 @@ async function fetchFile(path) {
* @param newContent The new content in the file
*/
async function editFile(file, message, newContent) {
- fileCache.set(file.path, newContent);
- await fetchGithubApi('PUT', `/repos/${owner}/${repo}/contents/${file.path}`, { 'Content-Type': 'application/json' }, {
+ const r = await fetchGithubApi('PUT', `/repos/${owner}/${repo}/contents/${file.path}`, { 'Content-Type': 'application/json' }, {
message: message,
content: Buffer.from(newContent).toString('base64'),
sha: file.sha,
branch: 'main'
});
+ const data = await r.json();
+ fileCache.set(file.path, {
+ path: data.content.path,
+ content: newContent,
+ sha: data.content.sha
+ });
}
/** Fetch all the known SkyBlock stats as an array of strings */
async function fetchStats() {