Skip to content

Commit

Permalink
feats and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ElRakabawi committed Dec 15, 2022
1 parent b39c5bf commit 393c315
Show file tree
Hide file tree
Showing 12 changed files with 215 additions and 251 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"devDependencies": {
"@angablue/exe": "^1.1.6",
"@tauri-apps/cli": "^1.2.1",
"@tauri-apps/cli": "^1.2.2",
"@vitejs/plugin-vue": "^3.0.1",
"autoprefixer": "^10.4.12",
"chokidar": "^3.5.3",
Expand Down
24 changes: 23 additions & 1 deletion server/http-server.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const { Octokit } = require("@octokit/rest");
const octokit = new Octokit({ auth: process.env.FAKE_PAT })
const WebSocket = require('ws');

console.log(process.env.FAKE_PAT)

const fs = require('fs');
const path = require('path');
const os = require("os");
Expand Down Expand Up @@ -58,6 +60,19 @@ app.get('/getClientTree', async (req, res) => {
// fs.writeFileSync(`localMerkle.json`, tree, "utf-8");
})

app.get('/getVersions', async (req, res) => {
let respArray = await Promise.all([
getLauncherReleaseAssets(),
getClientReleaseAssets()
])
let launcherVersion = respArray[0].data.name
let clientVersion = respArray[1].data.name
res.status(200).json({
launcherVersion,
clientVersion
})
})


app.get('/isSynced', async (req, res) => {
// Get Release Assets IDs
Expand Down Expand Up @@ -155,6 +170,13 @@ async function getClientReleaseAssets() {
}))
}

async function getLauncherReleaseAssets() {
return (await octokit.rest.repos.getLatestRelease({
owner: 'station0x',
repo: 'FinalCypher-Launcher'
}))
}

async function getReleaseAsset(asset_id) {
return (await octokit.rest.repos.getReleaseAsset({
owner: 'station0x',
Expand Down Expand Up @@ -212,7 +234,7 @@ function syncClient({ remoteMapping, assetsMapping, localDiffs, releaseAssets })
connection.onmessage = async (event) => {
let data = JSON.parse(event.data)
console.log(data)
}
}
}


Expand Down
Loading

0 comments on commit 393c315

Please sign in to comment.