Skip to content

Commit

Permalink
Format, change readme because it's all universal for macOS now
Browse files Browse the repository at this point in the history
  • Loading branch information
ezShroom committed Aug 26, 2024
1 parent e0a5db5 commit d936f4b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 30 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ Download the correct binary for your system from here, and run it.
| -------- | ------------ | --- | ----------------------------------------------------------------------------------------------- |
| Windows | x64 | GUI | [Download](https://github.com/lbryfoundation/bookbuddies/releases/download/windows-x64-gui.exe) |
| Windows | x64 | CLI | [Download](https://github.com/lbryfoundation/bookbuddies/releases/download/windows-x64-cli.exe) |
| macOS | x64 | GUI | [Download](https://github.com/lbryfoundation/bookbuddies/releases/download/macos-x64-gui) |
| macOS | x64 | CLI | [Download](https://github.com/lbryfoundation/bookbuddies/releases/download/macos-x64-cli) |
| macOS | arm64 | GUI | [Download](https://github.com/lbryfoundation/bookbuddies/releases/download/macos-arm64-gui) |
| macOS | arm64 | CLI | [Download](https://github.com/lbryfoundation/bookbuddies/releases/download/macos-arm64-cli) |
| macOS | Universal | GUI | [Download](https://github.com/lbryfoundation/bookbuddies/releases/download/macos-x64-gui) |
| macOS | Universal | CLI | [Download](https://github.com/lbryfoundation/bookbuddies/releases/download/macos-x64-cli) |
| Linux | x64 | GUI | [Download](https://github.com/lbryfoundation/bookbuddies/releases/download/linux-x64-gui) |
| Linux | x64 | CLI | [Download](https://github.com/lbryfoundation/bookbuddies/releases/download/linux-x64-cli) |
| Linux | arm64 | GUI | [Download](https://github.com/lbryfoundation/bookbuddies/releases/download/linux-arm64-gui) |
Expand Down
Binary file modified bun.lockb
Binary file not shown.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"@types/cli-progress": "^3.11.6",
"@types/eslint__js": "^8.42.3",
"@types/readline-sync": "^1.4.8",
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"eslint": "^9.9.1",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.3.3",
"typescript": "^5.5.4",
"typescript-eslint": "^8.2.0"
"typescript-eslint": "^8.3.0"
},
"scripts": {
"lint": "bun update && bun eslint --fix && bun prettier . -w && bun tsc --noEmit",
Expand All @@ -32,9 +32,9 @@
"app-root-path": "^3.1.0",
"cli-progress": "^3.12.0",
"colors": "^1.4.0",
"hono": "^4.5.8",
"hono": "^4.5.9",
"jszip": "^3.10.1",
"ora": "^8.0.1",
"ora": "^8.1.0",
"readline-sync": "^1.4.10"
}
}
38 changes: 19 additions & 19 deletions src/cli/settings/schema.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"version": { "type": "number", "minimum": 1, "maximum": 1 },
"storageSpace": { "type": "number", "minimum": 1 },
"username": { "type": "string" },
"sentry": { "type": "boolean" },
"advanced": {
"type": "object",
"properties": {
"rpcPort": { "type": "number", "minimum": 1024, "maximum": 65535 },
"udpPort": { "type": "number", "minimum": 1024, "maximum": 65535 },
"tcpPort": { "type": "number", "minimum": 1024, "maximum": 65535 }
},
"required": ["rpcPort", "udpPort", "tcpPort"]
}
},
"required": ["version", "storageSpace", "sentry", "advanced"]
}
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"version": { "type": "number", "minimum": 1, "maximum": 1 },
"storageSpace": { "type": "number", "minimum": 1 },
"username": { "type": "string" },
"sentry": { "type": "boolean" },
"advanced": {
"type": "object",
"properties": {
"rpcPort": { "type": "number", "minimum": 1024, "maximum": 65535 },
"udpPort": { "type": "number", "minimum": 1024, "maximum": 65535 },
"tcpPort": { "type": "number", "minimum": 1024, "maximum": 65535 }
},
"required": ["rpcPort", "udpPort", "tcpPort"]
}
},
"required": ["version", "storageSpace", "sentry", "advanced"]
}
15 changes: 12 additions & 3 deletions src/cli/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,17 @@ const requestSettings = async (
export default async (): Promise<Settings> => {
const settingsFile = await Bun.file('settings.json')
let requiresRequest = false
const settingsJson = await settingsFile.json().catch(() => requiresRequest = true)
if (!ajv.validate(await Bun.file(schema as unknown as string).json(), settingsJson)) requiresRequest = true
if (requiresRequest) return await requestSettings(settingsFile, await settingsFile.exists())
const settingsJson = await settingsFile
.json()
.catch(() => (requiresRequest = true))
if (
!ajv.validate(
await Bun.file(schema as unknown as string).json(),
settingsJson
)
)
requiresRequest = true
if (requiresRequest)
return await requestSettings(settingsFile, await settingsFile.exists())
return settingsJson
}

0 comments on commit d936f4b

Please sign in to comment.