host in this server

This commit is contained in:
cutls 2023-02-09 19:36:14 +09:00 committed by ThatOneCalculator
parent e34f22fbc5
commit fcd8bdce4b
No known key found for this signature in database
GPG key ID: 8703CACD01000000
2 changed files with 8 additions and 4 deletions

View file

@ -82,8 +82,11 @@ namespace MisskeyAPI {
export const userDetail = (u: Entity.UserDetail, host: string): MegalodonEntity.Account => {
let acct = u.username
if (host || u.host) {
acct = `${u.username}@${host || u.host}`
host = host.replace('https://', '')
let acctUrl = `https://${host || u.host || 'example.com'}/@${u.username}`
if (u.host) {
acct = `${u.username}@${u.host}`
acctUrl = `https://${u.host}/@${u.username}`
}
return {
id: u.id,
@ -104,7 +107,7 @@ namespace MisskeyAPI {
emojis: u.emojis.map(e => emoji(e)),
moved: null,
fields: [],
bot: u.isBot
bot: u.isBot,
}
}
@ -215,6 +218,7 @@ namespace MisskeyAPI {
}
export const note = (n: Entity.Note, host: string): MegalodonEntity.Status => {
host = host.replace('https://', '')
return {
id: n.id,
uri: n.uri ? n.uri : `https://${host}/notes/${n.id}`,

View file

@ -30,7 +30,7 @@
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
"noUnusedLocals": true, /* Report errors on unused locals. */
"noUnusedLocals": false, /* Report errors on unused locals. */
"noUnusedParameters": true, /* Report errors on unused parameters. */
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */