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>
<Events ref="events" :ws-port="config['backend.http'].websocket_port"
v-if="Object.keys(config).length && config['backend.http']" />
<Events ref="events" :ws-port="config['backend.http'].websocket_port" v-if="hasWebsocket" />
<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 />
</template>
@ -13,11 +13,12 @@ import Utils from "@/Utils";
import Events from "@/Events";
import VoiceAssistant from "@/components/VoiceAssistant";
import { bus } from "@/bus";
import Pushbullet from "@/components/Pushbullet";
export default {
name: 'App',
mixins: [Utils],
components: {Notifications, Events, VoiceAssistant},
components: {Pushbullet, Notifications, Events, VoiceAssistant},
data() {
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: {
onNotification(notification) {
this.$refs.notifications.create(notification)

View File

@ -42,9 +42,10 @@ export default {
.notification {
background: $notification-bg;
border: $notification-border;
border-radius: .5rem;
margin-bottom: 1rem;
margin-right: 1rem;
border-radius: 1em;
margin-bottom: 0.25em !important;
margin-right: 0.1em;
padding: 0.5em;
cursor: pointer;
&:hover {
@ -66,18 +67,20 @@ export default {
}
.title {
padding: .4rem;
line-height: 3rem;
letter-spacing: .1rem;
font-weight: bold;
color: $notification-title-fg;
font-size: 1.25em;
font-weight: normal;
margin: 0.25em 0;
padding: 0;
letter-spacing: 0.07em;
}
.body {
@extend .vertical-center;
height: 6em;
overflow: hidden;
padding-bottom: 1rem;
letter-spacing: .05rem;
padding-bottom: 0.1em;
letter-spacing: 0.05em;
}
.image {
@ -92,7 +95,7 @@ export default {
height: 100%;
.fa {
font-size: 2.5rem;
font-size: 2.5em;
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-warning-icon-color: #662 !default;
$notification-error-icon-color: #8b0000 !default;
$notification-title-fg: #364 !default;
//// Loading panel
$loading-bg: #909090;

View File

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