-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from lnbits/trollbox
Adds trollbox
- Loading branch information
Showing
8 changed files
with
307 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,3 @@ | ||
# StreamerCopilot | ||
|
||
Tool to help streamers accept sats for tips | ||
|
||
<a href="https://www.youtube.com/watch?v=w5TmWWj2nZY">Video tutorial</a> | ||
|
||
![image](https://user-images.githubusercontent.com/33088785/214897589-e51e4948-d6cf-4c3b-a0ee-b4581e873b6c.png) | ||
|
||
![image](https://user-images.githubusercontent.com/33088785/214898501-193c0f04-9738-4039-b178-ea0068a61685.png) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1 @@ | ||
{ | ||
"name": "Streamer Copilot", | ||
"short_description": "Video tips/animations/webhooks", | ||
"tile": "/copilot/static/bitcoin-streaming.png", | ||
"contributors": [ | ||
"arcbtc" | ||
] | ||
} | ||
{"name": "Streamer Copilot", "short_description": "Video tips/animations/webhooks", "tile": "/copilot/static/bitcoin-streaming.png", "contributors": ["arcbtc"], "is_installed": true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
{% extends "public.html" %} {% block page %} | ||
<q-page> | ||
<div class="row q-col-gutter-md justify-center"> | ||
<div class="col-12 col-md-7 col-lg-6 q-gutter-y-md"> | ||
<q-card class="q-pa-lg"> | ||
<q-card-section> | ||
<q-form @submit="sendMessage" class="full-width chat-input"> | ||
<q-input | ||
ref="newMessage" | ||
v-model="newMessage" | ||
placeholder="Message" | ||
class="full-width" | ||
dense | ||
outlined | ||
maxlength="100" | ||
> | ||
<template> | ||
<q-btn | ||
round | ||
dense | ||
flat | ||
type="submit" | ||
icon="send" | ||
color="primary" | ||
/> | ||
</template> | ||
</q-input> | ||
</q-form> | ||
</q-card-section> | ||
</q-card> | ||
</div> | ||
</div> | ||
{% for comment in trollbox %} {{ comment }} {% endfor %} | ||
<q-dialog | ||
v-model="pers" | ||
persistent | ||
transition-show="scale" | ||
transition-hide="scale" | ||
> | ||
<q-card style="width: 300px"> | ||
<q-card-section> | ||
<q-input label="Name" maxlength="10" v-model="name"></q-input> | ||
</q-card-section> | ||
<q-card-section class="q-pt-none"> | ||
<q-btn v-close-popup color="primary" label="lanch chat"></q-btn> | ||
</q-card-section> | ||
</q-card> | ||
</q-dialog> | ||
</q-page> | ||
{% endblock %} {% block scripts %} | ||
<script> | ||
new Vue({ | ||
el: '#vue', | ||
mixins: [windowMixin], | ||
data: function () { | ||
return { | ||
name: '', | ||
newMessage: '', | ||
trollbox: [], | ||
pers: true | ||
} | ||
}, | ||
methods: { | ||
sendMessage: function (message) { | ||
self = this | ||
LNbits.api | ||
.request( | ||
'GET', | ||
'/api/v1/ws/{{chat_id}}/' + this.name + '-' + this.newMessage | ||
) | ||
.then(function (response1) { | ||
self.newMessage = '' | ||
self.$q.notify({ | ||
color: 'green', | ||
message: 'Sent!' | ||
}) | ||
}) | ||
.catch(err => { | ||
LNbits.utils.notifyApiError(err) | ||
}) | ||
}, | ||
initTrollBox() { | ||
self = this | ||
self.troll_box = !self.troll_box | ||
console.log(self.troll_box) | ||
|
||
if (location.protocol !== 'http:') { | ||
self.chatUrl = | ||
'wss:https://' + | ||
document.domain + | ||
':' + | ||
location.port + | ||
'/api/v1/ws/' + | ||
self.chat_id | ||
} else { | ||
self.chatUrl = | ||
'ws:https://' + | ||
document.domain + | ||
':' + | ||
location.port + | ||
'/api/v1/ws/' + | ||
self.chat_id | ||
} | ||
this.connectionchat = new WebSocket(self.chatUrl) | ||
this.connectionchat.onmessage = function (e) { | ||
this.trollbox.push(e.data) | ||
} | ||
this.connectionchat.onopen = () => this.launch | ||
} | ||
}, | ||
created: function () { | ||
self = this | ||
self.initTrollBox() | ||
} | ||
}) | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.