mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-28 12:56:16 +02:00
hivemind converted
This commit is contained in:
3
lnbits/extensions/hivemind/README.md
Normal file
3
lnbits/extensions/hivemind/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<h1>Hivemind</h1>
|
||||||
|
|
||||||
|
Placeholder for a future <a href="https://bitcoinhivemind.com/">Bitcoin Hivemind</a> extension.
|
17
lnbits/extensions/hivemind/__init__.py
Normal file
17
lnbits/extensions/hivemind/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from fastapi import APIRouter
|
||||||
|
|
||||||
|
from lnbits.db import Database
|
||||||
|
from lnbits.helpers import template_renderer
|
||||||
|
|
||||||
|
db = Database("ext_hivemind")
|
||||||
|
|
||||||
|
hivemind_ext: APIRouter = APIRouter(
|
||||||
|
prefix="/hivemind",
|
||||||
|
tags=["hivemind"]
|
||||||
|
)
|
||||||
|
|
||||||
|
def hivemind_renderer():
|
||||||
|
return template_renderer(["lnbits/extensions/hivemind/templates"])
|
||||||
|
|
||||||
|
|
||||||
|
from .views import * # noqa
|
6
lnbits/extensions/hivemind/config.json
Normal file
6
lnbits/extensions/hivemind/config.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "Hivemind",
|
||||||
|
"short_description": "Make cheap talk expensive!",
|
||||||
|
"icon": "batch_prediction",
|
||||||
|
"contributors": ["fiatjaf"]
|
||||||
|
}
|
10
lnbits/extensions/hivemind/migrations.py
Normal file
10
lnbits/extensions/hivemind/migrations.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# async def m001_initial(db):
|
||||||
|
# await db.execute(
|
||||||
|
# f"""
|
||||||
|
# CREATE TABLE hivemind.hivemind (
|
||||||
|
# id TEXT PRIMARY KEY,
|
||||||
|
# wallet TEXT NOT NULL,
|
||||||
|
# time TIMESTAMP NOT NULL DEFAULT {db.timestamp_now}
|
||||||
|
# );
|
||||||
|
# """
|
||||||
|
# )
|
11
lnbits/extensions/hivemind/models.py
Normal file
11
lnbits/extensions/hivemind/models.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# from sqlite3 import Row
|
||||||
|
# from typing import NamedTuple
|
||||||
|
|
||||||
|
|
||||||
|
# class Example(NamedTuple):
|
||||||
|
# id: str
|
||||||
|
# wallet: str
|
||||||
|
#
|
||||||
|
# @classmethod
|
||||||
|
# def from_row(cls, row: Row) -> "Example":
|
||||||
|
# return cls(**dict(row))
|
35
lnbits/extensions/hivemind/templates/hivemind/index.html
Normal file
35
lnbits/extensions/hivemind/templates/hivemind/index.html
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{% extends "base.html" %} {% from "macros.jinja" import window_vars with context
|
||||||
|
%} {% block page %}
|
||||||
|
<q-card>
|
||||||
|
<q-card-section>
|
||||||
|
<h5 class="text-subtitle1 q-mt-none q-mb-md">
|
||||||
|
This extension is just a placeholder for now.
|
||||||
|
</h5>
|
||||||
|
<p>
|
||||||
|
<a href="https://bitcoinhivemind.com/">Hivemind</a> is a Bitcoin sidechain
|
||||||
|
project for a peer-to-peer oracle protocol that absorbs accurate data into
|
||||||
|
a blockchain so that Bitcoin users can speculate in prediction markets.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
These markets have the potential to revolutionize the emergence of
|
||||||
|
diffusion of knowledge in society and fix all sorts of problems in the
|
||||||
|
world.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
This extension will become fully operative when the
|
||||||
|
<a href="https://drivechain.xyz/">BIP300</a> soft-fork gets activated and
|
||||||
|
Bitcoin Hivemind is launched.
|
||||||
|
</p>
|
||||||
|
</q-card-section>
|
||||||
|
</q-card>
|
||||||
|
{% endblock %} {% block scripts %} {{ window_vars(user) }}
|
||||||
|
<script>
|
||||||
|
new Vue({
|
||||||
|
el: '#vue',
|
||||||
|
mixins: [windowMixin],
|
||||||
|
data: function () {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
13
lnbits/extensions/hivemind/views.py
Normal file
13
lnbits/extensions/hivemind/views.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
from fastapi.param_functions import Depends
|
||||||
|
from starlette.requests import Request
|
||||||
|
from starlette.responses import HTMLResponse
|
||||||
|
|
||||||
|
from lnbits.core.models import User
|
||||||
|
from lnbits.decorators import check_user_exists
|
||||||
|
|
||||||
|
from . import hivemind_ext, hivemind_renderer
|
||||||
|
|
||||||
|
|
||||||
|
@hivemind_ext.get("/", response_class=HTMLResponse)
|
||||||
|
async def index(request: Request, user: User = Depends(check_user_exists)):
|
||||||
|
return hivemind_renderer().TemplateResponse("hivemind/index.html", {"request": request, "user": user.dict()})
|
Reference in New Issue
Block a user