Spaces:
Sleeping
Sleeping
Update templates/app.html
Browse files- templates/app.html +18 -0
templates/app.html
CHANGED
|
@@ -4,6 +4,7 @@
|
|
| 4 |
<title>Inter</title>
|
| 5 |
<link href="/static/styles/app.css" rel="stylesheet">
|
| 6 |
<script src="/static/scripts/app.js"></script>
|
|
|
|
| 7 |
</head>
|
| 8 |
<body>
|
| 9 |
<div id="chat">
|
|
@@ -26,5 +27,22 @@
|
|
| 26 |
<input id="inputText" placeholder="Message"/>
|
| 27 |
</div>
|
| 28 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
</body>
|
| 30 |
</html>
|
|
|
|
| 4 |
<title>Inter</title>
|
| 5 |
<link href="/static/styles/app.css" rel="stylesheet">
|
| 6 |
<script src="/static/scripts/app.js"></script>
|
| 7 |
+
<script src="https://unpkg.com/@supabase/supabase-js@2"></script>
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
<div id="chat">
|
|
|
|
| 27 |
<input id="inputText" placeholder="Message"/>
|
| 28 |
</div>
|
| 29 |
</div>
|
| 30 |
+
<script>
|
| 31 |
+
let latest_msg_id = {{ msg|last|pprint }}
|
| 32 |
+
const supabaseUrl = {{ supa.url }}
|
| 33 |
+
const supabasePublicKey = {{ supa.public_key }} // public key lol
|
| 34 |
+
const supabase = Supabase.createClient(supabaseUrl, supabasePublicKey)
|
| 35 |
+
|
| 36 |
+
function checkForMessage(payload) { // I don't trust you losers with something like message data lmao. You just get to check with an api
|
| 37 |
+
return;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
supabase
|
| 41 |
+
.channel("main/general")
|
| 42 |
+
.on("broadcast", { event: 'new_message', schema: 'public', table: 'messages' }, payload => {
|
| 43 |
+
console.log("New message received") // Temp for dev lol
|
| 44 |
+
checkForMessage()
|
| 45 |
+
})
|
| 46 |
+
</script>
|
| 47 |
</body>
|
| 48 |
</html>
|