mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
patching user displayName and profileImageUrl
This commit is contained in:
parent
af69509c61
commit
59b2096d06
6 changed files with 33 additions and 10 deletions
|
|
@ -24,6 +24,7 @@ import "./library/remove-game";
|
|||
import "./library/remove-game-from-library";
|
||||
import "./misc/open-external";
|
||||
import "./misc/show-open-dialog";
|
||||
import "./misc/image-path-to-base-64";
|
||||
import "./torrenting/cancel-game-download";
|
||||
import "./torrenting/pause-game-download";
|
||||
import "./torrenting/resume-game-download";
|
||||
|
|
|
|||
14
src/main/events/misc/image-path-to-base-64.ts
Normal file
14
src/main/events/misc/image-path-to-base-64.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import mime from "mime";
|
||||
import { registerEvent } from "../register-event";
|
||||
import fs from "node:fs";
|
||||
|
||||
const imagePathToBase64 = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
filePath: string
|
||||
) => {
|
||||
const buffer = fs.readFileSync(filePath);
|
||||
const mimeType = mime.getType(filePath);
|
||||
return `data:${mimeType};base64,${buffer.toString("base64")}`;
|
||||
};
|
||||
|
||||
registerEvent("imagePathToBase64", imagePathToBase64);
|
||||
|
|
@ -4,12 +4,11 @@ import axios from "axios";
|
|||
import fs from "node:fs";
|
||||
import mime from "mime";
|
||||
|
||||
const patchUserProfile = (displayName: string, imageUrl?: string) => {
|
||||
return;
|
||||
if (imageUrl) {
|
||||
const patchUserProfile = (displayName: string, profileImageUrl?: string) => {
|
||||
if (profileImageUrl) {
|
||||
return HydraApi.patch("/profile", {
|
||||
displayName,
|
||||
imageUrl,
|
||||
profileImageUrl,
|
||||
});
|
||||
} else {
|
||||
return HydraApi.patch("/profile", {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue