From 2198b341117c894ba0eefecf05195dcc1b691f15 Mon Sep 17 00:00:00 2001 From: familyfriendlymikey Date: Tue, 16 Aug 2022 01:38:43 -0400 Subject: [PATCH] improve initial page visit load time --- app/client.imba | 17 ++++++++++------- package.json | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/client.imba b/app/client.imba index 08b31c2..17933d9 100644 --- a/app/client.imba +++ b/app/client.imba @@ -37,22 +37,24 @@ tag app def mount try await reload_db! - p "load db success" p state.links catch e err "loading database", e fatal_error = yes return unless global.localStorage.fuzzyhome_visited - await add_initial_links! + add_initial_links! global.localStorage.fuzzyhome_visited = yes await load_config! def add_initial_links - await add_link { name: "help", url: "github.com/familyfriendlymikey/fuzzyhome" } - await add_link { name: "google", url: "google.com" } - await add_link { name: "youtube", url: "youtube.com" } - await add_link { name: "3000", url: "localhost:3000" } + add_link { name: "github", url: "https://github.com/familyfriendlymikey" } + add_link { name: "google", url: "google.com" } + add_link { name: "youtube", url: "youtube.com" } + add_link { name: "photopea", url: "photopea.com" } + add_link { name: "twitch", url: "twitch.tv" } + add_link { name: "messenger", url: "messenger.com" } + add_link { name: "instagram", url: "instagram.com" } def validate_config throw 'config error' unless config..search_engine.hasOwnProperty 'url' @@ -155,7 +157,7 @@ tag app def strip_url url url.trim!.replace(/(^\w+:|^)\/\//, '') - def add_link { url, name, frequency=1 } + def add_link { url, name, frequency=0 } name = name.trim! url = strip_url url let img = await fetch_image_as_base_64(url) @@ -166,6 +168,7 @@ tag app await reload_db! catch e err "adding link", e + imba.commit! def handle_click_link link await increment_link_frequency link diff --git a/package.json b/package.json index 05783a6..4703e90 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fuzzyhome", - "version": "0.1.28", + "version": "0.1.29", "scripts": { "start": "imba run -SMH --baseurl . -w server.imba", "build-app": "rm -rf dist && imba build -SMH --baseurl . server.imba",