mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 06:09:08 +03:00
working supabase storage
This commit is contained in:
1 parent
a10eb3a5fb
commit
8a0f1109cc
11 files changed
+7886
-301
No files matched your search
@@ -0,0 +1,54 @@
|
||||
module.exports = ({ env }) => ({
|
||||
auth: {
|
||||
secret: env('ADMIN_JWT_SECRET'),
|
||||
},
|
||||
apiToken: {
|
||||
salt: env('API_TOKEN_SALT'),
|
||||
},
|
||||
transfer: {
|
||||
token: {
|
||||
salt: env('TRANSFER_TOKEN_SALT'),
|
||||
},
|
||||
},
|
||||
url: env('PUBLIC_URL', 'http://localhost:1337'),
|
||||
serveAdminPanel: true,
|
||||
config: {
|
||||
locales: ['en'],
|
||||
host: env('HOST', '0.0.0.0'),
|
||||
port: env.int('PORT', 1337),
|
||||
admin: {
|
||||
auth: {
|
||||
secret: env('ADMIN_JWT_SECRET'),
|
||||
},
|
||||
},
|
||||
},
|
||||
security: {
|
||||
csp: {
|
||||
enabled: false,
|
||||
policy: {
|
||||
'default-src': ["'self'"],
|
||||
'img-src': [
|
||||
"'self'",
|
||||
'data:',
|
||||
'blob:',
|
||||
'https://market-assets.strapi.io',
|
||||
'https://koovxkbhviltdcwwaqvc.supabase.co',
|
||||
'https://*.supabase.co',
|
||||
'https://*.supabase.in',
|
||||
],
|
||||
'media-src': [
|
||||
"'self'",
|
||||
'data:',
|
||||
'blob:',
|
||||
'https://market-assets.strapi.io',
|
||||
'https://koovxkbhviltdcwwaqvc.supabase.co',
|
||||
'https://*.supabase.co',
|
||||
'https://*.supabase.in',
|
||||
],
|
||||
'script-src': ["'self'", "'unsafe-inline'", "'unsafe-eval'"],
|
||||
'style-src': ["'self'", "'unsafe-inline'"],
|
||||
'connect-src': ["'self'", 'https:', 'http:'],
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -14,4 +14,24 @@ export default ({ env }) => ({
|
||||
nps: env.bool('FLAG_NPS', true),
|
||||
promoteEE: env.bool('FLAG_PROMOTE_EE', true),
|
||||
},
|
||||
});
|
||||
url: env('PUBLIC_URL', 'http://localhost:1337'),
|
||||
serveAdminPanel: true,
|
||||
config: {
|
||||
locales: ['en'],
|
||||
host: env('HOST', '0.0.0.0'),
|
||||
port: env.int('PORT', 1337),
|
||||
admin: {
|
||||
auth: {
|
||||
secret: env('ADMIN_JWT_SECRET'),
|
||||
},
|
||||
url: env('PUBLIC_URL', 'http://localhost:1337'),
|
||||
serveAdminPanel: true,
|
||||
watchIgnoreFiles: ['**/config/sync/**'],
|
||||
},
|
||||
},
|
||||
security: {
|
||||
csp: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -13,7 +13,7 @@ export default ({ env }) => {
|
||||
password: env('DATABASE_PASSWORD', 'postgres'),
|
||||
schema: env('DATABASE_SCHEMA', 'public'),
|
||||
ssl: env.bool('DATABASE_SSL', false) && {
|
||||
rejectUnauthorized: env.bool('DATABASE_SSL_REJECT_UNAUTHORIZED', false),
|
||||
rejectUnauthorized: env.bool('DATABASE_SSL_REJECT_UNAUTHORIZED', true),
|
||||
},
|
||||
},
|
||||
pool: {
|
||||
|
||||
@@ -7,16 +7,17 @@ export default ({ env }) => ({
|
||||
apiKey: env('SUPABASE_API_KEY'),
|
||||
bucket: env('SUPABASE_BUCKET'),
|
||||
directory: env('SUPABASE_DIRECTORY'),
|
||||
options: {},
|
||||
},
|
||||
actionOptions: {
|
||||
upload: {},
|
||||
uploadStream: {},
|
||||
delete: {},
|
||||
options: {
|
||||
cacheControl: 'public, max-age=31536000',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
'strapi-provider-upload-supabase': {
|
||||
enabled: true,
|
||||
// enabled: true,
|
||||
config: {
|
||||
baseUrl: `${env('SUPABASE_URL')}/storage/v1/object/public/${env('SUPABASE_BUCKET')}`,
|
||||
prefix: '',
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -26,11 +26,22 @@ const BlogGridItem = ({ post }: Props) => {
|
||||
}
|
||||
|
||||
console.log('post', post)
|
||||
// const imageUrl = post.isCMS
|
||||
// ? post.thumb
|
||||
// ? `${CMS_API_URL}${post.thumb}`
|
||||
// : post.image
|
||||
// ? `${CMS_API_URL}${post.image}`
|
||||
// : '/images/blog/blog-placeholder.png'
|
||||
// : typeof post.thumb === 'string'
|
||||
// ? post.type === 'casestudy'
|
||||
// ? post.thumb
|
||||
// : `/images/blog/${post.thumb}`
|
||||
// : '/images/blog/blog-placeholder.png'
|
||||
const imageUrl = post.isCMS
|
||||
? post.thumb
|
||||
? `${CMS_API_URL}${post.thumb}`
|
||||
? post.thumb
|
||||
: post.image
|
||||
? `${CMS_API_URL}${post.image}`
|
||||
? post.image
|
||||
: '/images/blog/blog-placeholder.png'
|
||||
: typeof post.thumb === 'string'
|
||||
? post.type === 'casestudy'
|
||||
|
||||
@@ -53,11 +53,22 @@ function FeaturedThumb(blog: PostTypes | CMSPostTypes) {
|
||||
function renderFeaturedThumb(blog: PostTypes, author: any[]) {
|
||||
console.log('blog', blog)
|
||||
console.log('author', author)
|
||||
// const imageUrl = blog.isCMS
|
||||
// ? blog.thumb
|
||||
// ? `${CMS_API_URL}${blog.thumb}`
|
||||
// : blog.image
|
||||
// ? `${CMS_API_URL}${blog.image}`
|
||||
// : '/images/blog/blog-placeholder.png'
|
||||
// : blog.thumb
|
||||
// ? `/images/blog/${blog.thumb}`
|
||||
// : blog.image
|
||||
// ? `/images/blog/${blog.image}`
|
||||
// : '/images/blog/blog-placeholder.png'
|
||||
const imageUrl = blog.isCMS
|
||||
? blog.thumb
|
||||
? `${CMS_API_URL}${blog.thumb}`
|
||||
? blog.thumb
|
||||
: blog.image
|
||||
? `${CMS_API_URL}${blog.image}`
|
||||
? blog.image
|
||||
: '/images/blog/blog-placeholder.png'
|
||||
: blog.thumb
|
||||
? `/images/blog/${blog.thumb}`
|
||||
|
||||
@@ -64,7 +64,7 @@ type ProcessedPost = {
|
||||
description: string
|
||||
date: string
|
||||
formattedDate: string
|
||||
readingTime: number
|
||||
readingTime: string
|
||||
authors: Array<{
|
||||
author: string
|
||||
author_id: string
|
||||
@@ -154,7 +154,9 @@ export async function getCMSPostBySlug(slug: string) {
|
||||
position: author.position || '',
|
||||
author_url: author.author_url || '#',
|
||||
author_image_url: author.author_image_url?.url
|
||||
? `${process.env.CMS_API_URL}${author.author_image_url.url}`
|
||||
? author.author_image_url.url.includes('http')
|
||||
? author.author_image_url?.url
|
||||
: `${process.env.CMS_API_URL}${author.author_image_url.url}`
|
||||
: null,
|
||||
username: author.username || '',
|
||||
})) || [],
|
||||
@@ -212,6 +214,8 @@ export async function getAllCMSPosts({
|
||||
const thumbUrl = (post.thumb as any)?.url
|
||||
const imageUrl = (post.image as any)?.url
|
||||
|
||||
console.log('imageUrl', imageUrl)
|
||||
|
||||
return {
|
||||
slug: post.slug || '',
|
||||
title: post.Title || '',
|
||||
@@ -226,7 +230,9 @@ export async function getAllCMSPosts({
|
||||
position: author.position || '',
|
||||
author_url: author.author_url || '#',
|
||||
author_image_url: author.author_image_url?.url
|
||||
? `${process.env.CMS_API_URL}${author.author_image_url.url}`
|
||||
? author.author_image_url.url.includes('http')
|
||||
? author.author_image_url.url
|
||||
: `${process.env.CMS_API_URL}${author.author_image_url.url}`
|
||||
: null,
|
||||
username: author.username || '',
|
||||
})) || [],
|
||||
|
||||
@@ -107,4 +107,10 @@ module.exports = [
|
||||
port: '1337',
|
||||
pathname: '/api/uploads/**',
|
||||
},
|
||||
{
|
||||
protocol: 'https',
|
||||
hostname: 'koovxkbhviltdcwwaqvc.supabase.co',
|
||||
port: '',
|
||||
pathname: '**',
|
||||
},
|
||||
]
|
||||
@@ -358,7 +358,7 @@ function BlogPostPage(props: InferGetStaticPropsType<typeof getStaticProps>) {
|
||||
</div>
|
||||
)
|
||||
|
||||
const imageUrl = isCMS ? `${CMS_API_URL}${props.blog.thumb}` : `/images/blog/${props.blog.thumb}`
|
||||
const imageUrl = isCMS ? props.blog.thumb! : `/images/blog/${props.blog.thumb}`
|
||||
|
||||
const meta = {
|
||||
title: props.blog.meta_title ?? props.blog.title,
|
||||
|
||||
+6
-13
@@ -5,21 +5,14 @@
|
||||
<link>https://supabase.com</link>
|
||||
<description>Latest news from Supabase</description>
|
||||
<language>en</language>
|
||||
<lastBuildDate>Mon, 28 Apr 2025 00:00:00 -0700</lastBuildDate>
|
||||
<lastBuildDate>Tue, 29 Apr 2025 00:00:00 -0700</lastBuildDate>
|
||||
<atom:link href="https://supabase.com/rss.xml" rel="self" type="application/rss+xml"/>
|
||||
<item>
|
||||
<guid>https://supabase.com/blog/test-blog-post</guid>
|
||||
<title>Test blog post</title>
|
||||
<link>https://supabase.com/blog/test-blog-post</link>
|
||||
<description>Description of blog post</description>
|
||||
<pubDate>Mon, 28 Apr 2025 00:00:00 -0700</pubDate>
|
||||
</item>
|
||||
<item>
|
||||
<guid>https://supabase.com/blog/blog-from-private-cms-schema</guid>
|
||||
<title>Blog post from cms schema</title>
|
||||
<link>https://supabase.com/blog/blog-from-private-cms-schema</link>
|
||||
<description>This comes from a private schema</description>
|
||||
<pubDate>Mon, 28 Apr 2025 00:00:00 -0700</pubDate>
|
||||
<guid>https://supabase.com/blog/assets-from-supabase-storage</guid>
|
||||
<title>CMS schema, Assets from Supabase Storage</title>
|
||||
<link>https://supabase.com/blog/assets-from-supabase-storage</link>
|
||||
<description>asfd</description>
|
||||
<pubDate>Tue, 29 Apr 2025 00:00:00 -0700</pubDate>
|
||||
</item>
|
||||
<item>
|
||||
<guid>https://supabase.com/blog/launch-week-14-top-10</guid>
|
||||
|
||||
Generated
+7754
-271
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user