Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dima Krasner
Sharkey
Commits
466c0832
Unverified
Commit
466c0832
authored
3 years ago
by
rinsuki
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
カスタム絵文字をproxyに通すように (#7526)
parent
ae226722
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/client/scripts/get-static-image-url.ts
+5
-0
5 additions, 0 deletions
src/client/scripts/get-static-image-url.ts
src/misc/populate-emojis.ts
+6
-1
6 additions, 1 deletion
src/misc/populate-emojis.ts
with
11 additions
and
1 deletion
src/client/scripts/get-static-image-url.ts
+
5
−
0
View file @
466c0832
...
...
@@ -3,6 +3,11 @@ import * as url from '../../prelude/url';
export
function
getStaticImageUrl
(
baseUrl
:
string
):
string
{
const
u
=
new
URL
(
baseUrl
);
if
(
u
.
href
.
startsWith
(
`
${
instanceUrl
}
/proxy/`
))
{
// もう既にproxyっぽそうだったらsearchParams付けるだけ
u
.
searchParams
.
set
(
'
static
'
,
'
1
'
);
return
u
.
href
;
}
const
dummy
=
`
${
u
.
host
}${
u
.
pathname
}
`
;
// 拡張子がないとキャッシュしてくれないCDNがあるので
return
`
${
instanceUrl
}
/proxy/
${
dummy
}
?
${
url
.
query
({
url
:
u
.
href
,
...
...
This diff is collapsed.
Click to expand it.
src/misc/populate-emojis.ts
+
6
−
1
View file @
466c0832
...
...
@@ -5,6 +5,8 @@ import { Note } from '../models/entities/note';
import
{
Cache
}
from
'
./cache
'
;
import
{
isSelfHost
,
toPunyNullable
}
from
'
./convert-host
'
;
import
{
decodeReaction
}
from
'
./reaction-lib
'
;
import
config
from
'
@/config
'
;
import
{
query
}
from
'
@/prelude/url
'
;
const
cache
=
new
Cache
<
Emoji
|
null
>
(
1000
*
60
*
60
*
12
);
...
...
@@ -59,9 +61,12 @@ export async function populateEmoji(emojiName: string, noteUserHost: string | nu
if
(
emoji
==
null
)
return
null
;
const
isLocal
=
emojiName
.
endsWith
(
'
@.
'
);
const
url
=
isLocal
?
emoji
.
url
:
`
${
config
.
url
}
/proxy/image.png?
${
query
({
url
:
emoji
.
url
})}
`
;
return
{
name
:
emojiName
,
url
:
emoji
.
url
,
url
,
};
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment