Compare commits
5 Commits
051408fcdd
...
main
Author | SHA1 | Date | |
---|---|---|---|
a7ef859c43 | |||
ba06de2c11 | |||
8dcdd27745 | |||
a43bcc9c14 | |||
71800440be |
@@ -31,7 +31,7 @@ var Config *config
|
||||
func Load() *config {
|
||||
err := godotenv.Load()
|
||||
if err != nil {
|
||||
slog.Error("Error loading .env file - Using environment variables instead")
|
||||
slog.Warn("Error loading .env file - Using environment variables instead")
|
||||
}
|
||||
|
||||
// Get mastodon instance
|
||||
@@ -86,7 +86,7 @@ func Load() *config {
|
||||
|
||||
imageKitId := os.Getenv("CAOM_IMAGEKIT_ID")
|
||||
if imageKitId == "" {
|
||||
slog.Info("No imagekit id provided, not using imagekit")
|
||||
slog.Info("No imagekit id provided, not using imagekit.io")
|
||||
}
|
||||
// Inititlize AppContext
|
||||
var appContext = &config{
|
||||
|
@@ -12,9 +12,15 @@ func InitImgKitHelper() {
|
||||
}
|
||||
|
||||
func GetPreviewUrl(url string) string {
|
||||
return "https://ik.imagekit.io/" + config.Config.ImageKitId + "/tr:w-500,h-500,c-at_max,f-webp,q-60/" + url
|
||||
if config.Config.ImageKitId == "" {
|
||||
return url
|
||||
}
|
||||
return "https://ik.imagekit.io/" + config.Config.ImageKitId + "/tr:w-500,h-500,c-at_max,f-webp,q-50/" + url
|
||||
}
|
||||
|
||||
func GetRemoteUrl(url string) string {
|
||||
if config.Config.ImageKitId == "" {
|
||||
return url
|
||||
}
|
||||
return "https://ik.imagekit.io/" + config.Config.ImageKitId + "/tr:q-70,dpr-auto,f-webp/" + url
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ func (ps *AdminDashboardHandler) RejectMedia(c *gin.Context) {
|
||||
|
||||
func (ps *AdminDashboardHandler) GetMedia(c *gin.Context) {
|
||||
media := ps.PostService.GetMedia()
|
||||
media.PreviewUrl = services.GetPreviewUrl(media.PreviewUrl)
|
||||
media.PreviewUrl = services.GetPreviewUrl(media.RemoteUrl)
|
||||
media.RemoteUrl = services.GetPreviewUrl(media.RemoteUrl)
|
||||
c.JSON(http.StatusOK, media)
|
||||
}
|
||||
|
@@ -21,9 +21,9 @@ func InitApiEndpointHandler() {
|
||||
|
||||
func (ps *ApiEndpointHandler) GetRandomPost(c *gin.Context) {
|
||||
post := ps.PostService.GetRandomPost()
|
||||
for _, attachment := range post.Attachments {
|
||||
attachment.RemoteUrl = services.GetRemoteUrl(attachment.RemoteUrl)
|
||||
attachment.PreviewUrl = services.GetPreviewUrl(attachment.RemoteUrl)
|
||||
for i := range post.Attachments {
|
||||
post.Attachments[i].RemoteUrl = services.GetRemoteUrl(post.Attachments[i].RemoteUrl)
|
||||
post.Attachments[i].PreviewUrl = services.GetPreviewUrl(post.Attachments[i].RemoteUrl)
|
||||
}
|
||||
c.JSON(200, post)
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@@ -13,11 +13,13 @@
|
||||
<meta property="og:type" content="website" />
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<script type="module" crossorigin src="/admin/assets/index-Do3iuUd_.js"></script>
|
||||
<script type="module" crossorigin src="/admin/assets/index-JxecVd-K.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/admin/assets/index-DShmOgsI.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<!-- IMPORTANT: DO NOT REMOVE THIS SCRIPT TAG OR THIS VERY COMMENT! -->
|
||||
<script src="https://cdn.gpteng.co/gptengineer.js" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -1,3 +1,2 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
Disallow: /admin
|
||||
Disallow: /
|
Reference in New Issue
Block a user