changes: for v1.0.3

This commit is contained in:
Andrei O 2023-02-18 00:12:40 +02:00
parent b5698da0a8
commit 181cd565db
No known key found for this signature in database
GPG Key ID: B961E5B68389457E
8 changed files with 37 additions and 31 deletions

View File

@ -1,5 +1,14 @@
# Change Log # Change Log
## [Version 1.0.3]
- change some user error messages
- case detection if there's no active tab
- always show rating website even if tab is not active
- change header to fixed size to not overflow if extension is installed on a mobile device
- added link to mobile APP version of yup live
- replaced seting for notification when refil to auto refill if you are online
## [Version 1.0.2] ## [Version 1.0.2]
- small url fix - small url fix

View File

@ -1,7 +1,7 @@
{ {
"name": "yup live", "name": "yup live",
"description": "Light alternative extension for yup protocol", "description": "Light alternative extension for yup protocol",
"version": "1.0.2", "version": "1.0.3",
"manifest_version": 3, "manifest_version": 3,
"icons": { "icons": {
"16": "src/assets/icons/yup_ext_16.png", "16": "src/assets/icons/yup_ext_16.png",

View File

@ -60,6 +60,7 @@ const alarmHandler = async () => {
setBadge('') setBadge('')
updateSettings.hasNewNotifications = false updateSettings.hasNewNotifications = false
} }
setSettings(updateSettings).catch(console.error)
if (store.settings?.chromeNotifWhenReward && notSeen.some(notif => notif.action === 'reward')) { if (store.settings?.chromeNotifWhenReward && notSeen.some(notif => notif.action === 'reward')) {
const rewardNotif = notSeen.find(notif => notif.action === 'reward') const rewardNotif = notSeen.find(notif => notif.action === 'reward')
@ -82,23 +83,9 @@ const alarmHandler = async () => {
} }
if (store.settings?.chromeNotifWhenAbleToVote) { if (store.settings?.chromeNotifWhenAbleToVote) {
const lastReset = (await getActionUsage(store?.user?.auth?.userId))?.data?.lastReset await getActionUsage(store?.user?.auth?.userId)
const storeTs = store?.settings?.refilNotifTimestamp ?? 0 }
if (lastReset) {
const isReset = getTimeRemaining(lastReset).total <= 0;
if (!closeTo(new Date(lastReset), new Date(storeTs), 36e5) && isReset) {
updateSettings.refilNotifTimestamp = lastReset
chrome.notifications.create({
type: 'basic',
iconUrl: chrome.runtime.getURL('src/assets/icons/yup_ext_128.png'),
title: 'Yup Live Extension',
message: `You can curate now again`,
})
}
}
}
setSettings(updateSettings).catch(console.error)
} catch (error) { } catch (error) {
console.error('Error fetching notifications', error) console.error('Error fetching notifications', error)
} }

View File

@ -7,7 +7,7 @@
import { isUrlInvalid } from '@/utils/misc'; import { isUrlInvalid } from '@/utils/misc';
let tab = null let tab = null
let url let url = new URL('http://127.0.0.1')
let isValid = true let isValid = true
let loading = true let loading = true
let loader: ImgLoader let loader: ImgLoader
@ -16,11 +16,14 @@
tab = (await getCurrentTab())[0] tab = (await getCurrentTab())[0]
isValid = !isUrlInvalid(tab?.url) isValid = !isUrlInvalid(tab?.url)
try { try {
url = new URL(tab.url) if(tab?.url) {
} catch (error) { url = new URL(tab?.url)
console.log(error) } else {
isValid = false
}
} catch {
isValid = false
} }
console.log(url)
loading = false loading = false
}) })
@ -32,14 +35,13 @@ $: {
</script> </script>
{#if tab}
<div class="{`flex flex-col ${loading ? 'animate-pulse' :''}`}"> <div class="{`flex flex-col ${loading ? 'animate-pulse' :''}`}">
{#if url} {#if url}
<div class="flex items-center flex-col text-[0.8rem] leading-4 mb-4"> <div class="flex items-center flex-col text-[0.8rem] leading-4 mb-4">
<div class="mb relative"> <div class="mb relative">
<ImgLoader source={tab.favIconUrl} bind:this={loader}> <ImgLoader source={tab?.favIconUrl ?? ''} bind:this={loader}>
<img style="{ $mainStore.settings.theme === 'light'? 'filter: invert(0.9);' : '' }" slot="img" on:load={() => loader.onLoad()} on:error={() => loader.onError} <img style="{ $mainStore.settings.theme === 'light'? 'filter: invert(0.9);' : '' }" slot="img" on:load={() => loader.onLoad()} on:error={() => loader.onError}
class="w-5 h-5 mt-2 rounded-full wicon" src="{tab.favIconUrl}" alt="favicon" /> class="w-5 h-5 mt-2 rounded-full wicon" src="{tab?.favIconUrl ?? ''}" alt="favicon" />
<svg class="w-5 h-5 mt-2 rounded-full wicon" style="{ $mainStore.settings.theme === 'light'? 'filter: invert(0.9);' : '' }" slot="error" viewBox="0 0 512 512"><g><polygon points="40,38.999 40,468.998 215,293.998 270,348.998 360,258.998 470,358.998 470,38.999 " style="fill:#EFF3F6;"/> <svg class="w-5 h-5 mt-2 rounded-full wicon" style="{ $mainStore.settings.theme === 'light'? 'filter: invert(0.9);' : '' }" slot="error" viewBox="0 0 512 512"><g><polygon points="40,38.999 40,468.998 215,293.998 270,348.998 360,258.998 470,358.998 470,38.999 " style="fill:#EFF3F6;"/>
<g><circle cx="150" cy="158.999" r="40" style="fill:#FCD884;"/></g><g><polygon points="470,358.998 470,468.998 385,468.998 385,463.998 270,348.998 360,258.998 " style="fill:#70993F;"/></g><g><polygon points="385,463.998 385,468.998 40,468.998 215,293.998 270,348.998" style="fill:#80AF52;"/></g></g><g/></svg> <g><circle cx="150" cy="158.999" r="40" style="fill:#FCD884;"/></g><g><polygon points="470,358.998 470,468.998 385,468.998 385,463.998 270,348.998 360,258.998 " style="fill:#70993F;"/></g><g><polygon points="385,463.998 385,468.998 40,468.998 215,293.998 270,348.998" style="fill:#80AF52;"/></g></g><g/></svg>
</ImgLoader> </ImgLoader>
@ -49,14 +51,18 @@ $: {
<h1 class="inline-flex text-[1.1rem] font-semibold mb-2">Invalid URL</h1> <h1 class="inline-flex text-[1.1rem] font-semibold mb-2">Invalid URL</h1>
{/if} {/if}
</div> </div>
{#if url.hostname !== '127.0.0.1'}
<span>Hostname: {url.hostname.length > 18 ? url.hostname.slice(0,16) + '...': url.hostname }</span> <span>Hostname: {url.hostname.length > 18 ? url.hostname.slice(0,16) + '...': url.hostname }</span>
<span>URL: {url.href.length > 20 ? '...' + url.href.slice(-20) : url.href}</span> <span>URL: {url.href.length > 20 ? '...' + url.href.slice(-20) : url.href}</span>
{:else}
<span>Hostname: No Active Tab</span>
<span>URL: No Active Tab</span>
{/if}
</div> </div>
{/if} {/if}
<RateSingle url={url.href.replace(/\/$/gms, '') ?? ''} disabled={!isValid} /> <RateSingle url={url.href.replace(/\/$/gms, '') ?? ''} disabled={!isValid} />
</div> </div>
{/if}
<style> <style>
.wicon { .wicon {

View File

@ -131,7 +131,7 @@
.logo { .logo {
left: 0rem; left: 0rem;
top: -0.8rem; top: -0.8rem;
width: 100%; width: 250px;
box-shadow: inset 3px -3px 6rem 11px #0000005e; box-shadow: inset 3px -3px 6rem 11px #0000005e;
border-bottom: 1px solid #d3d9df63; border-bottom: 1px solid #d3d9df63;
} }

View File

@ -12,6 +12,7 @@
const discordLink = 'https://discord.com/invite/HnaTAXK' const discordLink = 'https://discord.com/invite/HnaTAXK'
const yupForumLink = 'https://forum.yup.io' const yupForumLink = 'https://forum.yup.io'
const yupDocsLink = 'https://docs.yup.io' const yupDocsLink = 'https://docs.yup.io'
const yupLiveAndroid = 'https://play.google.com/store/apps/details?id=gf.info.yup'
onMount(async () => { onMount(async () => {
version = getExtensionVersion(); version = getExtensionVersion();
@ -41,6 +42,9 @@
<li><svg class="w-5 falign" viewBox="0 0 640 512" ><path fill="#fff" d="M524.531,69.836a1.5,1.5,0,0,0-.764-.7A485.065,485.065,0,0,0,404.081,32.03a1.816,1.816,0,0,0-1.923.91,337.461,337.461,0,0,0-14.9,30.6,447.848,447.848,0,0,0-134.426,0,309.541,309.541,0,0,0-15.135-30.6,1.89,1.89,0,0,0-1.924-.91A483.689,483.689,0,0,0,116.085,69.137a1.712,1.712,0,0,0-.788.676C39.068,183.651,18.186,294.69,28.43,404.354a2.016,2.016,0,0,0,.765,1.375A487.666,487.666,0,0,0,176.02,479.918a1.9,1.9,0,0,0,2.063-.676A348.2,348.2,0,0,0,208.12,430.4a1.86,1.86,0,0,0-1.019-2.588,321.173,321.173,0,0,1-45.868-21.853,1.885,1.885,0,0,1-.185-3.126c3.082-2.309,6.166-4.711,9.109-7.137a1.819,1.819,0,0,1,1.9-.256c96.229,43.917,200.41,43.917,295.5,0a1.812,1.812,0,0,1,1.924.233c2.944,2.426,6.027,4.851,9.132,7.16a1.884,1.884,0,0,1-.162,3.126,301.407,301.407,0,0,1-45.89,21.83,1.875,1.875,0,0,0-1,2.611,391.055,391.055,0,0,0,30.014,48.815,1.864,1.864,0,0,0,2.063.7A486.048,486.048,0,0,0,610.7,405.729a1.882,1.882,0,0,0,.765-1.352C623.729,277.594,590.933,167.465,524.531,69.836ZM222.491,337.58c-28.972,0-52.844-26.587-52.844-59.239S193.056,219.1,222.491,219.1c29.665,0,53.306,26.82,52.843,59.239C275.334,310.993,251.924,337.58,222.491,337.58Zm195.38,0c-28.971,0-52.843-26.587-52.843-59.239S388.437,219.1,417.871,219.1c29.667,0,53.307,26.82,52.844,59.239C470.715,310.993,447.538,337.58,417.871,337.58Z"/></svg> <li><svg class="w-5 falign" viewBox="0 0 640 512" ><path fill="#fff" d="M524.531,69.836a1.5,1.5,0,0,0-.764-.7A485.065,485.065,0,0,0,404.081,32.03a1.816,1.816,0,0,0-1.923.91,337.461,337.461,0,0,0-14.9,30.6,447.848,447.848,0,0,0-134.426,0,309.541,309.541,0,0,0-15.135-30.6,1.89,1.89,0,0,0-1.924-.91A483.689,483.689,0,0,0,116.085,69.137a1.712,1.712,0,0,0-.788.676C39.068,183.651,18.186,294.69,28.43,404.354a2.016,2.016,0,0,0,.765,1.375A487.666,487.666,0,0,0,176.02,479.918a1.9,1.9,0,0,0,2.063-.676A348.2,348.2,0,0,0,208.12,430.4a1.86,1.86,0,0,0-1.019-2.588,321.173,321.173,0,0,1-45.868-21.853,1.885,1.885,0,0,1-.185-3.126c3.082-2.309,6.166-4.711,9.109-7.137a1.819,1.819,0,0,1,1.9-.256c96.229,43.917,200.41,43.917,295.5,0a1.812,1.812,0,0,1,1.924.233c2.944,2.426,6.027,4.851,9.132,7.16a1.884,1.884,0,0,1-.162,3.126,301.407,301.407,0,0,1-45.89,21.83,1.875,1.875,0,0,0-1,2.611,391.055,391.055,0,0,0,30.014,48.815,1.864,1.864,0,0,0,2.063.7A486.048,486.048,0,0,0,610.7,405.729a1.882,1.882,0,0,0,.765-1.352C623.729,277.594,590.933,167.465,524.531,69.836ZM222.491,337.58c-28.972,0-52.844-26.587-52.844-59.239S193.056,219.1,222.491,219.1c29.665,0,53.306,26.82,52.843,59.239C275.334,310.993,251.924,337.58,222.491,337.58Zm195.38,0c-28.971,0-52.843-26.587-52.843-59.239S388.437,219.1,417.871,219.1c29.667,0,53.307,26.82,52.844,59.239C470.715,310.993,447.538,337.58,417.871,337.58Z"/></svg>
<span aria-hidden class="link" on:click={() => extrenalNavigate(discordLink)} >Discord community <span aria-hidden class="link" on:click={() => extrenalNavigate(discordLink)} >Discord community
</span></li> </span></li>
<li><svg class="w-5 falign" viewBox="0 0 24 24"><title/><path d="M17.3,13.35a1,1,0,0,1-.7-.29,1,1,0,0,1,0-1.41l2.12-2.12a2,2,0,0,0,0-2.83L17.3,5.28a2.06,2.06,0,0,0-2.83,0L12.35,7.4A1,1,0,0,1,10.94,6l2.12-2.12a4.1,4.1,0,0,1,5.66,0l1.41,1.41a4,4,0,0,1,0,5.66L18,13.06A1,1,0,0,1,17.3,13.35Z" fill="#fff"/><path d="M8.11,21.3a4,4,0,0,1-2.83-1.17L3.87,18.72a4,4,0,0,1,0-5.66L6,10.94A1,1,0,0,1,7.4,12.35L5.28,14.47a2,2,0,0,0,0,2.83L6.7,18.72a2.06,2.06,0,0,0,2.83,0l2.12-2.12A1,1,0,1,1,13.06,18l-2.12,2.12A4,4,0,0,1,8.11,21.3Z" fill="#fff"/><path d="M8.82,16.18a1,1,0,0,1-.71-.29,1,1,0,0,1,0-1.42l6.37-6.36a1,1,0,0,1,1.41,0,1,1,0,0,1,0,1.42L9.52,15.89A1,1,0,0,1,8.82,16.18Z" fill="#fff"/></svg>
<span aria-hidden class="link" on:click={() => extrenalNavigate(yupLiveAndroid)} >Yup Live Android
</span></li>
<li><svg class="w-5 falign" viewBox="0 0 24 24"><title/><path d="M17.3,13.35a1,1,0,0,1-.7-.29,1,1,0,0,1,0-1.41l2.12-2.12a2,2,0,0,0,0-2.83L17.3,5.28a2.06,2.06,0,0,0-2.83,0L12.35,7.4A1,1,0,0,1,10.94,6l2.12-2.12a4.1,4.1,0,0,1,5.66,0l1.41,1.41a4,4,0,0,1,0,5.66L18,13.06A1,1,0,0,1,17.3,13.35Z" fill="#fff"/><path d="M8.11,21.3a4,4,0,0,1-2.83-1.17L3.87,18.72a4,4,0,0,1,0-5.66L6,10.94A1,1,0,0,1,7.4,12.35L5.28,14.47a2,2,0,0,0,0,2.83L6.7,18.72a2.06,2.06,0,0,0,2.83,0l2.12-2.12A1,1,0,1,1,13.06,18l-2.12,2.12A4,4,0,0,1,8.11,21.3Z" fill="#fff"/><path d="M8.82,16.18a1,1,0,0,1-.71-.29,1,1,0,0,1,0-1.42l6.37-6.36a1,1,0,0,1,1.41,0,1,1,0,0,1,0,1.42L9.52,15.89A1,1,0,0,1,8.82,16.18Z" fill="#fff"/></svg> <li><svg class="w-5 falign" viewBox="0 0 24 24"><title/><path d="M17.3,13.35a1,1,0,0,1-.7-.29,1,1,0,0,1,0-1.41l2.12-2.12a2,2,0,0,0,0-2.83L17.3,5.28a2.06,2.06,0,0,0-2.83,0L12.35,7.4A1,1,0,0,1,10.94,6l2.12-2.12a4.1,4.1,0,0,1,5.66,0l1.41,1.41a4,4,0,0,1,0,5.66L18,13.06A1,1,0,0,1,17.3,13.35Z" fill="#fff"/><path d="M8.11,21.3a4,4,0,0,1-2.83-1.17L3.87,18.72a4,4,0,0,1,0-5.66L6,10.94A1,1,0,0,1,7.4,12.35L5.28,14.47a2,2,0,0,0,0,2.83L6.7,18.72a2.06,2.06,0,0,0,2.83,0l2.12-2.12A1,1,0,1,1,13.06,18l-2.12,2.12A4,4,0,0,1,8.11,21.3Z" fill="#fff"/><path d="M8.82,16.18a1,1,0,0,1-.71-.29,1,1,0,0,1,0-1.42l6.37-6.36a1,1,0,0,1,1.41,0,1,1,0,0,1,0,1.42L9.52,15.89A1,1,0,0,1,8.82,16.18Z" fill="#fff"/></svg>
<span aria-hidden class="link" on:click={() => extrenalNavigate(yupForumLink)} >Yup Forum <span aria-hidden class="link" on:click={() => extrenalNavigate(yupForumLink)} >Yup Forum
</span></li> </span></li>

View File

@ -98,7 +98,7 @@ onMount(async () => {
</div> </div>
<div class="switch switch--4 text-[0.8rem] flex flex-col mb-4"> <div class="switch switch--4 text-[0.8rem] flex flex-col mb-4">
<span class="inline-block">Browser notification actions refill</span> <span class="inline-block">Auto-refill Actions if online</span>
<label class="switch__label mt-2"> <label class="switch__label mt-2">
<input on:click={() => setSettingsLocal('chromeNotifWhenAbleToVote')} type="checkbox" class="switch__input" <input on:click={() => setSettingsLocal('chromeNotifWhenAbleToVote')} type="checkbox" class="switch__input"
checked={settings.chromeNotifWhenAbleToVote} checked={settings.chromeNotifWhenAbleToVote}

View File

@ -71,11 +71,11 @@ export const executeVote = async ({
} else { } else {
const err = await req.text() const err = await req.text()
if (err.includes('limit')) { if (err.includes('limit')) {
$alertStore?.show('Rating limit consumed!!!', 'warning') $alertStore?.show('Rating limit reached!!!', 'warning')
} else if(err.includes('requests')) { } else if(err.includes('requests')) {
$alertStore?.show('You have made too many request try aagin after 24h', 'warning') $alertStore?.show('You have made too many request try again after 24h', 'warning')
} else if(err.toLocaleLowerCase().includes('unauthorized')) { } else if(err.toLocaleLowerCase().includes('unauthorized')) {
$alertStore?.show('Seem your auth token is not valid anymore re-login!!', 'error') $alertStore?.show('Seems your auth token is not valid anymore re-login!!', 'error')
} else { } else {
$alertStore?.show('Vote not submited due to error try to re-login!', 'error') $alertStore?.show('Vote not submited due to error try to re-login!', 'error')
} }