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
|
from flask import Flask, jsonify, request, redirect
|
||||||
|
import vona.globals as globals
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import vona.config as config
|
||||||
import logging
|
import logging
|
||||||
import globals
|
|
||||||
import config
|
|
||||||
|
|
||||||
from identity import identity
|
from vona.federation import server
|
||||||
from appservice import apps
|
from vona.custom import custom
|
||||||
from custom import custom
|
from vona.identity import identity
|
||||||
from policy import policy
|
from vona.appservice import apps
|
||||||
from c2s import client
|
from vona.policy import policy
|
||||||
from s2s import server
|
from vona.client import client
|
||||||
|
|
||||||
logging.getLogger("werkzeug").disabled = True
|
logging.getLogger("werkzeug").disabled = True
|
||||||
logging.getLogger("flask").disabled = True
|
logging.getLogger("flask").disabled = True
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
from flask import Blueprint, jsonify
|
from flask import Blueprint, jsonify
|
||||||
from config import the_funny_number
|
from vona.config import the_funny_number
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
apps = Blueprint("appservice", __name__)
|
apps = Blueprint("appservice", __name__)
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
from flask import Blueprint, jsonify, request, send_file
|
from flask import Blueprint, jsonify, request, send_file
|
||||||
from s2s import send_join
|
from vona.federation import send_join
|
||||||
import globals
|
import vona.globals as globals
|
||||||
|
import vona.config as config
|
||||||
import asyncio
|
import asyncio
|
||||||
import config
|
|
||||||
import random
|
import random
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -26,6 +26,7 @@ client = Blueprint("c2s", __name__)
|
|||||||
@client.route("/_matrix/client/r0/rooms/<roomId>/leave", methods=["POST"])
|
@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/v3/rooms/<roomId>/read_markers", methods=["POST"])
|
||||||
@client.route("/_matrix/client/r0/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/keys/device_signing/upload", methods=["POST"])
|
||||||
@client.route("/_matrix/client/v3/rooms/<room>/receipt/<type>/<event>", methods=["POST"])
|
@client.route("/_matrix/client/v3/rooms/<room>/receipt/<type>/<event>", methods=["POST"])
|
||||||
@client.route("/_matrix/client/v3/users/<user>/report", 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/unstable/im.nheko.summary/summary/<roomId>")
|
||||||
@client.route("/_matrix/client/v1/room_summary/<roomId>")
|
@client.route("/_matrix/client/v1/room_summary/<roomId>")
|
||||||
async def room_summary(roomId):
|
async def room_summary(roomId):
|
||||||
room = config.room_dir_room["chunk"][0]
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
"room_id": globals.make_event_id().replace("$", "!"),
|
"room_id": globals.make_event_id().replace("$", "!"),
|
||||||
"avatar_url": f"mxc://{config.server_name}/cat",
|
"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/v3/keys/query", methods=["POST"])
|
||||||
@client.route("/_matrix/client/r0/keys/query", methods=["POST"])
|
@client.route("/_matrix/client/r0/keys/query", methods=["POST"])
|
||||||
async def query_keys():
|
async def query_keys():
|
||||||
# Should be replaced eventually
|
user = request.get_json()["device_keys"]
|
||||||
return jsonify({})
|
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/api/v1/createRoom", methods=["POST"])
|
||||||
@client.route("/_matrix/client/v3/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
|
from flask import Blueprint, jsonify, request, Response
|
||||||
import globals
|
import vona.globals as globals
|
||||||
import config
|
import vona.config as config
|
||||||
import base64
|
import base64
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
from flask import jsonify, Response, request, send_file, abort, Blueprint
|
from flask import jsonify, Response, request, send_file, abort, Blueprint
|
||||||
from config import *
|
from vona.config import *
|
||||||
import globals
|
import vona.globals as globals
|
||||||
import httpx
|
import httpx
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
|
|
||||||
server = Blueprint("s2s", __name__)
|
server = Blueprint("federation", __name__)
|
||||||
|
|
||||||
|
|
||||||
def send_join(request, roomId) -> dict:
|
def send_join(request, roomId) -> dict:
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
|
from importlib.metadata import version
|
||||||
|
import vona.config as config
|
||||||
import nacl.signing
|
import nacl.signing
|
||||||
import hashlib
|
import hashlib
|
||||||
import base64
|
import base64
|
||||||
import config
|
|
||||||
import random
|
import random
|
||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
vona_version = "1.4.1"
|
vona_version = version("vona")
|
||||||
|
|
||||||
|
|
||||||
def canonical_json(value):
|
def canonical_json(value):
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
from flask import Blueprint, jsonify, request
|
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
|
import time
|
||||||
|
|
||||||
identity = Blueprint("identity", __name__)
|
identity = Blueprint("identity", __name__)
|
||||||
Reference in New Issue
Block a user