diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 824e52b..3920010 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,5 +1,12 @@ # Change Log +## [Version 1.1.1] + +- changed auth condition +- refactor image loader for notification images +- added constant for yup app base url +- other cleanups + ## [Version 1.0.9] - added: browser notifications(work similar to push notifications) for comment, mention, follow with the ability to open the notification in app diff --git a/manifest.json b/manifest.json index 1ff1746..431c0e1 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "yup live", "description": "Light alternative extension for yup protocol", - "version": "1.0.9", + "version": "1.1.1", "manifest_version": 3, "icons": { "16": "src/assets/icons/yup_ext_16.png", diff --git a/package.json b/package.json index bcd6a22..bb51c5c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "yup-live-browser-extension", "description": "Yup Live Browser Extension", - "version": "1.0.9", + "version": "1.1.0", "type": "module", "author": "andrei0x309", "license": "MIT", diff --git a/src/background/index.ts b/src/background/index.ts index e52f91d..c5c4868 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -9,6 +9,7 @@ import { setBadge, extrenalNavigate } from '@/utils/chrome-misc' import { closeTo } from '@/utils/time'; import { getActionUsage } from '@/utils/user'; import { executeVote, getVotePayload } from '@/utils/votes'; +import { YUP_APP_BASE } from '@/constants/config'; // Disable conflict with yup extension const yupExtensionId = 'nhmeoaahigiljjdkoagafdccikgojjoi' @@ -25,7 +26,7 @@ const buttons = { const notificationActionListner = async (id: string) => { try { - const url = new URL(notificationUrl ?? 'https://app.yup.io/notifications') + const url = new URL(notificationUrl ?? `${YUP_APP_BASE}/notifications`) extrenalNavigate(url.href) chrome.notifications.clear(id) } catch { @@ -124,7 +125,7 @@ const alarmHandler = async () => { if (store?.settings.notificationsEnabled) { try { const notifications = await requests.notifications as Notification[] - const notSeen = notifications.reverse().filter(notif => !notif.seen) + const notSeen = notifications.filter(notif => !notif.seen) const updateSettings = {} as Record if (notSeen.length > 0) { setBadge(String(notSeen.length)) @@ -217,7 +218,7 @@ const alarmHandler = async () => { chrome.alarms.create( 'alarm', { - periodInMinutes: 1, + periodInMinutes: 0.1, }, ) @@ -252,7 +253,7 @@ chrome.contextMenus.onClicked.addListener(async (info, tab) => { chrome.runtime.onMessage.addListener(async (request, sender, sendResponse) => { try { - console.log('Message received', request) + // console.log('Message received', request) const lastLoginNotifTime = Number(await getSetting('lastLoginNotif')) const moreThanOneDay = (new Date().getTime() - lastLoginNotifTime) > 864e5 if (request.type === SEND_AUTH_NOTIF && moreThanOneDay) { diff --git a/src/client/inject.ts b/src/client/inject.ts index a0e0b38..2b676e9 100644 --- a/src/client/inject.ts +++ b/src/client/inject.ts @@ -35,8 +35,6 @@ class WebCommunicator { const allowRegex = /^((http:|https:))?([/][/])?(www.)?[a-zA-Z\-_0-9]{0,}\.?[a-zA-Z\-_0-9]{0,}(yup.info.gf|yup-live.pages.dev|.yup.io|yup-team.vercel.app|localhost\/|localhost:)(.*)/gm const isAllowed = allowRegex.test(window.location.href) -console.log('isAllowed', isAllowed) - if(isAllowed) { new WebCommunicator(true) } else { diff --git a/src/components/ImgLoader.svelte b/src/components/ImgLoader.svelte index c0d6d05..06c62a5 100644 --- a/src/components/ImgLoader.svelte +++ b/src/components/ImgLoader.svelte @@ -3,9 +3,9 @@ export let source - let loading = true - let loaded = false - let error = false + export let loading = true + export let loaded = false + export let error = false export const onLoad = () => { loading = false diff --git a/src/components/Notification.svelte b/src/components/Notification.svelte index 4bd102f..7b9c942 100644 --- a/src/components/Notification.svelte +++ b/src/components/Notification.svelte @@ -6,10 +6,10 @@ import { chromeUrl } from "@/utils/chrome-misc"; import { extrenalNavigate } from "@/utils/chrome-misc"; import LikeIcon from '@/components/LikeIcon.svelte'; + import { YUP_APP_BASE } from "@/constants/config"; - let loader; - const appBase = "https://app.yup.io"; + let loader; export let notif: Notification; @@ -35,7 +35,7 @@

