Migrated Pushbullet component

This commit is contained in:
Fabio Manganiello 2020-11-28 01:12:47 +01:00
parent 1036358b28
commit dea547a491
19 changed files with 118 additions and 35 deletions

View file

@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>platypush</title><link href="/static/css/chunk-24ff873d.93e0f9f4.css" rel="prefetch"><link href="/static/css/chunk-36fd68c5.09d991b3.css" rel="prefetch"><link href="/static/css/chunk-4bbbb9a3.71b9cc2c.css" rel="prefetch"><link href="/static/css/chunk-5710a9bc.5514cc02.css" rel="prefetch"><link href="/static/css/chunk-62a3d08e.ea9ac82d.css" rel="prefetch"><link href="/static/css/chunk-7c2209ed.952d8d60.css" rel="prefetch"><link href="/static/css/chunk-e8078048.cd9306d8.css" rel="prefetch"><link href="/static/js/chunk-24ff873d.0f916e0f.js" rel="prefetch"><link href="/static/js/chunk-36fd68c5.1e8f0ca8.js" rel="prefetch"><link href="/static/js/chunk-4bbbb9a3.c1ba820e.js" rel="prefetch"><link href="/static/js/chunk-5710a9bc.5aba1b9a.js" rel="prefetch"><link href="/static/js/chunk-62a3d08e.cd0ca5eb.js" rel="prefetch"><link href="/static/js/chunk-7c2209ed.3981671f.js" rel="prefetch"><link href="/static/js/chunk-e8078048.bc52467d.js" rel="prefetch"><link href="/static/css/app.18ca6894.css" rel="preload" as="style"><link href="/static/js/app.b6a596bf.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.769f6f18.js" rel="preload" as="script"><link href="/static/css/app.18ca6894.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but platypush doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.769f6f18.js"></script><script src="/static/js/app.b6a596bf.js"></script></body></html> <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>platypush</title><link href="/static/css/chunk-24ff873d.c68a1871.css" rel="prefetch"><link href="/static/css/chunk-36fd68c5.79277e60.css" rel="prefetch"><link href="/static/css/chunk-4bbbb9a3.c0cffcb7.css" rel="prefetch"><link href="/static/css/chunk-5710a9bc.b05a2ff9.css" rel="prefetch"><link href="/static/css/chunk-62a3d08e.698b2d60.css" rel="prefetch"><link href="/static/css/chunk-7c2209ed.a322204e.css" rel="prefetch"><link href="/static/css/chunk-e8078048.67cca65c.css" rel="prefetch"><link href="/static/js/chunk-24ff873d.0f916e0f.js" rel="prefetch"><link href="/static/js/chunk-36fd68c5.1e8f0ca8.js" rel="prefetch"><link href="/static/js/chunk-4bbbb9a3.c1ba820e.js" rel="prefetch"><link href="/static/js/chunk-5710a9bc.5aba1b9a.js" rel="prefetch"><link href="/static/js/chunk-62a3d08e.cd0ca5eb.js" rel="prefetch"><link href="/static/js/chunk-7c2209ed.3981671f.js" rel="prefetch"><link href="/static/js/chunk-e8078048.bc52467d.js" rel="prefetch"><link href="/static/css/app.54d8460c.css" rel="preload" as="style"><link href="/static/js/app.4135125c.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.769f6f18.js" rel="preload" as="script"><link href="/static/css/app.54d8460c.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but platypush doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.769f6f18.js"></script><script src="/static/js/app.4135125c.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,9 @@
<template> <template>
<Events ref="events" :ws-port="config['backend.http'].websocket_port" <Events ref="events" :ws-port="config['backend.http'].websocket_port" v-if="hasWebsocket" />
v-if="Object.keys(config).length && config['backend.http']" />
<Notifications ref="notifications" /> <Notifications ref="notifications" />
<VoiceAssistant ref="voice-assistant" v-if="Object.keys(config).length" /> <VoiceAssistant ref="voice-assistant" v-if="hasAssistant" />
<Pushbullet ref="pushbullet" v-if="hasPushbullet" />
<router-view /> <router-view />
</template> </template>
@ -13,11 +13,12 @@ import Utils from "@/Utils";
import Events from "@/Events"; import Events from "@/Events";
import VoiceAssistant from "@/components/VoiceAssistant"; import VoiceAssistant from "@/components/VoiceAssistant";
import { bus } from "@/bus"; import { bus } from "@/bus";
import Pushbullet from "@/components/Pushbullet";
export default { export default {
name: 'App', name: 'App',
mixins: [Utils], mixins: [Utils],
components: {Notifications, Events, VoiceAssistant}, components: {Pushbullet, Notifications, Events, VoiceAssistant},
data() { data() {
return { return {
@ -25,6 +26,24 @@ export default {
} }
}, },
computed: {
hasWebsocket() {
return Object.keys(this.config).length > 0 &&
'backend.http' in this.config
},
hasAssistant() {
return this.hasWebsocket
},
hasPushbullet() {
return this.hasWebsocket && (
'pushbullet' in this.config ||
'backend.pushbullet' in this.config
)
},
},
methods: { methods: {
onNotification(notification) { onNotification(notification) {
this.$refs.notifications.create(notification) this.$refs.notifications.create(notification)

View file

@ -42,9 +42,10 @@ export default {
.notification { .notification {
background: $notification-bg; background: $notification-bg;
border: $notification-border; border: $notification-border;
border-radius: .5rem; border-radius: 1em;
margin-bottom: 1rem; margin-bottom: 0.25em !important;
margin-right: 1rem; margin-right: 0.1em;
padding: 0.5em;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
@ -66,18 +67,20 @@ export default {
} }
.title { .title {
padding: .4rem; color: $notification-title-fg;
line-height: 3rem; font-size: 1.25em;
letter-spacing: .1rem; font-weight: normal;
font-weight: bold; margin: 0.25em 0;
padding: 0;
letter-spacing: 0.07em;
} }
.body { .body {
@extend .vertical-center; @extend .vertical-center;
height: 6em; height: 6em;
overflow: hidden; overflow: hidden;
padding-bottom: 1rem; padding-bottom: 0.1em;
letter-spacing: .05rem; letter-spacing: 0.05em;
} }
.image { .image {
@ -92,7 +95,7 @@ export default {
height: 100%; height: 100%;
.fa { .fa {
font-size: 2.5rem; font-size: 2.5em;
color: var(--color); color: var(--color);
} }

View file

@ -0,0 +1,31 @@
<template>
<div />
</template>
<script>
import Utils from "@/Utils";
export default {
name: "Pushbullet",
mixins: [Utils],
methods: {
onMessage(event) {
if (event.push_type === 'mirror') {
this.notify({
title: event.title,
text: event.body,
image: {
src: event.icon ? 'data:image/png;base64, ' + event.icon : undefined,
icon: event.icon ? undefined : 'bell',
},
});
}
},
},
mounted() {
this.subscribe(this.onMessage, 'platypush.message.event.pushbullet.PushbulletEvent')
},
}
</script>

View file

@ -0,0 +1,28 @@
.fade-in {
animation-duration: 0.5s;
-webkit-animation-duration: 0.5s;
animation-fill-mode: both;
animation-name: fadeIn;
-webkit-animation-name: fadeIn;
}
.fade-out {
animation-duration: 0.5s;
-webkit-animation-duration: 0.5s;
animation-fill-mode: both;
animation-name: fadeOut;
-webkit-animation-name: fadeOut;
}
@keyframes fadeIn {
0% {opacity: 0;}
100% {opacity: 1;}
}
@keyframes fadeOut {
0% {opacity: 1;}
100% {
opacity: 0;
display: none;
}
}

View file

@ -15,6 +15,7 @@ $notification-title-border: 1px solid rgba(83, 158, 102, 0.43) !default;
$notification-icon-color: black !default; $notification-icon-color: black !default;
$notification-warning-icon-color: #662 !default; $notification-warning-icon-color: #662 !default;
$notification-error-icon-color: #8b0000 !default; $notification-error-icon-color: #8b0000 !default;
$notification-title-fg: #364 !default;
//// Loading panel //// Loading panel
$loading-bg: #909090; $loading-bg: #909090;

View file

@ -9,6 +9,7 @@ module.exports = {
@import "@/style/themes/light.scss"; @import "@/style/themes/light.scss";
@import "@/style/layout.scss"; @import "@/style/layout.scss";
@import "@/style/components.scss"; @import "@/style/components.scss";
@import "@/style/animations.scss";
` `
} }
} }