alias the second
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 18s
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 18s
This commit is contained in:
parent
4e2cfb8637
commit
6852ac40d1
|
@ -211,6 +211,19 @@ export default async bot => {
|
|||
await fs.promises.copyFile(source, `./public/b/${filename}`);
|
||||
await fs.promises.unlink(source).catch(_=>{});
|
||||
|
||||
// user alias
|
||||
let username = e.user.nick || e.user.username;
|
||||
const alias = (await db`
|
||||
select "user"."user"
|
||||
from "user_alias"
|
||||
join "user" on "user".id = user_alias.userid
|
||||
where lower(user_alias.alias) ilike ${username}
|
||||
limit 1
|
||||
`)?.[0]?.user;
|
||||
if(alias) {
|
||||
username = alias;
|
||||
}
|
||||
|
||||
await db`
|
||||
insert into items ${
|
||||
db({
|
||||
|
@ -219,7 +232,7 @@ export default async bot => {
|
|||
mime: mime,
|
||||
size: size,
|
||||
checksum: checksum,
|
||||
username: e.user.nick || e.user.username,
|
||||
username: username,
|
||||
userchannel: e.channel,
|
||||
usernetwork: e.network,
|
||||
stamp: ~~(new Date() / 1000),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="pagewrapper">
|
||||
<div id="main">
|
||||
<div class="index-container">
|
||||
@if(tmp.user)<h2>user: {!! tmp.user.toLowerCase() !!}@if(tmp.mime) ({{ tmp.mime }}s)@else (all)@endif</h2>@endif
|
||||
@if(tmp.user)<h2>user: <a href="/user/{{ tmp.user.toLowerCase() }}">{!! tmp.user.toLowerCase() !!}</a>@if(tmp.mime) ({{ tmp.mime }}s)@else (all)@endif</h2>@endif
|
||||
@if(tmp.tag)<h2>tag: @if(session)<a href="/search?tag={!! tmp.tag.toLowerCase() !!}" target="_blank">{!! tmp.tag.toLowerCase() !!}</a>@else{!! tmp.tag.toLowerCase() !!}@endif@if(tmp.mime) ({{ tmp.mime }}s)@else (all)@endif</h2>@endif
|
||||
<div class="posts">
|
||||
@each(items as item)
|
||||
|
|
Loading…
Reference in New Issue
Block a user