Skip to content
This repository has been archived by the owner on Jul 21, 2024. It is now read-only.

Commit

Permalink
[App] Set version
Browse files Browse the repository at this point in the history
[Core] Fix base64 parsing
  • Loading branch information
OzymandiasTheGreat committed Jul 14, 2022
1 parent 1de122a commit bda8330
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apps/app/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"expo": {
"name": "Void",
"slug": "Void",
"version": "1.0.0",
"version": "0.1.0-alpha1",
"scheme": "screamingvoid",
"orientation": "portrait",
"icon": "./assets/icon.png",
Expand Down
2 changes: 1 addition & 1 deletion apps/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "void",
"version": "1.0.0",
"version": "0.1.0-alpha1",
"scripts": {
"android": "expo run:android",
"ios": "expo run:ios",
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "Void",
"version": "0.1.0"
"version": "0.1.0-alpha1"
},
"tauri": {
"allowlist": {
Expand Down
2 changes: 0 additions & 2 deletions apps/app/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,6 @@ export class VoidInterface extends EventEmitter2 {
data.bio,
data.avatar
);
// TODO DELETEME
this.core.onAny(console.log);
this.subscribe();
await RNFS.writeFile(
path.join(AVATARS, data.publicKey),
Expand Down
18 changes: 14 additions & 4 deletions packages/core/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,21 @@ export async function uriToImage(uri: string): Promise<Buffer> {
const base64 = uri.slice(uri.indexOf(","));
data = Buffer.from(base64, "base64");
} else {
mimetype = mimetypes.lookup(uri) as string;
if (!mimetype) {
return Buffer.alloc(0);
if (
await fs
.access(uri)
.then(() => true)
.catch(() => false)
) {
mimetype = mimetypes.lookup(uri) as string;
if (!mimetype) {
return Buffer.alloc(0);
}
data = await fs.readFile(uri);
} else {
mimetype = "image/jpeg";
data = Buffer.from(uri, "base64");
}
data = await fs.readFile(uri);
}
return Image.encode({ mimetype, data });
}
Expand Down

0 comments on commit bda8330

Please sign in to comment.