From 8fb277074f3ed21c6d3e667f9d6abfdf3d8461f6 Mon Sep 17 00:00:00 2001 From: icarus-ai <82353054+icarus-ai@users.noreply.github.com> Date: Thu, 14 Nov 2024 21:09:05 +0800 Subject: [PATCH] embed: load DefaultThumb --- message/default_thumb.jpg | Bin 0 -> 3894 bytes message/elements.go | 6 ++++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 message/default_thumb.jpg diff --git a/message/default_thumb.jpg b/message/default_thumb.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0c268da63f7771e53c1db0e15fa90d09cf67e188 GIT binary patch literal 3894 zcmbVOU2q#$6+U-&wO+3!SGHA0Q9^1tv02l)NcARhn-bPiojMwMP~uV=O&)BuQ6&SJ z^gr#ubmiDiYTAcT1B!Xsnji|(mlBsYJh_RTQf54(#%@UiooNCD2s|W|{|C%>uG~x? z0quC@S?xXdJKy=vckb$i)ek9{+O>NZ2|*-q(dxfx-Mt469(Z)*@dFRF<(_UEI#@h3 z^4Q}CR)0z3WY*Ogb-HO7MuTZKG=_tXfk5M@ZfU?lyOVbhZ2#QO9l~sAXbd!N3co|+8tEL~GY6DdtX zZ4#>sViw?iLVjrNBNSEh>2*fE*$^Z}sH&o=KA)!H&9CD((wcnD(RiQUvS*~O{gKce zrQ;96-aGF~-qXM9-hthzq5Hmg z|Cb)vmwoV|1Nnyw#nHzef8xof4nO_Ok@1PiqsN|``sRz%-}?4<$|q)KzjyNcl^?wP z!yo1fEt~dAXsT+BurTvbQ5lS3? z>D4#uH}~wlc6090cg)r;_N9*NoRZAwze{NB|H|k_LO1eRy-0plpkQhfeV#6hS6+Ba z_v%!qVTO9reKVA^38SNm=T0 zGYYP@kE6`Gn|#!3YImE!qhC3-wZ-1Y%RsN;?=yv;D2d($CCBETGM20&U1}ODWH-%_!K1GPv=jdH-u4FO@ zIvk>FR`5eh^iyv}>pZm$3*=rQnx;%N5Zl1%uZ8H2nFz2*VXtqB;!eX-L1b4^ z+e(!AQ#lW%3PC$f_vc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 HcmV?d00001 diff --git a/message/elements.go b/message/elements.go index d78e9b0..9a7dce8 100644 --- a/message/elements.go +++ b/message/elements.go @@ -4,13 +4,14 @@ package message import ( "bytes" - "encoding/base64" "fmt" "io" "os" "path/filepath" "strconv" + _ "embed" + "github.com/tidwall/gjson" "github.com/LagrangeDev/LagrangeGo/client/packets/pb/message" @@ -20,7 +21,8 @@ import ( "github.com/LagrangeDev/LagrangeGo/utils/crypto" ) -var DefaultThumb, _ = base64.StdEncoding.DecodeString("/9j/4AAQSkZJRgABAQAAAQABAAD//gAXR2VuZXJhdGVkIGJ5IFNuaXBhc3Rl/9sAhAAKBwcIBwYKCAgICwoKCw4YEA4NDQ4dFRYRGCMfJSQiHyIhJis3LyYpNCkhIjBBMTQ5Oz4+PiUuRElDPEg3PT47AQoLCw4NDhwQEBw7KCIoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCAF/APADAREAAhEBAxEB/8QBogAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoLEAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+foBAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKCxEAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcb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DQA00wENACYoATFMBpFADSKAEoEJQAUAFABQAlMQtAgoASgQUAJQAUAKKAHCgBaBBQBbrM1CgAoAKACmAUAJQAlADaYBQAlACYpgIRQA0igBpFAhtABQAUAFMAoEFABQIKAEoASgQUALQAooAWgQUAW81mbC0CCgApgFACUAIaAEpgJQAUAFABQAhFMBpFADSKAGkUCExQAYoAMUAGKADFMQYoAMUCExSATFABQIKYBQAtABQIt5qDYM0ALmgQtIApgIaAENADaACmAlAC0ALQAUwGkUANIoAaRQAmKBBigAxQAYoAMUAGKBBigBMUAJigQmKAExTAKBC0AFAFnNQaig0AKDQAtAgoASgBDQAlMBKACgAFADhQAtMBCKAGkUAIRQAmKADFABigQmKADFACYoAXFABigQmKAExQAmKBCYpgJigAoAnzUGgZoAcDQAuaBC0AJQAhoASmAlABQAtADhQAtMAoATFACEUAJigAxQAYoATFAhMUAFABQAuKADFABigBpWgBCKBCYpgJigB+ag0DNADgaBDgaAFzQITNACUAJTAKACgBRQAopgOoAWgBKAEoAKACgAoASgBpoEJQAooAWgBaBhigBMUCEIoAQigBMUAJSLCgBQaBDgaQC5oEFACUwCgBKACmAtADhQA4UALQAUAJQAUAJQAUAJQAhoENoAWgBRQAooGLQAUAGKAGkUAIRQIZSKEoGKKBDhQAUCCgAoAKBBQAUwFoGKKAHCgBaACgAoASgAoASgBCaAEoEJmgAoAUGgBQaAHZoGFABQAUANoAjpDEoAWgBaAFoEFACUALQAUCCmAUAOFAxRQAtAC0AJQAUAJQAmaBDSaAEzQAmaYBmgBQaAHA0gFzQAuaBhmgAzQAlAEdIYUALQAtAgoAKAEoEFAC0AFMAoAUUDFFAC0ALQAUAJQAhoENNACE0wEoATNABmgBc0ALmgBc0gDNAC5oATNABmgBKRQlACigB1AgoASgQlABTAWgBKACgBaBi0ALQAZoAM0AFACGgQ00wENACUAJQAUCFzQMM0ALmgAzQAZoAM0AGaQC0igoAUUALQIWgBDQISmAUAFACUAFABQAuaBi5oAM0AGaBBmgBKAEpgIaAG0AJQAUCFoAM0DDNAC5oATNABmgAzQBJUlBQAooAWgQtACGmIaaACgAoASgBKACgBc0DCgQUAGaADNABTASgBDQAlACUAFAgoAKBhQAUAFABQAlAE1SUFAxRQIWgQtMBDQIQ0AJQAlAhKBiUAFABmgBc0AGaADNABTAKACgBKAEoASgQlABQAUAFAC0AFACUAFAE1SaBQAUCHCgQtMBKBCUAJQISgBDQA00DEzQAuaADNMBc0AGaADNABQAUAJQAlABQISgAoAKACgBaACgBKAEoAnqTQSgBRQIcKBC0xCUAJQISgBKAENADDQAmaYwzQAuaADNAC0AFABQAUAFAhKACgBKACgAoAWgAoELQAlAxKAJqk0EoAWgQooELTEFADaBCUABoENNMY00ANNAwzQAZoAXNAC0AFAC0CFoASgAoASgBKACgAoAWgQtABQAUANNAyWpNAoAKBCimIWgQUCEoASmIQ0ANNADTQMaaAEoGLmgAzQAtADhQIWgBaACgQhoASgYlACUALQIWgBaACgBKAENAyWpNBKYBQIcKBC0CEoEJTAKBCUANNADDQMQ0ANoGFAC5oAUGgBwNAhRQIWgBaAENACGgBtAwoAKAFzQIXNABmgAoAQ0DJKRoJQAtAhRQSLQIKYCUCCgBDQA00AMNAxpoGNoAM0AGaAFBoAcDQIcKBDqACgBDQAhoAQ0DEoAKADNAC5oEGaBhmgAoAkpGgUCCgQooELQIKYhKACgBKAGmgBpoGMNAxDQAlAwzQIUUAOFAhwoAcKBC0AJQAhoGNNACUAFABQAZoAXNABQAUAS0ixKACgQoNAhaYgoEFACUABoAaaAGmgYw0DENAxtABQAooEOFADhQIcKAFoASgBDQAhoGJQAUAFACUALQIKBi0CJDSLEoATNAhc0CHZpiCgQUAJQIKBjTQAhoGNNAxpoATFABigBQKAHCgBwoAWgAoAKACgBKAEoASgAoASgBaAAUAOoEONIoaTQAZoAUGmIUGgQtAgzQISgAoAQ0DGmgYlAxKACgAxQAtACigBRQAtAxaACgAoATFABigBCKAG0CEoAWgBRTAUUAf//Z") +//go:embed default_thumb.jpg +var DefaultThumb []byte type ( TextElement struct {