Compare commits

...

5 Commits

Author SHA1 Message Date
9d0e19c56f 🐛 Fix chat messages 2025-01-15 15:14:13 +08:00
acf4e634fe 🐛 Fix websocket will put message in wrong channel 2025-01-14 23:32:02 +08:00
25942c2338 💄 Optimize chat max width 2025-01-14 23:30:35 +08:00
a4f81f6ba1 🐛 Post auto warp 2025-01-14 23:24:11 +08:00
c1b9090e51 💄 Optimized attachment list 2025-01-14 23:17:34 +08:00
7 changed files with 53 additions and 10 deletions

View File

@ -1,6 +1,6 @@
{ {
"sync": { "sync": {
"region": "solian-next", "region": "solian",
"configPath": "roadsign.toml" "configPath": "roadsign.toml"
}, },
"deployments": [ "deployments": [

View File

@ -74,6 +74,7 @@ class ChatMessageController extends ChangeNotifier {
_wsSubscription = _ws.stream.stream.listen((event) { _wsSubscription = _ws.stream.stream.listen((event) {
switch (event.method) { switch (event.method) {
case 'events.new': case 'events.new':
if (event.payload?['channel_id'] != channel?.id) break;
final payload = SnChatMessage.fromJson(event.payload!); final payload = SnChatMessage.fromJson(event.payload!);
_addMessage(payload); _addMessage(payload);
break; break;

View File

@ -106,6 +106,44 @@ class _AttachmentListState extends State<AttachmentList> {
} }
if (widget.gridded) { if (widget.gridded) {
final fullOfImage =
widget.data.where((ele) => ele?.mediaType == SnMediaType.image).length == widget.data.length;
if(!fullOfImage) {
return Container(
margin: widget.padding ?? EdgeInsets.zero,
decoration: BoxDecoration(
color: backgroundColor,
border: Border(
top: borderSide,
bottom: borderSide,
),
borderRadius: AttachmentList.kDefaultRadius,
),
child: ClipRRect(
borderRadius: AttachmentList.kDefaultRadius,
child: Column(
spacing: 4,
children: widget.data
.mapIndexed(
(idx, ele) => GestureDetector(
child: AspectRatio(
aspectRatio: ele?.data['ratio']?.toDouble() ?? 1,
child: Container(
constraints: constraints,
child: AttachmentItem(
data: ele,
heroTag: heroTags[idx],
fit: BoxFit.cover,
),
),
),
),
)
.toList(),
),
),
);
}
return Container( return Container(
margin: widget.padding ?? EdgeInsets.zero, margin: widget.padding ?? EdgeInsets.zero,
decoration: BoxDecoration( decoration: BoxDecoration(

View File

@ -251,9 +251,12 @@ class _ChatMessageText extends StatelessWidget {
buttonItems: items, buttonItems: items,
); );
}, },
child: MarkdownTextContent( child: Container(
content: data.body['text'], constraints: const BoxConstraints(maxWidth: 480),
isAutoWarp: true, child: MarkdownTextContent(
content: data.body['text'],
isAutoWarp: true,
),
), ),
), ),
if (data.updatedAt != data.createdAt) if (data.updatedAt != data.createdAt)

View File

@ -117,7 +117,7 @@ class ChatMessageInputState extends State<ChatMessageInput> {
// Send the message // Send the message
// NOTICE This future should not be awaited, so that the message can be sent in the background and the user can continue to type // NOTICE This future should not be awaited, so that the message can be sent in the background and the user can continue to type
widget.controller.sendMessage( widget.controller.sendMessage(
'messages.new', _editingMessage != null ? 'messages.edit' : 'messages.new',
_contentController.text, _contentController.text,
attachments: _attachments.where((e) => e.attachment != null).map((e) => e.attachment!.rid).toList(), attachments: _attachments.where((e) => e.attachment != null).map((e) => e.attachment!.rid).toList(),
relatedId: _editingMessage?.id, relatedId: _editingMessage?.id,

View File

@ -880,6 +880,7 @@ class _PostContentBody extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (data.body['content'] == null) return const SizedBox.shrink(); if (data.body['content'] == null) return const SizedBox.shrink();
final content = MarkdownTextContent( final content = MarkdownTextContent(
isAutoWarp: data.type == 'story',
isEnlargeSticker: true, isEnlargeSticker: true,
textScaler: isEnlarge ? TextScaler.linear(1.1) : null, textScaler: isEnlarge ? TextScaler.linear(1.1) : null,
content: data.body['content'], content: data.body['content'],

View File

@ -1,9 +1,9 @@
id = "solian-next" id = "solian"
[[locations]] [[locations]]
id = "solian-next" id = "solian"
host = ["sn-next.solsynth.dev"] host = ["sn.solsynth.dev"]
path = ["/"] path = ["/"]
[[locations.destinations]] [[locations.destinations]]
id = "solian-next-web" id = "solian-web"
uri = "files:///workdir/solian-next?fallback=index.html&index=index.html" uri = "files:///workdir/solian?fallback=index.html&index=index.html"