Skip to content

Commit 52bb81d

Browse files
authored
⚡️ Limit logo to svg to reduce bandwidth usage (#195)
* ⚡️ Limit logo to svg to reduce bandwidth usage * Create changeset
1 parent 9d6b91d commit 52bb81d

File tree

4 files changed

+49
-1
lines changed

4 files changed

+49
-1
lines changed

.changeset/nine-goats-punch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"socialify": patch
3+
---
4+
5+
Limit logo to svg to reduce bandwidth usage

custom-rewrites.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/** @type {import('next').NextConfig["rewrites"]} */
2+
module.exports = [
3+
{
4+
source: '/:path*',
5+
has: [
6+
{
7+
type: 'query',
8+
key: 'logo',
9+
value:
10+
'https://raw.githubusercontent.com/Harry-Jing/EdgeGPT/master/.readme/Bing_favicon.png'
11+
}
12+
],
13+
destination:
14+
'/:path*?logo=https://upload.wikimedia.org/wikipedia/commons/9/9c/Bing_Fluent_Logo.svg'
15+
},
16+
{
17+
source: '/:path*',
18+
has: [
19+
{
20+
type: 'query',
21+
key: 'logo',
22+
value: 'https://s2.loli.net/2022/04/25/xOiJn7lCdcT5Mw1.png'
23+
}
24+
],
25+
destination:
26+
'/:path*?logo=https://user-images.githubusercontent.com/5880908/218407342-148803b6-742c-4f2a-b821-b260c7e28c29.png'
27+
},
28+
{
29+
source: '/:path*',
30+
has: [
31+
{
32+
type: 'query',
33+
key: 'logo',
34+
value: 'https://telegra.ph/file/01385a9f4cf0419682b87.png'
35+
}
36+
],
37+
destination:
38+
'/:path*?logo=https://user-images.githubusercontent.com/5880908/218408267-5ce0cd4b-ad02-4b56-87ef-d75b1c109659.png'
39+
}
40+
]

next.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
const CustomRewrites = require('./custom-rewrites')
2+
13
/** @type {import('next').NextConfig} */
24
const nextConfig = {
35
eslint: {
46
ignoreDuringBuilds: true
57
},
68
async rewrites() {
79
return [
10+
...CustomRewrites,
811
{
912
source: '/:_owner/:_name/image',
1013
destination: '/api/image'

src/components/configuration/config.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ const Config = ({ repository }: ConfigProp) => {
165165
handleChange={handleChange}
166166
/>
167167
<InputWrapper
168-
title="Logo"
168+
title="SVG Logo"
169169
alt="Image url or data uri"
170170
keyName="logo"
171171
placeholder="Optional"

0 commit comments

Comments
 (0)