mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-23 23:17:58 +00:00
Compare commits
No commits in common. "85825f6de1b1edba19a41122a4104dc99f7e43ce" and "de190fcdd3b81159795a7f5d8e917390663c4cf6" have entirely different histories.
85825f6de1
...
de190fcdd3
|
@ -14,11 +14,11 @@ classifiers = [
|
||||||
"Programming Language :: Python :: 3.12"
|
"Programming Language :: Python :: 3.12"
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitypub-utils >= 0.3.2, < 0.4",
|
"activitypub-utils >= 0.3.1.post1, < 0.4.0",
|
||||||
"aiohttp >= 3.9.5",
|
"aiohttp >= 3.9.5",
|
||||||
"aiohttp-swagger[performance] == 1.0.16",
|
"aiohttp-swagger[performance] == 1.0.16",
|
||||||
"argon2-cffi == 23.1.0",
|
"argon2-cffi == 23.1.0",
|
||||||
"barkshark-lib >= 0.2.2.post2, < 0.3.0",
|
"barkshark-lib >= 0.1.6, < 0.2.0",
|
||||||
"barkshark-sql >= 0.2.0rc2, < 0.3.0",
|
"barkshark-sql >= 0.2.0rc2, < 0.3.0",
|
||||||
"click == 8.1.2",
|
"click == 8.1.2",
|
||||||
"hiredis == 2.3.2",
|
"hiredis == 2.3.2",
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
import sqlite3
|
|
||||||
|
|
||||||
from blib import Date
|
|
||||||
from bsql import Database
|
from bsql import Database
|
||||||
|
|
||||||
from .config import THEMES, ConfigData
|
from .config import THEMES, ConfigData
|
||||||
|
@ -12,9 +9,6 @@ from ..config import Config
|
||||||
from ..misc import get_resource
|
from ..misc import get_resource
|
||||||
|
|
||||||
|
|
||||||
sqlite3.register_adapter(Date, Date.timestamp)
|
|
||||||
|
|
||||||
|
|
||||||
def get_database(config: Config, migrate: bool = True) -> Database[Connection]:
|
def get_database(config: Config, migrate: bool = True) -> Database[Connection]:
|
||||||
options = {
|
options = {
|
||||||
'connection_class': Connection,
|
'connection_class': Connection,
|
||||||
|
|
|
@ -230,10 +230,12 @@ class HttpClient:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
async def fetch_nodeinfo(self, domain: str, force: bool = False) -> Nodeinfo:
|
async def fetch_nodeinfo(self, domain: str) -> Nodeinfo:
|
||||||
nodeinfo_url = None
|
nodeinfo_url = None
|
||||||
wk_nodeinfo = await self.get(
|
wk_nodeinfo = await self.get(
|
||||||
f'https://{domain}/.well-known/nodeinfo', False, WellKnownNodeinfo, force
|
f'https://{domain}/.well-known/nodeinfo',
|
||||||
|
False,
|
||||||
|
WellKnownNodeinfo
|
||||||
)
|
)
|
||||||
|
|
||||||
for version in ('20', '21'):
|
for version in ('20', '21'):
|
||||||
|
@ -246,7 +248,7 @@ class HttpClient:
|
||||||
if nodeinfo_url is None:
|
if nodeinfo_url is None:
|
||||||
raise ValueError(f'Failed to fetch nodeinfo url for {domain}')
|
raise ValueError(f'Failed to fetch nodeinfo url for {domain}')
|
||||||
|
|
||||||
return await self.get(nodeinfo_url, False, Nodeinfo, force)
|
return await self.get(nodeinfo_url, False, Nodeinfo)
|
||||||
|
|
||||||
|
|
||||||
async def get(*args: Any, **kwargs: Any) -> Any:
|
async def get(*args: Any, **kwargs: Any) -> Any:
|
||||||
|
|
|
@ -362,15 +362,10 @@ def cli_config_list(ctx: click.Context) -> None:
|
||||||
def cli_config_set(ctx: click.Context, key: str, value: Any) -> None:
|
def cli_config_set(ctx: click.Context, key: str, value: Any) -> None:
|
||||||
'Set a config value'
|
'Set a config value'
|
||||||
|
|
||||||
try:
|
with ctx.obj.database.session() as conn:
|
||||||
with ctx.obj.database.session() as conn:
|
new_value = conn.put_config(key, value)
|
||||||
new_value = conn.put_config(key, value)
|
|
||||||
|
|
||||||
except:
|
print(f'{key}: {repr(new_value)}')
|
||||||
click.echo('Invalid config name:', key)
|
|
||||||
return
|
|
||||||
|
|
||||||
click.echo(f'{key}: {repr(new_value)}')
|
|
||||||
|
|
||||||
|
|
||||||
@cli.group('user')
|
@cli.group('user')
|
||||||
|
|
|
@ -58,7 +58,7 @@ async def handle_forward(view: ActorView, conn: Connection) -> None:
|
||||||
|
|
||||||
|
|
||||||
async def handle_follow(view: ActorView, conn: Connection) -> None:
|
async def handle_follow(view: ActorView, conn: Connection) -> None:
|
||||||
nodeinfo = await view.client.fetch_nodeinfo(view.actor.domain, force = True)
|
nodeinfo = await view.client.fetch_nodeinfo(view.actor.domain)
|
||||||
software = nodeinfo.sw_name if nodeinfo else None
|
software = nodeinfo.sw_name if nodeinfo else None
|
||||||
config = conn.get_config_all()
|
config = conn.get_config_all()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue