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
5c8888d6
Commit
5c8888d6
authored
1 year ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
enhance(reversi): render ogp
parent
4af3640b
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
packages/backend/src/server/web/ClientServerService.ts
+25
-1
25 additions, 1 deletion
packages/backend/src/server/web/ClientServerService.ts
packages/backend/src/server/web/views/reversi-game.pug
+20
-0
20 additions, 0 deletions
packages/backend/src/server/web/views/reversi-game.pug
with
45 additions
and
1 deletion
packages/backend/src/server/web/ClientServerService.ts
+
25
−
1
View file @
5c8888d6
...
...
@@ -31,12 +31,13 @@ import { PageEntityService } from '@/core/entities/PageEntityService.js';
import
{
GalleryPostEntityService
}
from
'
@/core/entities/GalleryPostEntityService.js
'
;
import
{
ClipEntityService
}
from
'
@/core/entities/ClipEntityService.js
'
;
import
{
ChannelEntityService
}
from
'
@/core/entities/ChannelEntityService.js
'
;
import
type
{
ChannelsRepository
,
ClipsRepository
,
FlashsRepository
,
GalleryPostsRepository
,
MiMeta
,
NotesRepository
,
PagesRepository
,
UserProfilesRepository
,
UsersRepository
}
from
'
@/models/_.js
'
;
import
type
{
ChannelsRepository
,
ClipsRepository
,
FlashsRepository
,
GalleryPostsRepository
,
MiMeta
,
NotesRepository
,
PagesRepository
,
ReversiGamesRepository
,
UserProfilesRepository
,
UsersRepository
}
from
'
@/models/_.js
'
;
import
type
Logger
from
'
@/logger.js
'
;
import
{
deepClone
}
from
'
@/misc/clone.js
'
;
import
{
bindThis
}
from
'
@/decorators.js
'
;
import
{
FlashEntityService
}
from
'
@/core/entities/FlashEntityService.js
'
;
import
{
RoleService
}
from
'
@/core/RoleService.js
'
;
import
{
ReversiGameEntityService
}
from
'
@/core/entities/ReversiGameEntityService.js
'
;
import
{
FeedService
}
from
'
./FeedService.js
'
;
import
{
UrlPreviewService
}
from
'
./UrlPreviewService.js
'
;
import
{
ClientLoggerService
}
from
'
./ClientLoggerService.js
'
;
...
...
@@ -83,6 +84,9 @@ export class ClientServerService {
@
Inject
(
DI
.
flashsRepository
)
private
flashsRepository
:
FlashsRepository
,
@
Inject
(
DI
.
reversiGamesRepository
)
private
reversiGamesRepository
:
ReversiGamesRepository
,
private
flashEntityService
:
FlashEntityService
,
private
userEntityService
:
UserEntityService
,
private
noteEntityService
:
NoteEntityService
,
...
...
@@ -90,6 +94,7 @@ export class ClientServerService {
private
galleryPostEntityService
:
GalleryPostEntityService
,
private
clipEntityService
:
ClipEntityService
,
private
channelEntityService
:
ChannelEntityService
,
private
reversiGameEntityService
:
ReversiGameEntityService
,
private
metaService
:
MetaService
,
private
urlPreviewService
:
UrlPreviewService
,
private
feedService
:
FeedService
,
...
...
@@ -686,6 +691,25 @@ export class ClientServerService {
return
await
renderBase
(
reply
);
}
});
// Reversi game
fastify
.
get
<
{
Params
:
{
channel
:
string
;
}
}
>
(
'
/reversi/g/:game
'
,
async
(
request
,
reply
)
=>
{
const
game
=
await
this
.
reversiGamesRepository
.
findOneBy
({
id
:
request
.
params
.
game
,
});
if
(
game
)
{
const
_game
=
await
this
.
reversiGameEntityService
.
packDetail
(
game
);
const
meta
=
await
this
.
metaService
.
fetch
();
reply
.
header
(
'
Cache-Control
'
,
'
public, max-age=3600
'
);
return
await
reply
.
view
(
'
reversi-game
'
,
{
game
:
_game
,
...
this
.
generateCommonPugData
(
meta
),
});
}
else
{
return
await
renderBase
(
reply
);
}
});
//#endregion
fastify
.
get
(
'
/_info_card_
'
,
async
(
request
,
reply
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
packages/backend/src/server/web/views/reversi-game.pug
0 → 100644
+
20
−
0
View file @
5c8888d6
extends ./base
block vars
- const user1 = game.user1;
- const user2 = game.user2;
- const title = `${user1.username} vs ${user2.username}`;
- const url = `${config.url}/reversi/g/${game.id}`;
block title
= `${title} | ${instanceName}`
block desc
meta(name='description' content='⚫⚪Misskey Reversi⚪⚫')
block og
meta(property='og:type' content='article')
meta(property='og:title' content= title)
meta(property='og:description' content='⚫⚪Misskey Reversi⚪⚫')
meta(property='og:url' content= url)
meta(property='twitter:card' content='summary')
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