mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
Frontend fixes/improvements (#2950)
* fix Tor logs actually fetching od logs * chore: switch from `mime-types` to `mime` for browser environment support (#2951) * change V2 s9pk title to Legacy * show warning for domains when not public, disable launch too --------- Co-authored-by: Alex Inkin <alexander@inkin.ru> Co-authored-by: Mariusz Kogen <k0gen@pm.me>
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
PackageId,
|
||||
} from "../osBindings"
|
||||
import { ArrayBufferReader, MerkleArchive } from "./merkleArchive"
|
||||
import mime from "mime-types"
|
||||
import mime from "mime"
|
||||
import { DirectoryContents } from "./merkleArchive/directoryContents"
|
||||
import { FileContents } from "./merkleArchive/fileContents"
|
||||
|
||||
@@ -60,14 +60,13 @@ export class S9pk {
|
||||
async icon(): Promise<DataUrl> {
|
||||
const iconName = Object.keys(this.archive.contents.contents).find(
|
||||
(name) =>
|
||||
name.startsWith("icon.") &&
|
||||
(mime.contentType(name) || null)?.startsWith("image/"),
|
||||
name.startsWith("icon.") && mime.getType(name)?.startsWith("image/"),
|
||||
)
|
||||
if (!iconName) {
|
||||
throw new Error("no icon found in archive")
|
||||
}
|
||||
return (
|
||||
`data:${mime.contentType(iconName)};base64,` +
|
||||
`data:${mime.getType(iconName)};base64,` +
|
||||
Buffer.from(
|
||||
await this.archive.contents.getPath([iconName])!.verifiedFileContents(),
|
||||
).toString("base64")
|
||||
@@ -91,12 +90,11 @@ export class S9pk {
|
||||
if (!dir || !(dir.contents instanceof DirectoryContents)) return null
|
||||
const iconName = Object.keys(dir.contents.contents).find(
|
||||
(name) =>
|
||||
name.startsWith("icon.") &&
|
||||
(mime.contentType(name) || null)?.startsWith("image/"),
|
||||
name.startsWith("icon.") && mime.getType(name)?.startsWith("image/"),
|
||||
)
|
||||
if (!iconName) return null
|
||||
return (
|
||||
`data:${mime.contentType(iconName)};base64,` +
|
||||
`data:${mime.getType(iconName)};base64,` +
|
||||
Buffer.from(
|
||||
await dir.contents.getPath([iconName])!.verifiedFileContents(),
|
||||
).toString("base64")
|
||||
|
||||
Reference in New Issue
Block a user