koishi-plugin-bilibili-notify 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/HYZhengYuan-55W.ttf +0 -0
- package/lib/generateImg.d.ts +1 -0
- package/lib/generateImg.js +662 -327
- package/lib/index.d.ts +1 -0
- package/lib/index.js +20 -3
- package/package.json +1 -1
package/lib/HYZhengYuan-55W.ttf
CHANGED
|
Binary file
|
package/lib/generateImg.d.ts
CHANGED
package/lib/generateImg.js
CHANGED
|
@@ -515,6 +515,666 @@ class GenerateImg extends koishi_1.Service {
|
|
|
515
515
|
const [main, link] = await getDynamicMajor(data, false);
|
|
516
516
|
// 加载字体
|
|
517
517
|
const fontURL = (0, url_1.pathToFileURL)((0, path_1.resolve)(__dirname, './HYZhengYuan-55W.ttf'));
|
|
518
|
+
// 判断是否开启大字体模式
|
|
519
|
+
let style;
|
|
520
|
+
if (this.config.enableLargeFont) {
|
|
521
|
+
style = `
|
|
522
|
+
@font-face {
|
|
523
|
+
font-family: "Custom Font";
|
|
524
|
+
src: url(${fontURL});
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
* {
|
|
528
|
+
margin: 0;
|
|
529
|
+
padding: 0;
|
|
530
|
+
box-sizing: border-box;
|
|
531
|
+
font-family: "${this.config.font}", "Custom Font", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
html {
|
|
535
|
+
width: 770px;
|
|
536
|
+
height: auto;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.background {
|
|
540
|
+
width: 770px;
|
|
541
|
+
height: auto;
|
|
542
|
+
background: linear-gradient(to right bottom, ${this.config.cardColorStart}, ${this.config.cardColorEnd});
|
|
543
|
+
overflow: hidden;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.card {
|
|
547
|
+
width: 740px;
|
|
548
|
+
height: auto;
|
|
549
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
550
|
+
border-radius: 5px;
|
|
551
|
+
margin: 15px auto;
|
|
552
|
+
overflow: hidden;
|
|
553
|
+
background-color: #FFF5EE;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
.base-plate {
|
|
557
|
+
${this.config.removeBorder ? `
|
|
558
|
+
width: 740px;
|
|
559
|
+
` : `
|
|
560
|
+
width: 704px;
|
|
561
|
+
margin: 20px auto;
|
|
562
|
+
`}
|
|
563
|
+
height: auto;
|
|
564
|
+
border-radius: 10px;
|
|
565
|
+
background-color: #fff;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
.card-body {
|
|
569
|
+
display: flex;
|
|
570
|
+
padding: 15px;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
.card .anchor-avatar {
|
|
574
|
+
max-width: 70px;
|
|
575
|
+
/* 设置最大宽度为容器宽度的100% */
|
|
576
|
+
max-height: 70px;
|
|
577
|
+
/* 设置最大高度为容器高度的90% */
|
|
578
|
+
margin-right: 20px;
|
|
579
|
+
border-radius: 10px;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.card .card-body .card-content {
|
|
583
|
+
width: 100%;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.card .card-body .card-content .card-header {
|
|
587
|
+
width: 100%;
|
|
588
|
+
display: flex;
|
|
589
|
+
justify-content: space-between;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.card .up-info {
|
|
593
|
+
display: flex;
|
|
594
|
+
flex-direction: column;
|
|
595
|
+
justify-content: space-between;
|
|
596
|
+
height: 70px;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.card .up-info .up-name {
|
|
600
|
+
font-size: 27px;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.card .pub-time {
|
|
604
|
+
font-size: 20px;
|
|
605
|
+
color: grey;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
.card .card-header img {
|
|
609
|
+
height: 50px;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
.card .dress-up {
|
|
613
|
+
position: relative;
|
|
614
|
+
/* background-image: url('${dynamicCardUrl}');
|
|
615
|
+
background-size: cover; */
|
|
616
|
+
font-size: 17px;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
.card .dress-up img {
|
|
620
|
+
max-width: 100%;
|
|
621
|
+
max-height: 100%;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
.card .dress-up span {
|
|
625
|
+
position: absolute;
|
|
626
|
+
color: ${dynamicCardColor};
|
|
627
|
+
right: 67px;
|
|
628
|
+
top: 24px;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
.card .card-topic {
|
|
632
|
+
display: flex;
|
|
633
|
+
align-items: center;
|
|
634
|
+
margin-top: 10px;
|
|
635
|
+
font-size: 20px;
|
|
636
|
+
color: #008AC5;
|
|
637
|
+
gap: 3px;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.card .card-details {
|
|
641
|
+
margin-top: 5px;
|
|
642
|
+
margin-bottom: 15px;
|
|
643
|
+
font-size: 22px;
|
|
644
|
+
width: 90%;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
.card .card-major {
|
|
648
|
+
display: flex;
|
|
649
|
+
flex-wrap: wrap;
|
|
650
|
+
gap: 5px;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
.card .card-major .photo-item {
|
|
654
|
+
border-radius: 10px;
|
|
655
|
+
overflow: hidden;
|
|
656
|
+
width: 170px;
|
|
657
|
+
height: 170px;
|
|
658
|
+
object-fit: cover;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
.card .card-major .single-photo-item {
|
|
662
|
+
max-width: 500px;
|
|
663
|
+
border-radius: 10px;
|
|
664
|
+
overflow: hidden;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
.card .card-major .four-photo-item {
|
|
668
|
+
width: 170px;
|
|
669
|
+
height: 170px;
|
|
670
|
+
object-fit: cover;
|
|
671
|
+
border-radius: 10px;
|
|
672
|
+
overflow: hidden;
|
|
673
|
+
flex-basis: 20%; /* or any value less than 50% */
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
.card .card-stat {
|
|
677
|
+
display: flex;
|
|
678
|
+
justify-content: space-between;
|
|
679
|
+
width: 90%;
|
|
680
|
+
margin-top: 15px;
|
|
681
|
+
color: gray;
|
|
682
|
+
font-size: 14px;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
.card .card-stat .stat-item {
|
|
686
|
+
display: flex;
|
|
687
|
+
align-items: center;
|
|
688
|
+
gap: 3px;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
.card .card-video {
|
|
692
|
+
display: flex;
|
|
693
|
+
overflow: hidden;
|
|
694
|
+
border-radius: 5px 0 0 5px;
|
|
695
|
+
margin-top: 10px;
|
|
696
|
+
height: 147px;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
.card .video-cover {
|
|
700
|
+
position: relative;
|
|
701
|
+
flex: 2;
|
|
702
|
+
overflow: hidden;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.card .video-cover img {
|
|
706
|
+
width: 236px;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
.card .cover-mask {
|
|
710
|
+
position: absolute;
|
|
711
|
+
width: 100%;
|
|
712
|
+
height: 100%;
|
|
713
|
+
top: 0;
|
|
714
|
+
left: 0;
|
|
715
|
+
background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, transparent 30%);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
.card .video-cover span {
|
|
719
|
+
position: absolute;
|
|
720
|
+
color: #fff;
|
|
721
|
+
font-size: 14px;
|
|
722
|
+
right: 10px;
|
|
723
|
+
bottom: 8px;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
.card .video-info {
|
|
727
|
+
display: flex;
|
|
728
|
+
justify-content: space-between;
|
|
729
|
+
flex-direction: column;
|
|
730
|
+
flex: 3;
|
|
731
|
+
border: #e5e7e9 1px solid;
|
|
732
|
+
border-left: none;
|
|
733
|
+
border-radius: 0 5px 5px 0;
|
|
734
|
+
padding: 12px 16px 10px;
|
|
735
|
+
background-color: #fff;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
.card .video-info-header .video-title {
|
|
739
|
+
font-size: 16px;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
.card .video-info-header .video-introduction {
|
|
743
|
+
margin-top: 5px;
|
|
744
|
+
font-size: 12px;
|
|
745
|
+
color: #AAA;
|
|
746
|
+
display: -webkit-box;
|
|
747
|
+
/* 必须设置为 -webkit-box 或 -webkit-inline-box */
|
|
748
|
+
-webkit-box-orient: vertical;
|
|
749
|
+
/* 必须设置为 vertical */
|
|
750
|
+
-webkit-line-clamp: 2;
|
|
751
|
+
/* 显示的文本行数 */
|
|
752
|
+
overflow: hidden;
|
|
753
|
+
/* 必须设置为 hidden */
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
.card .video-stat {
|
|
757
|
+
font-size: 12px;
|
|
758
|
+
color: #AAA;
|
|
759
|
+
display: flex;
|
|
760
|
+
gap: 35px
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
.card .video-stat .video-stat-item {
|
|
764
|
+
display: flex;
|
|
765
|
+
align-items: center;
|
|
766
|
+
gap: 3px;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
.card .card-forward {
|
|
770
|
+
margin: 0 -15px 0 -105px;
|
|
771
|
+
padding: 12px 15px 14px 105px;
|
|
772
|
+
background-color: #F6F7F8;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
.card-forward .forward-userinfo {
|
|
776
|
+
display: flex;
|
|
777
|
+
align-items: center;
|
|
778
|
+
gap: 5px;
|
|
779
|
+
height: 35px;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
.forward-userinfo img {
|
|
783
|
+
width: 25px;
|
|
784
|
+
height: 25px;
|
|
785
|
+
border-radius: 50%;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
.forward-userinfo span {
|
|
789
|
+
color: #61666D;
|
|
790
|
+
font-size: 20px;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
.card .card-reserve {
|
|
794
|
+
display: flex;
|
|
795
|
+
justify-content: space-between;
|
|
796
|
+
align-items: center;
|
|
797
|
+
padding: 10px 20px 10px 20px;
|
|
798
|
+
margin-top: 10px;
|
|
799
|
+
border-radius: 10px;
|
|
800
|
+
background-color: #F6F7F8;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
.card-reserve .reserve-title {
|
|
804
|
+
font-size: 14px;
|
|
805
|
+
color: #18191C;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
.card-reserve .reserve-desc {
|
|
809
|
+
margin-top: 7px;
|
|
810
|
+
font-size: 12px;
|
|
811
|
+
color: #9499A0;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
.reserve-info .reserve-time {
|
|
815
|
+
margin-right: 7px;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
.card-reserve .reserve-prize {
|
|
819
|
+
display: flex;
|
|
820
|
+
align-items: center;
|
|
821
|
+
margin-top: 3px;
|
|
822
|
+
gap: 3px;
|
|
823
|
+
color: #00AEEC;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
.card .card-reserve .reserve-button button {
|
|
827
|
+
border: none;
|
|
828
|
+
height: 30px;
|
|
829
|
+
width: 72px;
|
|
830
|
+
font-size: 13px;
|
|
831
|
+
border-radius: 7px;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
.card .card-reserve .reserve-button .reserve-button-end {
|
|
835
|
+
display: flex;
|
|
836
|
+
align-items: center;
|
|
837
|
+
justify-content: center;
|
|
838
|
+
color: #9499A0;
|
|
839
|
+
background-color: #E3E5E7;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
.card .card-reserve .reserve-button .reserve-button-ing {
|
|
843
|
+
display: flex;
|
|
844
|
+
align-items: center;
|
|
845
|
+
justify-content: center;
|
|
846
|
+
color: #FFF;
|
|
847
|
+
background-color: #00A0D8;
|
|
848
|
+
}
|
|
849
|
+
`;
|
|
850
|
+
}
|
|
851
|
+
else {
|
|
852
|
+
style = `
|
|
853
|
+
@font-face {
|
|
854
|
+
font-family: "Custom Font";
|
|
855
|
+
src: url(${fontURL});
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
* {
|
|
859
|
+
margin: 0;
|
|
860
|
+
padding: 0;
|
|
861
|
+
font-family: "${this.config.font}", "Custom Font", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
html {
|
|
865
|
+
width: 770px;
|
|
866
|
+
height: auto;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
.background {
|
|
870
|
+
width: 770px;
|
|
871
|
+
height: auto;
|
|
872
|
+
background: linear-gradient(to right bottom, ${this.config.cardColorStart}, ${this.config.cardColorEnd});
|
|
873
|
+
overflow: hidden;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
.card {
|
|
877
|
+
width: 740px;
|
|
878
|
+
height: auto;
|
|
879
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
880
|
+
border-radius: 5px;
|
|
881
|
+
margin: 15px auto;
|
|
882
|
+
overflow: hidden;
|
|
883
|
+
background-color: #FFF5EE;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
.base-plate {
|
|
887
|
+
width: 704px;
|
|
888
|
+
height: auto;
|
|
889
|
+
margin: 20px auto;
|
|
890
|
+
border-radius: 10px;
|
|
891
|
+
background-color: #fff;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
.card-body {
|
|
895
|
+
display: flex;
|
|
896
|
+
padding: 15px;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
.card .anchor-avatar {
|
|
900
|
+
border-radius: 5px 5px 0 0;
|
|
901
|
+
max-width: 50px;
|
|
902
|
+
/* 设置最大宽度为容器宽度的100% */
|
|
903
|
+
max-height: 50px;
|
|
904
|
+
/* 设置最大高度为容器高度的90% */
|
|
905
|
+
margin-right: 20px;
|
|
906
|
+
border-radius: 10px;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
.card .card-body .card-content {
|
|
910
|
+
width: 100%;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
.card .card-body .card-content .card-header {
|
|
914
|
+
width: 100%;
|
|
915
|
+
display: flex;
|
|
916
|
+
justify-content: space-between;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
.card .up-info {
|
|
920
|
+
display: flex;
|
|
921
|
+
flex-direction: column;
|
|
922
|
+
justify-content: space-between;
|
|
923
|
+
height: 50px;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
.card .up-info .up-name {
|
|
927
|
+
font-size: 20px;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
.card .pub-time {
|
|
931
|
+
font-size: 12px;
|
|
932
|
+
color: grey;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
.card .card-header img {
|
|
936
|
+
height: 50px;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
.card .dress-up {
|
|
940
|
+
position: relative;
|
|
941
|
+
max-width: 110px;
|
|
942
|
+
max-height: 34px;
|
|
943
|
+
/* background-image: url('${dynamicCardUrl}');
|
|
944
|
+
background-size: cover; */
|
|
945
|
+
font-size: 12px;
|
|
946
|
+
line-height: 33px;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
.card .dress-up img {
|
|
950
|
+
max-width: 100%;
|
|
951
|
+
max-height: 100%;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
.card .dress-up span {
|
|
955
|
+
position: absolute;
|
|
956
|
+
color: ${dynamicCardColor};
|
|
957
|
+
right: 37px;
|
|
958
|
+
top: 5px;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
.card .card-topic {
|
|
962
|
+
display: flex;
|
|
963
|
+
align-items: center;
|
|
964
|
+
margin-top: 10px;
|
|
965
|
+
color: #008AC5;
|
|
966
|
+
gap: 3px;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
.card .card-details {
|
|
970
|
+
margin-bottom: 15px;
|
|
971
|
+
width: 90%;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
.card .card-major {
|
|
975
|
+
display: flex;
|
|
976
|
+
flex-wrap: wrap;
|
|
977
|
+
gap: 5px;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
.card .card-major .photo-item {
|
|
981
|
+
border-radius: 10px;
|
|
982
|
+
overflow: hidden;
|
|
983
|
+
width: 170px;
|
|
984
|
+
height: 170px;
|
|
985
|
+
object-fit: cover;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
.card .card-major .single-photo-item {
|
|
989
|
+
max-width: 500px;
|
|
990
|
+
border-radius: 10px;
|
|
991
|
+
overflow: hidden;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
.card .card-major .four-photo-item {
|
|
995
|
+
width: 170px;
|
|
996
|
+
height: 170px;
|
|
997
|
+
object-fit: cover;
|
|
998
|
+
border-radius: 10px;
|
|
999
|
+
overflow: hidden;
|
|
1000
|
+
flex-basis: 20%; /* or any value less than 50% */
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
.card .card-stat {
|
|
1004
|
+
display: flex;
|
|
1005
|
+
justify-content: space-between;
|
|
1006
|
+
width: 90%;
|
|
1007
|
+
margin-top: 15px;
|
|
1008
|
+
color: gray;
|
|
1009
|
+
font-size: 14px;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
.card .card-stat .stat-item {
|
|
1013
|
+
display: flex;
|
|
1014
|
+
align-items: center;
|
|
1015
|
+
gap: 3px;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
.card .card-video {
|
|
1019
|
+
display: flex;
|
|
1020
|
+
overflow: hidden;
|
|
1021
|
+
border-radius: 5px 0 0 5px;
|
|
1022
|
+
margin-top: 10px;
|
|
1023
|
+
height: 132px;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
.card .video-cover {
|
|
1027
|
+
position: relative;
|
|
1028
|
+
flex: 2;
|
|
1029
|
+
overflow: hidden;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
.card .video-cover img {
|
|
1033
|
+
width: 236px;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
.card .cover-mask {
|
|
1037
|
+
position: absolute;
|
|
1038
|
+
width: 100%;
|
|
1039
|
+
height: 100%;
|
|
1040
|
+
top: 0;
|
|
1041
|
+
left: 0;
|
|
1042
|
+
background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, transparent 30%);
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
.card .video-cover span {
|
|
1046
|
+
position: absolute;
|
|
1047
|
+
color: #fff;
|
|
1048
|
+
font-size: 14px;
|
|
1049
|
+
right: 10px;
|
|
1050
|
+
bottom: 8px;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
.card .video-info {
|
|
1054
|
+
display: flex;
|
|
1055
|
+
justify-content: space-between;
|
|
1056
|
+
flex-direction: column;
|
|
1057
|
+
flex: 3;
|
|
1058
|
+
border: #e5e7e9 1px solid;
|
|
1059
|
+
border-left: none;
|
|
1060
|
+
border-radius: 0 5px 5px 0;
|
|
1061
|
+
padding: 12px 16px 10px;
|
|
1062
|
+
background-color: #fff;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
.card .video-info-header .video-title {
|
|
1066
|
+
font-size: 16px;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
.card .video-info-header .video-introduction {
|
|
1070
|
+
margin-top: 5px;
|
|
1071
|
+
font-size: 12px;
|
|
1072
|
+
color: #AAA;
|
|
1073
|
+
display: -webkit-box;
|
|
1074
|
+
/* 必须设置为 -webkit-box 或 -webkit-inline-box */
|
|
1075
|
+
-webkit-box-orient: vertical;
|
|
1076
|
+
/* 必须设置为 vertical */
|
|
1077
|
+
-webkit-line-clamp: 2;
|
|
1078
|
+
/* 显示的文本行数 */
|
|
1079
|
+
overflow: hidden;
|
|
1080
|
+
/* 必须设置为 hidden */
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
.card .video-stat {
|
|
1084
|
+
font-size: 12px;
|
|
1085
|
+
color: #AAA;
|
|
1086
|
+
display: flex;
|
|
1087
|
+
gap: 35px
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
.card .video-stat .video-stat-item {
|
|
1091
|
+
display: flex;
|
|
1092
|
+
align-items: center;
|
|
1093
|
+
gap: 3px;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
.card .card-forward {
|
|
1097
|
+
margin: 0 -15px 0 -85px;
|
|
1098
|
+
padding: 12px 15px 14px 85px;
|
|
1099
|
+
background-color: #F6F7F8;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
.card-forward .forward-userinfo {
|
|
1103
|
+
display: flex;
|
|
1104
|
+
align-items: center;
|
|
1105
|
+
gap: 5px;
|
|
1106
|
+
height: 30px;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
.forward-userinfo img {
|
|
1110
|
+
width: 20px;
|
|
1111
|
+
height: 20px;
|
|
1112
|
+
border-radius: 50%;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
.forward-userinfo span {
|
|
1116
|
+
color: #61666D;
|
|
1117
|
+
font-size: 15px;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
.card .card-reserve {
|
|
1121
|
+
display: flex;
|
|
1122
|
+
justify-content: space-between;
|
|
1123
|
+
align-items: center;
|
|
1124
|
+
padding: 10px 20px 10px 20px;
|
|
1125
|
+
margin-top: 10px;
|
|
1126
|
+
border-radius: 10px;
|
|
1127
|
+
background-color: #F6F7F8;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
.card-reserve .reserve-title {
|
|
1131
|
+
font-size: 14px;
|
|
1132
|
+
color: #18191C;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
.card-reserve .reserve-desc {
|
|
1136
|
+
margin-top: 7px;
|
|
1137
|
+
font-size: 12px;
|
|
1138
|
+
color: #9499A0;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
.reserve-info .reserve-time {
|
|
1142
|
+
margin-right: 7px;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
.card-reserve .reserve-prize {
|
|
1146
|
+
display: flex;
|
|
1147
|
+
align-items: center;
|
|
1148
|
+
margin-top: 3px;
|
|
1149
|
+
gap: 3px;
|
|
1150
|
+
color: #00AEEC;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
.card .card-reserve .reserve-button button {
|
|
1154
|
+
border: none;
|
|
1155
|
+
height: 30px;
|
|
1156
|
+
width: 72px;
|
|
1157
|
+
font-size: 13px;
|
|
1158
|
+
border-radius: 7px;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
.card .card-reserve .reserve-button .reserve-button-end {
|
|
1162
|
+
display: flex;
|
|
1163
|
+
align-items: center;
|
|
1164
|
+
justify-content: center;
|
|
1165
|
+
color: #9499A0;
|
|
1166
|
+
background-color: #E3E5E7;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
.card .card-reserve .reserve-button .reserve-button-ing {
|
|
1170
|
+
display: flex;
|
|
1171
|
+
align-items: center;
|
|
1172
|
+
justify-content: center;
|
|
1173
|
+
color: #FFF;
|
|
1174
|
+
background-color: #00A0D8;
|
|
1175
|
+
}
|
|
1176
|
+
`;
|
|
1177
|
+
}
|
|
518
1178
|
// 定义卡片内容
|
|
519
1179
|
const html = `
|
|
520
1180
|
<!DOCTYPE html>
|
|
@@ -522,333 +1182,7 @@ class GenerateImg extends koishi_1.Service {
|
|
|
522
1182
|
<head>
|
|
523
1183
|
<title>动态通知</title>
|
|
524
1184
|
<style>
|
|
525
|
-
|
|
526
|
-
font-family: "Custom Font";
|
|
527
|
-
src: url(${fontURL});
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
* {
|
|
531
|
-
margin: 0;
|
|
532
|
-
padding: 0;
|
|
533
|
-
box-sizing: border-box;
|
|
534
|
-
font-family: "${this.config.font}", "Custom Font", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
html {
|
|
538
|
-
width: 770px;
|
|
539
|
-
height: auto;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
.background {
|
|
543
|
-
width: 770px;
|
|
544
|
-
height: auto;
|
|
545
|
-
background: linear-gradient(to right bottom, ${this.config.cardColorStart}, ${this.config.cardColorEnd});
|
|
546
|
-
overflow: hidden;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
.card {
|
|
550
|
-
width: 740px;
|
|
551
|
-
height: auto;
|
|
552
|
-
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
553
|
-
border-radius: 5px;
|
|
554
|
-
margin: 15px auto;
|
|
555
|
-
overflow: hidden;
|
|
556
|
-
background-color: #FFF5EE;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
.base-plate {
|
|
560
|
-
${this.config.removeBorder ? `
|
|
561
|
-
width: 740px;
|
|
562
|
-
` : `
|
|
563
|
-
width: 704px;
|
|
564
|
-
margin: 20px auto;
|
|
565
|
-
`}
|
|
566
|
-
height: auto;
|
|
567
|
-
border-radius: 10px;
|
|
568
|
-
background-color: #fff;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
.card-body {
|
|
572
|
-
display: flex;
|
|
573
|
-
padding: 15px;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
.card .anchor-avatar {
|
|
577
|
-
max-width: 70px;
|
|
578
|
-
/* 设置最大宽度为容器宽度的100% */
|
|
579
|
-
max-height: 70px;
|
|
580
|
-
/* 设置最大高度为容器高度的90% */
|
|
581
|
-
margin-right: 20px;
|
|
582
|
-
border-radius: 10px;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
.card .card-body .card-content {
|
|
586
|
-
width: 100%;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
.card .card-body .card-content .card-header {
|
|
590
|
-
width: 100%;
|
|
591
|
-
display: flex;
|
|
592
|
-
justify-content: space-between;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
.card .up-info {
|
|
596
|
-
display: flex;
|
|
597
|
-
flex-direction: column;
|
|
598
|
-
justify-content: space-between;
|
|
599
|
-
height: 70px;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
.card .up-info .up-name {
|
|
603
|
-
font-size: 27px;
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
.card .pub-time {
|
|
607
|
-
font-size: 20px;
|
|
608
|
-
color: grey;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
.card .card-header img {
|
|
612
|
-
height: 50px;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
.card .dress-up {
|
|
616
|
-
position: relative;
|
|
617
|
-
/* background-image: url('${dynamicCardUrl}');
|
|
618
|
-
background-size: cover; */
|
|
619
|
-
font-size: 17px;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
.card .dress-up img {
|
|
623
|
-
max-width: 100%;
|
|
624
|
-
max-height: 100%;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
.card .dress-up span {
|
|
628
|
-
position: absolute;
|
|
629
|
-
color: ${dynamicCardColor};
|
|
630
|
-
right: 67px;
|
|
631
|
-
top: 24px;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
.card .card-topic {
|
|
635
|
-
display: flex;
|
|
636
|
-
align-items: center;
|
|
637
|
-
margin-top: 10px;
|
|
638
|
-
font-size: 20px;
|
|
639
|
-
color: #008AC5;
|
|
640
|
-
gap: 3px;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
.card .card-details {
|
|
644
|
-
margin-top: 5px;
|
|
645
|
-
margin-bottom: 15px;
|
|
646
|
-
font-size: 22px;
|
|
647
|
-
width: 90%;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
.card .card-major {
|
|
651
|
-
display: flex;
|
|
652
|
-
flex-wrap: wrap;
|
|
653
|
-
gap: 5px;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
.card .card-major .photo-item {
|
|
657
|
-
border-radius: 10px;
|
|
658
|
-
overflow: hidden;
|
|
659
|
-
width: 170px;
|
|
660
|
-
height: 170px;
|
|
661
|
-
object-fit: cover;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
.card .card-major .single-photo-item {
|
|
665
|
-
max-width: 500px;
|
|
666
|
-
border-radius: 10px;
|
|
667
|
-
overflow: hidden;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
.card .card-major .four-photo-item {
|
|
671
|
-
width: 170px;
|
|
672
|
-
height: 170px;
|
|
673
|
-
object-fit: cover;
|
|
674
|
-
border-radius: 10px;
|
|
675
|
-
overflow: hidden;
|
|
676
|
-
flex-basis: 20%; /* or any value less than 50% */
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
.card .card-stat {
|
|
680
|
-
display: flex;
|
|
681
|
-
justify-content: space-between;
|
|
682
|
-
width: 90%;
|
|
683
|
-
margin-top: 15px;
|
|
684
|
-
color: gray;
|
|
685
|
-
font-size: 14px;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
.card .card-stat .stat-item {
|
|
689
|
-
display: flex;
|
|
690
|
-
align-items: center;
|
|
691
|
-
gap: 3px;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
.card .card-video {
|
|
695
|
-
display: flex;
|
|
696
|
-
overflow: hidden;
|
|
697
|
-
border-radius: 5px 0 0 5px;
|
|
698
|
-
margin-top: 10px;
|
|
699
|
-
height: 147px;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
.card .video-cover {
|
|
703
|
-
position: relative;
|
|
704
|
-
flex: 2;
|
|
705
|
-
overflow: hidden;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
.card .video-cover img {
|
|
709
|
-
width: 236px;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
.card .cover-mask {
|
|
713
|
-
position: absolute;
|
|
714
|
-
width: 100%;
|
|
715
|
-
height: 100%;
|
|
716
|
-
top: 0;
|
|
717
|
-
left: 0;
|
|
718
|
-
background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, transparent 30%);
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
.card .video-cover span {
|
|
722
|
-
position: absolute;
|
|
723
|
-
color: #fff;
|
|
724
|
-
font-size: 14px;
|
|
725
|
-
right: 10px;
|
|
726
|
-
bottom: 8px;
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
.card .video-info {
|
|
730
|
-
display: flex;
|
|
731
|
-
justify-content: space-between;
|
|
732
|
-
flex-direction: column;
|
|
733
|
-
flex: 3;
|
|
734
|
-
border: #e5e7e9 1px solid;
|
|
735
|
-
border-left: none;
|
|
736
|
-
border-radius: 0 5px 5px 0;
|
|
737
|
-
padding: 12px 16px 10px;
|
|
738
|
-
background-color: #fff;
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
.card .video-info-header .video-title {
|
|
742
|
-
font-size: 16px;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
.card .video-info-header .video-introduction {
|
|
746
|
-
margin-top: 5px;
|
|
747
|
-
font-size: 12px;
|
|
748
|
-
color: #AAA;
|
|
749
|
-
display: -webkit-box;
|
|
750
|
-
/* 必须设置为 -webkit-box 或 -webkit-inline-box */
|
|
751
|
-
-webkit-box-orient: vertical;
|
|
752
|
-
/* 必须设置为 vertical */
|
|
753
|
-
-webkit-line-clamp: 2;
|
|
754
|
-
/* 显示的文本行数 */
|
|
755
|
-
overflow: hidden;
|
|
756
|
-
/* 必须设置为 hidden */
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
.card .video-stat {
|
|
760
|
-
font-size: 12px;
|
|
761
|
-
color: #AAA;
|
|
762
|
-
display: flex;
|
|
763
|
-
gap: 35px
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
.card .video-stat .video-stat-item {
|
|
767
|
-
display: flex;
|
|
768
|
-
align-items: center;
|
|
769
|
-
gap: 3px;
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
.card .card-forward {
|
|
773
|
-
margin: 0 -15px 0 -105px;
|
|
774
|
-
padding: 12px 15px 14px 105px;
|
|
775
|
-
background-color: #F6F7F8;
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
.card-forward .forward-userinfo {
|
|
779
|
-
display: flex;
|
|
780
|
-
align-items: center;
|
|
781
|
-
gap: 5px;
|
|
782
|
-
height: 35px;
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
.forward-userinfo img {
|
|
786
|
-
width: 25px;
|
|
787
|
-
height: 25px;
|
|
788
|
-
border-radius: 50%;
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
.forward-userinfo span {
|
|
792
|
-
color: #61666D;
|
|
793
|
-
font-size: 20px;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
.card .card-reserve {
|
|
797
|
-
display: flex;
|
|
798
|
-
justify-content: space-between;
|
|
799
|
-
align-items: center;
|
|
800
|
-
padding: 10px 20px 10px 20px;
|
|
801
|
-
margin-top: 10px;
|
|
802
|
-
border-radius: 10px;
|
|
803
|
-
background-color: #F6F7F8;
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
.card-reserve .reserve-title {
|
|
807
|
-
font-size: 14px;
|
|
808
|
-
color: #18191C;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
.card-reserve .reserve-desc {
|
|
812
|
-
margin-top: 7px;
|
|
813
|
-
font-size: 12px;
|
|
814
|
-
color: #9499A0;
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
.reserve-info .reserve-time {
|
|
818
|
-
margin-right: 7px;
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
.card-reserve .reserve-prize {
|
|
822
|
-
display: flex;
|
|
823
|
-
align-items: center;
|
|
824
|
-
margin-top: 3px;
|
|
825
|
-
gap: 3px;
|
|
826
|
-
color: #00AEEC;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
.card .card-reserve .reserve-button button {
|
|
830
|
-
border: none;
|
|
831
|
-
height: 30px;
|
|
832
|
-
width: 72px;
|
|
833
|
-
font-size: 13px;
|
|
834
|
-
border-radius: 7px;
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
.card .card-reserve .reserve-button .reserve-button-end {
|
|
838
|
-
display: flex;
|
|
839
|
-
align-items: center;
|
|
840
|
-
justify-content: center;
|
|
841
|
-
color: #9499A0;
|
|
842
|
-
background-color: #E3E5E7;
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
.card .card-reserve .reserve-button .reserve-button-ing {
|
|
846
|
-
display: flex;
|
|
847
|
-
align-items: center;
|
|
848
|
-
justify-content: center;
|
|
849
|
-
color: #FFF;
|
|
850
|
-
background-color: #00A0D8;
|
|
851
|
-
}
|
|
1185
|
+
${style}
|
|
852
1186
|
</style>
|
|
853
1187
|
</head>
|
|
854
1188
|
<body>
|
|
@@ -1016,6 +1350,7 @@ class GenerateImg extends koishi_1.Service {
|
|
|
1016
1350
|
removeBorder: koishi_1.Schema.boolean(),
|
|
1017
1351
|
cardColorStart: koishi_1.Schema.string(),
|
|
1018
1352
|
cardColorEnd: koishi_1.Schema.string(),
|
|
1353
|
+
enableLargeFont: koishi_1.Schema.boolean(),
|
|
1019
1354
|
font: koishi_1.Schema.string()
|
|
1020
1355
|
});
|
|
1021
1356
|
})(GenerateImg || (GenerateImg = {}));
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -75,10 +75,11 @@ exports.Config = koishi_1.Schema.object({
|
|
|
75
75
|
enable: koishi_1.Schema.boolean()
|
|
76
76
|
.default(false)
|
|
77
77
|
.description('是否开启动态关键字屏蔽功能')
|
|
78
|
+
.experimental()
|
|
78
79
|
}).description('屏蔽设置'),
|
|
79
80
|
koishi_1.Schema.union([
|
|
80
81
|
koishi_1.Schema.object({
|
|
81
|
-
enable: koishi_1.Schema.const(true).required(),
|
|
82
|
+
enable: koishi_1.Schema.const(true).required().experimental(),
|
|
82
83
|
regex: koishi_1.Schema.string()
|
|
83
84
|
.description('正则表达式屏蔽'),
|
|
84
85
|
keywords: koishi_1.Schema.array(String)
|
|
@@ -99,6 +100,9 @@ exports.Config = koishi_1.Schema.object({
|
|
|
99
100
|
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
100
101
|
.default('#F9CCDF')
|
|
101
102
|
.description('推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/'),
|
|
103
|
+
enableLargeFont: koishi_1.Schema.boolean()
|
|
104
|
+
.default(false)
|
|
105
|
+
.description('是否开启动态推送卡片大字体模式,默认为小字体。小字体更漂亮,但阅读比较吃力,大字体更易阅读,但相对没这么好看'),
|
|
102
106
|
font: koishi_1.Schema.string()
|
|
103
107
|
.description('推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei')
|
|
104
108
|
});
|
|
@@ -145,11 +149,24 @@ function apply(ctx, config) {
|
|
|
145
149
|
ctx.plugin(Database);
|
|
146
150
|
// Regist server
|
|
147
151
|
ctx.plugin(wbi_1.default, { key: config.key });
|
|
148
|
-
ctx.plugin(generateImg_1.default, {
|
|
152
|
+
ctx.plugin(generateImg_1.default, {
|
|
153
|
+
renderType,
|
|
154
|
+
filter: config.filter,
|
|
155
|
+
removeBorder: config.removeBorder,
|
|
156
|
+
cardColorStart: config.cardColorStart,
|
|
157
|
+
cardColorEnd: config.cardColorEnd,
|
|
158
|
+
enableLargeFont: config.enableLargeFont,
|
|
159
|
+
font: config.font
|
|
160
|
+
});
|
|
149
161
|
ctx.plugin(biliAPI_1.default);
|
|
150
162
|
// load plugin
|
|
151
163
|
// ctx.plugin(Authority)
|
|
152
|
-
ctx.plugin(comRegister_1.default, {
|
|
164
|
+
ctx.plugin(comRegister_1.default, {
|
|
165
|
+
unlockSubLimits: config.unlockSubLimits,
|
|
166
|
+
pushTime: config.pushTime,
|
|
167
|
+
dynamicCheckNumber: config.dynamicCheckNumber,
|
|
168
|
+
dynamicLoopTime
|
|
169
|
+
});
|
|
153
170
|
// 当用户输入“恶魔兔,启动!”时,执行 help 指令
|
|
154
171
|
ctx.middleware((session, next) => {
|
|
155
172
|
if (session.content === '恶魔兔,启动!') {
|