mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-20 09:43:57 +00:00
patching user displayName and profileImageUrl
This commit is contained in:
@@ -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", {
|
||||
|
||||
Reference in New Issue
Block a user