Added auth for private servers #7

Merged
Philipp merged 30 commits from added-local-auth into main 2023-11-26 22:24:20 +01:00
Showing only changes of commit dd929af281 - Show all commits

View File

@ -114,14 +114,26 @@ async function postCode() {
let api; let api;
if (token) { if (token) {
api = new ScreepsAPI(login_arguments); api = new ScreepsAPI(login_arguments);
const response = await api.code.set(branch, files_to_push);
core.info(JSON.stringify(response, null, 2));
} else { } else {
core.info(`Logging into as user ${username}`); core.info(`Logging into as user ${username}`);
api = new ScreepsAPI(login_arguments); const response = Promise.resolve()
await api.auth(username, password); .then(() => api.auth(auth.email, auth.password))
.then(() => api.socket.connect())
.then(() => {
return api.code.set(branch, code); // Set the code on the specified branch
})
.then(() => {
console.log("Code set successfully");
// Additional actions after setting the code, if necessary
})
.catch((err) => {
console.error("Error:", err);
});
core.info("Authorized!"); core.info("Authorized!");
core.info(JSON.stringify(response, null, 2));
} }
const response = await api.code.set(branch, files_to_push);
core.info(JSON.stringify(response, null, 2));
} }
postCode(); postCode();