drop support for full @user@instance handles
This is unnecessary because it only supports local users anyway plus no finger client will send the hostname
This commit is contained in:
parent
fc13d46022
commit
eabd97db32
15
fingerd.py
15
fingerd.py
|
@ -17,23 +17,14 @@ with open('fingerd.toml') as f:
|
|||
|
||||
async def handle_finger(reader, writer):
|
||||
try:
|
||||
data = await reader.read(
|
||||
len('@') * 2
|
||||
+ MASTODON_USERNAME_MAX_LENGTH
|
||||
+ len(config['instance_name'])
|
||||
)
|
||||
handle = data.decode().rstrip()
|
||||
data = await reader.read(MASTODON_USERNAME_MAX_LENGTH)
|
||||
username = data.decode().rstrip()
|
||||
|
||||
if not handle:
|
||||
if not username:
|
||||
# `finger @instance.example`
|
||||
await handle_finger_instance(reader, writer)
|
||||
return
|
||||
|
||||
username = handle.removeprefix('@').removesuffix('@' + config['instance_name'])
|
||||
if '@' in username:
|
||||
writer.write(b'Error: user must be local to this instance\n')
|
||||
return
|
||||
|
||||
resp = await db.get().fetchval(
|
||||
'SELECT note FROM accounts WHERE username = $1 AND domain IS NULL',
|
||||
username,
|
||||
|
|
Reference in New Issue