extrenalNavigate(`${appBase}/post/${notif.meta.postid}`)} + on:click={() => extrenalNavigate(`${YUP_APP_BASE}/post/${notif.meta.postid}`)} aria-hidden class="text-blue-200 interactive-svg">{finalUrl} @@ -73,11 +73,12 @@

{#each notif.senders as sender}
- + + loader.onLoad()} - on:error={() => loader.onError()} + on:load={() => { loader.loaded = true; loader.loading = false; }} + on:error={() => { loader.error = true; loader.loading = false; }} style={$mainStore.settings.theme === "light" ? "filter: invert(0.9);" : ""} slot="img" src={sender.avatar} @@ -107,7 +108,7 @@

extrenalNavigate(`${appBase}/account/${sender?._id}`)} + on:click={() => extrenalNavigate(`${YUP_APP_BASE}/account/${sender?._id}`)} > {sender?.handle || `${sender?._id?.slice(0, 6)}...`} followed you. @@ -151,6 +152,8 @@ border-radius: 6px; margin-left: 0.5rem; margin-top: 0.5rem; + border: 1px solid rgba(0, 0, 0, 0.233); + background-image: linear-gradient(rgba(0, 0, 0, 0.123), rgba(0, 0, 0, 0.123)); } .notifBody { diff --git a/src/components/RateWebsite.svelte b/src/components/RateWebsite.svelte index 558a469..73954b8 100644 --- a/src/components/RateWebsite.svelte +++ b/src/components/RateWebsite.svelte @@ -40,7 +40,9 @@ $: {

- loader.onLoad()} on:error={() => loader.onError} + loader.onLoad()} + on:error={() => loader.onError} class="w-5 h-5 mt-2 rounded-full wicon" src="{tab?.favIconUrl ?? ''}" alt="favicon" /> diff --git a/src/constants/config.ts b/src/constants/config.ts index 9844b9a..a63894f 100644 --- a/src/constants/config.ts +++ b/src/constants/config.ts @@ -1,4 +1,2 @@ export const API_BASE = 'https://api.yup.io' -export const DEV_BASE = 'http://localhost:4566' -export const YUP_LIVE_BASE = 'https://app.yup.io' -export const APP_BASE = YUP_LIVE_BASE \ No newline at end of file +export const YUP_APP_BASE = 'https://app.yup.io' \ No newline at end of file diff --git a/src/pages/Entry.svelte b/src/pages/Entry.svelte index ccdd3a5..5e89ef8 100644 --- a/src/pages/Entry.svelte +++ b/src/pages/Entry.svelte @@ -6,7 +6,7 @@ import { navigate } from '@/utils/router' import { mainStore } from '@/utils/store' // https://yup-live.pages.dev - import { APP_BASE } from '@/constants/config' + import { YUP_APP_BASE } from '@/constants/config' import Alert from '@/components/Alert.svelte' import { alertStore } from '@/utils/store' import PageLoader from "@/components/PageLoader.svelte"; @@ -29,7 +29,7 @@ onMount(async () => { store = await getStore() alertStore.set(alert) - auth = store?.user?.auth?.userId ?? false + auth = store?.user?.auth?.authToken ?? false if(auth){ await mainStore.set(store) await navigate('/') @@ -45,7 +45,7 @@
- +

