Skip to content

Commit

Permalink
Loading and logging fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Jun 28, 2024
1 parent 14d6278 commit 7a26cc5
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 13 deletions.
7 changes: 3 additions & 4 deletions apps/app/layout/app.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,15 @@
ws.onclose = (e) => {
console.log("Socket is closed. Reconnecting...", e.reason)
setTimeout(() => {
if (retries == 3) {
sessionStorage.clear()
location.reload()
if (retries == 10) {
retries = 0
}
connectToWSServer()
console.log(`Reconnecting... (Retry #${retries + 1})`)
retries++
}, 1000)
}, 1000 * retries)
}
}
Expand Down
8 changes: 8 additions & 0 deletions packages/ui/navigation/desktopLoading.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<li>
Make sure the Cores Service is running: <button class="underline" on:click={startService}>Launch service</button>
</li>
<li>
Restart Cores: <button class="underline" on:click={reload}>Restart</button>
</li>
</ul>
</div>
</div>
Expand All @@ -24,6 +27,11 @@
await invoke("start_service")
}
const reload = () => {
sessionStorage.clear()
location.reload()
}
onMount(async () => {
try {
// Check if service is running
Expand Down
13 changes: 10 additions & 3 deletions packages/ui/navigation/loading.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
</div>

<h1>Loading...</h1>
<div class="transparent-900 m-3 my-10 rounded-xl p-8 text-left">
<div class="error transparent-900 m-3 my-10 hidden rounded-xl border-2 border-red-700 p-8 text-left">
<h2 class="mb-5">App not loading?</h2>
<ul class="list-inside list-disc">
<li>The connection might be slow, try waiting a few seconds</li>
<li>
Try to <button class="underline" on:click={reload}>Refresh</button> this page
</li>
<li>Restart your Cores app</li>
<li>Restart your Cores app on your computer</li>
<li>
Make sure you typed in the <button class="underline" on:click={connectionCode}>connection code</button> in the settings right
Make sure the <button class="underline" on:click={connectionCode}>connection code</button> in the settings is correct
</li>
<li>
Go back to the <a class="underline" href="/">home</a> page
Expand All @@ -34,4 +35,10 @@
const connectionCode = () => {
location.href = "/settings"
}
onMount(() => {
setInterval(() => {
document.querySelector(".error").classList.remove("hidden")
}, 5000)
})
</script>
9 changes: 5 additions & 4 deletions packages/ui/pages/onboarding.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<div class="flex flex-col gap-3">
<button
on:click={() => {
router.goto("/home")
router.goto("/home", true)
}}
class="transparent-900 flex items-center justify-center gap-3 rounded-xl px-20 py-5 text-xl font-semibold shadow-md"
>
Expand All @@ -94,7 +94,7 @@
</button>
<button
on:click={() => {
router.goto("/connections")
router.goto("/connections", true)
}}
class="transparent-900 flex items-center justify-center gap-3 rounded-xl px-20 py-5 text-xl font-semibold shadow-md"
>
Expand All @@ -103,7 +103,7 @@
</button>
<button
on:click={() => {
router.goto("/settings")
router.goto("/settings", true)
}}
class="transparent-900 flex items-center justify-center gap-3 rounded-xl px-20 py-5 text-xl font-semibold shadow-md"
>
Expand All @@ -123,6 +123,7 @@
import { settings } from "../stores/settings.ts"
import { Popover } from "bits-ui"
import { flyAndScale } from "../utils/transitions.ts"
import build from "../../../build.json"
let trialOver = false
Expand Down Expand Up @@ -166,7 +167,7 @@
const options = {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ license_key: key.value, instance_name: "CoresDesktop" }),
body: JSON.stringify({ license_key: key.value, instance_name: `CoresDesktop-${build.number}` }),
}
try {
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/pages/settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@
])
if (ua.fullVersionList !== undefined && ua.fullVersionList.length > 0) {
chromium_version = ua.fullVersionList?.[0]?.version || "N/A"
// @ts-ignore
chromium_version = ua.fullVersionList.filter((item) => item.brand === "Chromium")[0]?.version || "N/A"
}
const systemInfo: SystemInfo = await invoke("system_info")
Expand Down
2 changes: 1 addition & 1 deletion platforms/windows/service/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static void Main(string[] args) {

Log.Logger = new LoggerConfiguration()
.WriteTo.Console()
.WriteTo.File("./cores-service.log")
.WriteTo.File(Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Cores", "service.log"))
.CreateLogger();

AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Expand Down

0 comments on commit 7a26cc5

Please sign in to comment.