mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Authorize via steam for the puzzle api
This commit is contained in:
@@ -49,6 +49,30 @@ function listen() {
|
||||
|
||||
ipcMain.handle("steam:get-achievement-names", getAchievementNames);
|
||||
ipcMain.handle("steam:activate-achievement", activateAchievement);
|
||||
|
||||
function bufferToHex(buffer) {
|
||||
return Array.from(new Uint8Array(buffer))
|
||||
.map(b => b.toString(16).padStart(2, "0"))
|
||||
.join("");
|
||||
}
|
||||
|
||||
ipcMain.on("steam:get-ticket", (event, arg) => {
|
||||
console.log("Requested steam ticket ...");
|
||||
greenworks.getAuthSessionTicket(
|
||||
success => {
|
||||
const ticketHex = bufferToHex(success.ticket);
|
||||
event.reply("steam:ticket-success", ticketHex);
|
||||
},
|
||||
error => {
|
||||
console.error("Failed to get steam ticket:", error);
|
||||
event.reply("steam:ticket-error", "" + error);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
ipcMain.on("steam:check-app-ownership", (event, appId) => {
|
||||
event.reply(greenworks.isSubscribedApp(appId));
|
||||
});
|
||||
}
|
||||
|
||||
function isInitialized(event) {
|
||||
|
||||
Reference in New Issue
Block a user