
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
siyuan_api_cache_lib
Advanced tools
为思源挂件块提供 api 访问的工具库,同时具有缓存 api 调用结果到块属性上以及在非思源笔记环境下使用缓存结果的功能
为思源挂件块提供 api 访问的工具库,同时具有缓存 api 调用结果到块属性上以及在非思源笔记环境下使用缓存结果的功能
查询类的 api 默认会进行缓存,非查询类的 api 则不会,可以通过查看函数的 noCache 属性来分辨,这个属性也是可以 set 的 (查询类的 api 也需要使用者自行斟酌避免过多的数据被缓存到挂件块的自定义属性)
@defaultValue ""
会在 api 请求路径的前面加上这个字段的值,便于开发调试@defaultValue true
对 api 上方法的调用是否开启缓存,如果需要支持 OceanPress 请开启此选项@defaultValue 10 * 1024
缓存结果的最大长度,超出此长度则不会缓存且在控制台打印警告请确保使用了缓存的接口不会一直增长数据,否则容易出现如下问题
由于本库使用了 self.frameElement
而 frameElement
只能在同源的情况下才能访问到,
所以我在开发的时候使用 nginx 进行转发来绕过这个问题
(和跨域无关,我使用 chrome 关闭跨域的安全策略还是无法在非同源的情况下拿到 frameElement
)
配置 iframe 的资源链接为 http://127.0.0.1/widgets/run-code/
(run-code 是我在开发的插件 github.com/run-code,建议查看这个项目里面对本库的使用方式)
对于在思源中的开发调试建议采用 nginx 进行如下配置,然后使用思源的在浏览器中打开,在这里进行开发调试
server {
listen 80;
server_name localhost 127.0.0.1;
location / {
#// 思源服务
proxy_pass http://127.0.0.1:6806;
proxy_set_header Host $host;
index index.html index.htm;
}
location /widgets/run-code/ {
#// run-code 所启动的服务, run-code 还配置了 base 路径为 /widgets/run-code/
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
index index.html index.htm;
}
}
对于 OceanPress 的调试可以采用如下配置
server {
listen 80;
server_name localhost 127.0.0.1;
location / {
#// oceanPress 生成的静态站点目录
alias 'D:/TEMP/思源test/';
}
location /widgets/run-code/ {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
index index.html index.htm;
}
}
FAQs
为思源挂件块提供 api 访问的工具库,同时具有缓存 api 调用结果到块属性上以及在非思源笔记环境下使用缓存结果的功能
The npm package siyuan_api_cache_lib receives a total of 0 weekly downloads. As such, siyuan_api_cache_lib popularity was classified as not popular.
We found that siyuan_api_cache_lib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.