Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sasagar committed Nov 11, 2023
1 parent 8f40f7d commit 4444f68
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions packages/backend/src/server/api/endpoints/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,29 @@ export const meta = {
properties: {
place: {
type: 'string',
optional: false, nullable: false,
optional: false,
nullable: false,
},
url: {
type: 'string',
optional: false, nullable: false,
optional: false,
nullable: false,
format: 'url',
},
imageUrl: {
type: 'string',
optional: false, nullable: false,
optional: false,
nullable: false,
format: 'url',
},
},
},
},
notesPerOneAd: {
type: 'number',
optional: false, nullable: false,
default: 0,
},
requireSetup: {
type: 'boolean',
optional: false, nullable: false,
Expand Down Expand Up @@ -214,11 +222,11 @@ export const meta = {
type: 'boolean',
optional: false, nullable: false,
},
localTimeLine: {
localTimeline: {
type: 'boolean',
optional: false, nullable: false,
},
globalTimeLine: {
globalTimeline: {
type: 'boolean',
optional: false, nullable: false,
},
Expand Down Expand Up @@ -279,10 +287,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
.where('ads.expiresAt > :now', { now: new Date() })
.andWhere('ads.startsAt <= :now', { now: new Date() })
.andWhere(new Brackets(qb => {
// ๆ›œๆ—ฅใฎใƒ“ใƒƒใƒˆใƒ•ใƒฉใ‚ฐใ‚’็ขบ่ชใ™ใ‚‹
qb.where('ads.dayOfWeek & :dayOfWeek > 0', { dayOfWeek: 1 << new Date().getDay() })
.orWhere('ads.dayOfWeek = 0');
}))
// ๆ›œๆ—ฅใฎใƒ“ใƒƒใƒˆใƒ•ใƒฉใ‚ฐใ‚’็ขบ่ชใ™ใ‚‹
qb.where('ads.dayOfWeek & :dayOfWeek > 0', { dayOfWeek: 1 << new Date().getDay() })
.orWhere('ads.dayOfWeek = 0');
}))
.getMany();

const response: any = {
Expand All @@ -299,6 +307,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
tosUrl: instance.termsOfServiceUrl,
repositoryUrl: instance.repositoryUrl,
feedbackUrl: instance.feedbackUrl,
impressumUrl: instance.impressumUrl,
privacyPolicyUrl: instance.privacyPolicyUrl,
disableRegistration: instance.disableRegistration,
emailRequiredForSignup: instance.emailRequiredForSignup,
enableHcaptcha: instance.enableHcaptcha,
Expand All @@ -319,7 +329,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
logoImageUrl: instance.logoImageUrl,
maxNoteTextLength: MAX_NOTE_TEXT_LENGTH,
// ใ‚ฏใƒฉใ‚คใ‚ขใƒณใƒˆใฎๆ‰‹้–“ใ‚’ๆธ›ใ‚‰ใ™ใŸใ‚ใ‚ใ‚‰ใ‹ใ˜ใ‚JSONใซๅค‰ๆ›ใ—ใฆใŠใ
defaultLightTheme: instance.defaultLightTheme ? JSON.stringify(JSON5.parse(instance.defaultLightTheme)) : null,
defaultLightTheme: instance.defaultLightTheme ? JSON.stringify(JSON5.parse(instance.defaultLightTheme)) : null,
defaultDarkTheme: instance.defaultDarkTheme ? JSON.stringify(JSON5.parse(instance.defaultDarkTheme)) : null,
ads: ads.map(ad => ({
id: ad.id,
Expand All @@ -329,6 +339,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
imageUrl: ad.imageUrl,
dayOfWeek: ad.dayOfWeek,
})),
notesPerOneAd: instance.notesPerOneAd,
enableEmail: instance.enableEmail,
enableServiceWorker: instance.enableServiceWorker,

Expand All @@ -341,12 +352,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
mediaProxy: this.config.mediaProxy,

...(ps.detail ? {
cacheRemoteFiles: instance.cacheRemoteFiles,
cacheRemoteSensitiveFiles: instance.cacheRemoteSensitiveFiles,
requireSetup: (await this.usersRepository.countBy({
host: IsNull(),
})) === 0,
} : {}),
cacheRemoteFiles: instance.cacheRemoteFiles,
cacheRemoteSensitiveFiles: instance.cacheRemoteSensitiveFiles,
requireSetup: (await this.usersRepository.countBy({
host: IsNull(),
})) === 0,
} : {}),
};

if (ps.detail) {
Expand Down

0 comments on commit 4444f68

Please sign in to comment.