Skip to content

Commit

Permalink
Merge pull request #40 from altmp/ALTV-691
Browse files Browse the repository at this point in the history
ALTV-691 Set dev branch for data and modules cdn resources
  • Loading branch information
OlegTrofimov authored Jan 28, 2025
2 parents 3969eff + 4f89bfe commit 0c3cf6b
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions bin/altv-pkg.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,16 @@ async function start() {
console.log(chalk.whiteBright(`Branch: `), chalk.yellowBright(branch));

let headers = undefined;
let downloadDataBranch = (branch.startsWith("ALTV-")) ? "dev" : branch;

const sharedFiles = {};
let res = await fetchJsonData(`https://${CDN_ADDRESS}/data/${branch}/update.json`, {
let res = await fetchJsonData(`https://${CDN_ADDRESS}/data/${downloadDataBranch}/update.json`, {
responseType: 'application/json',
headers,
});

for ([file, hash] of Object.entries(res.hashList)) {
sharedFiles[file] = `https://${CDN_ADDRESS}/data/${branch}/${file}`;
sharedFiles[file] = `https://${CDN_ADDRESS}/data/${downloadDataBranch}/${file}`;
}

const linuxFiles = { ...sharedFiles };
Expand All @@ -163,7 +164,7 @@ async function start() {
windowsFiles[file] = `https://${CDN_ADDRESS}/server/${branch}/x64_win32/${file}`;
}

const sharedUpdates = [`https://${CDN_ADDRESS}/data/${branch}/update.json`];
const sharedUpdates = [`https://${CDN_ADDRESS}/data/${downloadDataBranch}/update.json`];

const linuxUpdates = [
...sharedUpdates,
Expand All @@ -176,87 +177,87 @@ async function start() {
];

if (loadJSModule) {
res = await fetchJsonData(`https://${CDN_ADDRESS}/js-module/${branch}/x64_linux/update.json`, {
res = await fetchJsonData(`https://${CDN_ADDRESS}/js-module/${downloadDataBranch}/x64_linux/update.json`, {
responseType: 'application/json',
headers,
});
for ([file, hash] of Object.entries(res.hashList)) {
linuxFiles[file] = `https://${CDN_ADDRESS}/js-module/${branch}/x64_linux/${file}`;
linuxFiles[file] = `https://${CDN_ADDRESS}/js-module/${downloadDataBranch}/x64_linux/${file}`;
}

res = await fetchJsonData(`https://${CDN_ADDRESS}/js-module/${branch}/x64_win32/update.json`, {
res = await fetchJsonData(`https://${CDN_ADDRESS}/js-module/${downloadDataBranch}/x64_win32/update.json`, {
responseType: 'application/json',
headers,
});
for ([file, hash] of Object.entries(res.hashList)) {
windowsFiles[file] = `https://${CDN_ADDRESS}/js-module/${branch}/x64_win32/${file}`;
windowsFiles[file] = `https://${CDN_ADDRESS}/js-module/${downloadDataBranch}/x64_win32/${file}`;
}

linuxUpdates.push(`https://${CDN_ADDRESS}/js-module/${branch}/x64_linux/update.json`);
windowsUpdates.push(`https://${CDN_ADDRESS}/js-module/${branch}/x64_win32/update.json`);
linuxUpdates.push(`https://${CDN_ADDRESS}/js-module/${downloadDataBranch}/x64_linux/update.json`);
windowsUpdates.push(`https://${CDN_ADDRESS}/js-module/${downloadDataBranch}/x64_win32/update.json`);
}

if (loadBytecodeModule) {
res = await fetchJsonData(`https://${CDN_ADDRESS}/js-bytecode-module/${branch}/x64_linux/update.json`, {
res = await fetchJsonData(`https://${CDN_ADDRESS}/js-bytecode-module/${downloadDataBranch}/x64_linux/update.json`, {
responseType: 'application/json',
headers,
});
for ([file, hash] of Object.entries(res.hashList)) {
linuxFiles[file] = `https://${CDN_ADDRESS}/js-bytecode-module/${branch}/x64_linux/${file}`;
linuxFiles[file] = `https://${CDN_ADDRESS}/js-bytecode-module/${downloadDataBranch}/x64_linux/${file}`;
}

res = await fetchJsonData(`https://${CDN_ADDRESS}/js-bytecode-module/${branch}/x64_win32/update.json`, {
res = await fetchJsonData(`https://${CDN_ADDRESS}/js-bytecode-module/${downloadDataBranch}/x64_win32/update.json`, {
responseType: 'application/json',
headers,
});
for ([file, hash] of Object.entries(res.hashList)) {
windowsFiles[file] = `https://${CDN_ADDRESS}/js-bytecode-module/${branch}/x64_win32/${file}`;
windowsFiles[file] = `https://${CDN_ADDRESS}/js-bytecode-module/${downloadDataBranch}/x64_win32/${file}`;
}

linuxUpdates.push(`https://${CDN_ADDRESS}/js-bytecode-module/${branch}/x64_linux/update.json`);
windowsUpdates.push(`https://${CDN_ADDRESS}/js-bytecode-module/${branch}/x64_win32/update.json`);
linuxUpdates.push(`https://${CDN_ADDRESS}/js-bytecode-module/${downloadDataBranch}/x64_linux/update.json`);
windowsUpdates.push(`https://${CDN_ADDRESS}/js-bytecode-module/${downloadDataBranch}/x64_win32/update.json`);
}

if (loadCSharpModule) {
res = await fetchJsonData(`https://${CDN_ADDRESS}/coreclr-module/${branch}/x64_linux/update.json`, {
res = await fetchJsonData(`https://${CDN_ADDRESS}/coreclr-module/${downloadDataBranch}/x64_linux/update.json`, {
responseType: 'application/json',
headers,
});
for ([file, hash] of Object.entries(res.hashList)) {
linuxFiles[file] = `https://${CDN_ADDRESS}/coreclr-module/${branch}/x64_linux/${file}`;
linuxFiles[file] = `https://${CDN_ADDRESS}/coreclr-module/${downloadDataBranch}/x64_linux/${file}`;
}

res = await fetchJsonData(`https://${CDN_ADDRESS}/coreclr-module/${branch}/x64_win32/update.json`, {
res = await fetchJsonData(`https://${CDN_ADDRESS}/coreclr-module/${downloadDataBranch}/x64_win32/update.json`, {
responseType: 'application/json',
headers,
});
for ([file, hash] of Object.entries(res.hashList)) {
windowsFiles[file] = `https://${CDN_ADDRESS}/coreclr-module/${branch}/x64_win32/${file}`;
windowsFiles[file] = `https://${CDN_ADDRESS}/coreclr-module/${downloadDataBranch}/x64_win32/${file}`;
}

linuxUpdates.push(`https://${CDN_ADDRESS}/coreclr-module/${branch}/x64_linux/update.json`);
windowsUpdates.push(`https://${CDN_ADDRESS}/coreclr-module/${branch}/x64_win32/update.json`);
linuxUpdates.push(`https://${CDN_ADDRESS}/coreclr-module/${downloadDataBranch}/x64_linux/update.json`);
windowsUpdates.push(`https://${CDN_ADDRESS}/coreclr-module/${downloadDataBranch}/x64_win32/update.json`);
}

if (loadJSV2Module) {
res = await fetchJsonData(`https://${CDN_ADDRESS}/js-module-v2/${branch}/x64_linux/update.json`, {
res = await fetchJsonData(`https://${CDN_ADDRESS}/js-module-v2/${downloadDataBranch}/x64_linux/update.json`, {
responseType: 'application/json',
headers,
});
for ([file, hash] of Object.entries(res.hashList)) {
linuxFiles[file] = `https://${CDN_ADDRESS}/js-module-v2/${branch}/x64_linux/${file}`;
linuxFiles[file] = `https://${CDN_ADDRESS}/js-module-v2/${downloadDataBranch}/x64_linux/${file}`;
}

res = await fetchJsonData(`https://${CDN_ADDRESS}/js-module-v2/${branch}/x64_win32/update.json`, {
res = await fetchJsonData(`https://${CDN_ADDRESS}/js-module-v2/${downloadDataBranch}/x64_win32/update.json`, {
responseType: 'application/json',
headers,
});
for ([file, hash] of Object.entries(res.hashList)) {
windowsFiles[file] = `https://${CDN_ADDRESS}/js-module-v2/${branch}/x64_win32/${file}`;
windowsFiles[file] = `https://${CDN_ADDRESS}/js-module-v2/${downloadDataBranch}/x64_win32/${file}`;
}

linuxUpdates.push(`https://${CDN_ADDRESS}/js-module-v2/${branch}/x64_linux/update.json`);
windowsUpdates.push(`https://${CDN_ADDRESS}/js-module-v2/${branch}/x64_win32/update.json`);
linuxUpdates.push(`https://${CDN_ADDRESS}/js-module-v2/${downloadDataBranch}/x64_linux/update.json`);
windowsUpdates.push(`https://${CDN_ADDRESS}/js-module-v2/${downloadDataBranch}/x64_win32/update.json`);
}

if (loadVoiceServer) {
Expand Down

0 comments on commit 0c3cf6b

Please sign in to comment.