-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add internal kernel API /api/icon/getDynamicIcon
#12939
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
大小怎么设置? |
返回的就是svg,如果在笔记里放,拖动设置图片大小就可以了。默认是512*512大小 |
88250
requested changes
Oct 27, 2024
哦哦 |
88250
requested changes
Oct 27, 2024
88250
changed the title
✨ Add internal kernel API
Add internal kernel API Oct 27, 2024
/api/icon
/api/icon/getDynamicIcon
更改locale参数为lang 新增weekdayType参数,支持设置weekday格式
88250
approved these changes
Oct 27, 2024
感谢你的贡献,思源有你更精彩! |
Open
使用方法已经更新 |
本机使用和伺服使用的时候,图片链接中的 ip 不一致。 有没有办法使用 |
img地址用 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
思源笔记内核添加
/api/icon/getDynamicIcon
,使得思源笔记支持动态图标参数
type
:图标类型,默认为1type=1
:显示年月日星期type=2
:显示年月日type=3
:仅显示年月type=4
:仅显示年type=5
:当前周数type=6
:仅返回星期type=7
:倒数日type=8
:文字图标lang
:中英文切换,默认为当前思源笔记使用的语言,仅在type=1、2、3、5、6、7时有效lang=zh_CN
:显示中文简体lang=zh_CHT
:显示中文繁体lang=en_US
/lang=en_ES
:显示英文color
:设置配色,一共八种配色color=red
color=blue
color=yellow
color=green
color=purple
color=pink
color=orange
color=grey
支持通过
color=FE3427
或color=%23FE3427
设置自定义颜色(注意:直接输出color=#FE3427
,会由于#
是URL特殊符号,导致URL被截断,会使得参数不起作用)date
: 设置日期,默认为当前日期,日期设置格式为yyyy-mm-dd
,仅在type=1-7时有效weekdayType
: 设置星期格式,默认为第一种类型,仅在type=1、6时有效中文
weekdayType=1
:"周日", "周一", "周二", "周三", "周四", "周五", "周六"
weekdayType=2
:"周天", "周一", "周二", "周三", "周四", "周五", "周六"
weekdayType=3
:"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"
weekdayType=4
:"星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六
英文
weekdayType=1
:"Sun","Mon","Tue","Wed","Thu","Fri","Sat"
weekdayType=2
:"SUN","MON","TUE","WED","THU","FRI","SAT"
weekdayType=3
:"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"
weekdayType=4
:"SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"
content
:设置文字图标的内容,默认为空,仅在type=8时有效注意输入下面特殊符号,需要用URL编码替代,否则导致解析参数失败或丢失
%
:%25
+
:%2B
#
:%23
使用
如果是在思源笔记内部使用(不用外部软件打开),可以直接用
api/icon/getDynamicIcon
后添加type、color、lang、date/content等参数,例如api/icon/getDynamicIcon?color=red&type=7&lang=zh_CN
外部使用需要添加ip地址和端口,如
http://127.0.0.1:6806/api/icon/getDynamicIcon
示例
type=1:显示年月日星期
默认显示今天的日期。
可通过
date=2024-10-26
指定显示的日期type=2:显示年月日
type=3:仅显示年月
type=4:仅显示年
type=5:当前周数
type=6:仅返回星期
不输入color的话,默认星期一到星期五为红色,星期六和星期日为蓝色
指定color
type=7:倒数日
该图标会显示当前日期与指定日期之间的天数。
支持
lang=en_US
修改为英文:已过
用Past
表示。还有
用Left
表示。type=8:文字图标
该图标可以显示文字。