YUP

diff --git a/src/pages/Info.svelte b/src/pages/Info.svelte index cb46e8d..2095108 100644 --- a/src/pages/Info.svelte +++ b/src/pages/Info.svelte @@ -2,13 +2,14 @@ import { onMount } from 'svelte'; import PageLoader from '@/components/PageLoader.svelte'; import { getExtensionVersion, extrenalNavigate } from '@/utils/chrome-misc'; + import { YUP_APP_BASE } from '@/constants/config'; let loading = true; let version = ''; const extensionSourceLink = 'https://github.com/andrei0x309/yup-live-chrome-extension' const yupLiveSourceLink = 'https://github.com/andrei0x309/yup-live' const yupLiveLink = 'https://yup-live.pages.dev' - const yupAppLink = 'https://app.yup.io' + const yupAppLink = YUP_APP_BASE const discordLink = 'https://discord.com/invite/HnaTAXK' const yupForumLink = 'https://forum.yup.io' const yupDocsLink = 'https://docs.yup.io' diff --git a/src/pages/Login.svelte b/src/pages/Login.svelte index 2f6323f..e41c9e1 100644 --- a/src/pages/Login.svelte +++ b/src/pages/Login.svelte @@ -1,20 +1,20 @@ -
extrenalNavigate(`${APP_BASE}/login`)}> + extrenalNavigate(`${YUP_APP_BASE}/login`)}> - + diff --git a/src/pages/Main.svelte b/src/pages/Main.svelte index bba5a67..55f37f8 100644 --- a/src/pages/Main.svelte +++ b/src/pages/Main.svelte @@ -2,7 +2,7 @@ import { extrenalNavigate } from "@/utils/chrome-misc"; import ImgLoader from "@/components/ImgLoader.svelte"; import { onMount } from "svelte"; - import { APP_BASE } from "@/constants/config"; + import { YUP_APP_BASE } from "@/constants/config"; import RateWebsite from "@/components/RateWebsite.svelte"; import { mainStore } from "@/utils/store"; import { formatNumber, truncteEVMAddr } from "@/utils/misc"; @@ -19,7 +19,6 @@ }; onMount(async () => { - console.log($mainStore); if ($mainStore?.user?.profile?.yup?.avatar && !$mainStore?.user?.profile?.yup?.avatar.endsWith(".mp4")) { avatar = $mainStore?.user?.profile?.yup?.avatar; } else if ($mainStore?.user?.profile?.lens?.avatar && !$mainStore?.user?.profile?.lens?.avatar.endsWith(".mp4")) { @@ -41,7 +40,7 @@ >{$mainStore?.user?.profile?.yupScore?.toFixed(0)}100
MAX
-
extrenalNavigate(`${APP_BASE}/account/${$mainStore.user.auth.userId}`)} aria-hidden class="flex flex-col justify-center mb-1 w-16"> +
extrenalNavigate(`${YUP_APP_BASE}/account/${$mainStore.user.auth.userId}`)} aria-hidden class="flex flex-col justify-center mb-1 w-16"> { }) pastNotifsPromise = getNotifStorage() - console.log(notifs); loading = false; clearNotifications($mainStore).then( () => { diff --git a/src/pages/Settings.svelte b/src/pages/Settings.svelte index 3eb5c61..7fa5fde 100644 --- a/src/pages/Settings.svelte +++ b/src/pages/Settings.svelte @@ -45,7 +45,6 @@ const setSettingsLocal = async (setting: string, value = '') => { onMount(async () => { settings = $mainStore.settings - console.log(settings) }); diff --git a/src/utils/storage.ts b/src/utils/storage.ts index 0bbdf17..15c054a 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -68,8 +68,6 @@ export const lastRewardNotifDefault = { id: '', } - - export type StorageType = typeof storageDefault export const wipeStorage = async () => {