Make Vona a Python module
This commit is contained in:
19
pyproject.toml
Normal file
19
pyproject.toml
Normal file
@@ -0,0 +1,19 @@
|
||||
[project]
|
||||
name = "vona"
|
||||
version = "1.4.1"
|
||||
description = "Flazing bast Matrix homeserver"
|
||||
authors = [
|
||||
{name = "Kierre",email = "vel@riseup.net"}
|
||||
]
|
||||
license = {text = "Velicense"}
|
||||
requires-python = ">=3.13"
|
||||
dependencies = [
|
||||
"httpx (>=0.28.1,<0.29.0)",
|
||||
"pynacl (>=1.6.0,<2.0.0)",
|
||||
"flask[async] (>=3.1.2,<4.0.0)",
|
||||
]
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
@@ -1,2 +0,0 @@
|
||||
flask[async]
|
||||
nacl
|
||||
1
vona/__init__.py
Normal file
1
vona/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# read __main__.py
|
||||
@@ -1,15 +1,15 @@
|
||||
from flask import Flask, jsonify, request, redirect
|
||||
import vona.globals as globals
|
||||
from datetime import datetime
|
||||
import vona.config as config
|
||||
import logging
|
||||
import globals
|
||||
import config
|
||||
|
||||
from identity import identity
|
||||
from appservice import apps
|
||||
from custom import custom
|
||||
from policy import policy
|
||||
from c2s import client
|
||||
from s2s import server
|
||||
from vona.federation import server
|
||||
from vona.custom import custom
|
||||
from vona.identity import identity
|
||||
from vona.appservice import apps
|
||||
from vona.policy import policy
|
||||
from vona.client import client
|
||||
|
||||
logging.getLogger("werkzeug").disabled = True
|
||||
logging.getLogger("flask").disabled = True
|
||||
@@ -1,5 +1,5 @@
|
||||
from flask import Blueprint, jsonify
|
||||
from config import the_funny_number
|
||||
from vona.config import the_funny_number
|
||||
import asyncio
|
||||
|
||||
apps = Blueprint("appservice", __name__)
|
||||
@@ -1,8 +1,8 @@
|
||||
from flask import Blueprint, jsonify, request, send_file
|
||||
from s2s import send_join
|
||||
import globals
|
||||
from vona.federation import send_join
|
||||
import vona.globals as globals
|
||||
import vona.config as config
|
||||
import asyncio
|
||||
import config
|
||||
import random
|
||||
import os
|
||||
|
||||
@@ -26,6 +26,7 @@ client = Blueprint("c2s", __name__)
|
||||
@client.route("/_matrix/client/r0/rooms/<roomId>/leave", methods=["POST"])
|
||||
@client.route("/_matrix/client/v3/rooms/<roomId>/read_markers", methods=["POST"])
|
||||
@client.route("/_matrix/client/r0/rooms/<roomId>/read_markers", methods=["POST"])
|
||||
@client.route("/_matrix/client/v3/rooms/<room>/typing/<user>", methods=["PUT"])
|
||||
@client.route("/_matrix/client/v3/keys/device_signing/upload", methods=["POST"])
|
||||
@client.route("/_matrix/client/v3/rooms/<room>/receipt/<type>/<event>", methods=["POST"])
|
||||
@client.route("/_matrix/client/v3/users/<user>/report", methods=["POST"])
|
||||
@@ -434,7 +435,6 @@ async def refresh():
|
||||
@client.route("/_matrix/client/unstable/im.nheko.summary/summary/<roomId>")
|
||||
@client.route("/_matrix/client/v1/room_summary/<roomId>")
|
||||
async def room_summary(roomId):
|
||||
room = config.room_dir_room["chunk"][0]
|
||||
return jsonify({
|
||||
"room_id": globals.make_event_id().replace("$", "!"),
|
||||
"avatar_url": f"mxc://{config.server_name}/cat",
|
||||
@@ -614,8 +614,13 @@ async def room_messages(roomId):
|
||||
@client.route("/_matrix/client/v3/keys/query", methods=["POST"])
|
||||
@client.route("/_matrix/client/r0/keys/query", methods=["POST"])
|
||||
async def query_keys():
|
||||
# Should be replaced eventually
|
||||
return jsonify({})
|
||||
user = request.get_json()["device_keys"]
|
||||
return jsonify({
|
||||
"device_keys": user,
|
||||
"master_keys": user,
|
||||
"self_signing_keys": user,
|
||||
"user_signing_keys": user
|
||||
})
|
||||
|
||||
@client.route("/_matrix/client/api/v1/createRoom", methods=["POST"])
|
||||
@client.route("/_matrix/client/v3/createRoom", methods=["POST"])
|
||||
1
vona/config/__main__.py
Normal file
1
vona/config/__main__.py
Normal file
@@ -0,0 +1 @@
|
||||
import vona.config
|
||||
@@ -1,6 +1,6 @@
|
||||
from flask import Blueprint, jsonify, request, Response
|
||||
import globals
|
||||
import config
|
||||
import vona.globals as globals
|
||||
import vona.config as config
|
||||
import base64
|
||||
import re
|
||||
import os
|
||||
@@ -1,12 +1,12 @@
|
||||
from flask import jsonify, Response, request, send_file, abort, Blueprint
|
||||
from config import *
|
||||
import globals
|
||||
from vona.config import *
|
||||
import vona.globals as globals
|
||||
import httpx
|
||||
import json
|
||||
import time
|
||||
import os
|
||||
|
||||
server = Blueprint("s2s", __name__)
|
||||
server = Blueprint("federation", __name__)
|
||||
|
||||
|
||||
def send_join(request, roomId) -> dict:
|
||||
@@ -1,13 +1,14 @@
|
||||
from importlib.metadata import version
|
||||
import vona.config as config
|
||||
import nacl.signing
|
||||
import hashlib
|
||||
import base64
|
||||
import config
|
||||
import random
|
||||
import copy
|
||||
import json
|
||||
import re
|
||||
|
||||
vona_version = "1.4.1"
|
||||
vona_version = version("vona")
|
||||
|
||||
|
||||
def canonical_json(value):
|
||||
@@ -1,5 +1,5 @@
|
||||
from flask import Blueprint, jsonify, request
|
||||
from config import server_name, the_funny_number
|
||||
from vona.config import server_name, the_funny_number
|
||||
import time
|
||||
|
||||
identity = Blueprint("identity", __name__)
|
||||
Reference in New Issue
Block a user