Skip to content

Commit

Permalink
Add s3address to public settings (for images preconnect link) (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
mczachurski authored Oct 17, 2024
1 parent 5611624 commit 13236fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Sources/VernissageServer/Controllers/SettingsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,14 @@ struct SettingsController {
let settings = SettingsDto(basedOn: settingsFromDatabase)
let webPushVapidPublicKey = settings.isWebPushEnabled ? settings.webPushVapidPublicKey : nil

let appplicationSettings = request.application.settings.cached
let s3Address = appplicationSettings?.s3Address

let publicSettingsDto = PublicSettingsDto(webSentryDsn: webSentryDsn,
maximumNumberOfInvitations: settings.maximumNumberOfInvitations,
isOpenAIEnabled: settings.isOpenAIEnabled,
webPushVapidPublicKey: webPushVapidPublicKey,
s3Address: s3Address,
patreonUrl: settings.patreonUrl,
mastodonUrl: settings.mastodonUrl,
totalCost: settings.totalCost,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct PublicSettingsDto {
var maximumNumberOfInvitations: Int
var isOpenAIEnabled: Bool
var webPushVapidPublicKey: String?
var s3Address: String?

var patreonUrl: String?
var mastodonUrl: String?
Expand Down
2 changes: 1 addition & 1 deletion Sources/VernissageServer/Services/ActivityPubService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ final class ActivityPubService: ActivityPubServiceType {
let noteDto = try await self.downloadRemoteStatus(on: context, activityPubId: activityPubId)

if noteDto.attachment?.contains(where: { $0.mediaType.starts(with: "image/") }) == false {
context.logger.error("Object doesn't contain any image media type attachments (status: \(noteDto.id).")
context.logger.warning("Object doesn't contain any image media type attachments (status: \(noteDto.id).")
throw ActivityPubError.missingAttachments(activityPubId)
}

Expand Down

0 comments on commit 13236fd

Please sign in to comment.