Skip to content

Commit

Permalink
Deploy to GitHub pages
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored May 20, 2023
0 parents commit f443c2c
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<div align="center">
<img alt="icon" src="./icon.png" style="width: 8em; height: 8em;">

---
[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/Zuoqiu-Yingyi/siyuan-plugin-open-api?include_prereleases&style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/releases/latest)
[![GitHub Release Date](https://img.shields.io/github/release-date/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/releases/latest)
[![GitHub License](https://img.shields.io/github/license/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/blob/main/LICENSE)
[![GitHub last commit](https://img.shields.io/github/last-commit/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/commits/main)
![GitHub repo size](https://img.shields.io/github/repo-size/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)
![hits](https://hits.b3log.org/Zuoqiu-Yingyi/siyuan-plugin-open-api.svg)
[![GitHub all releases](https://img.shields.io/github/downloads/Zuoqiu-Yingyi/siyuan-plugin-open-api/total?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/releases)

---
[简体中文](./README_zh_CN.md) \| English

---
</div>

# Open API

Open the plugin's API to the global variable `globalThis.openAPI` / `window.openAPI` / `openAPI` to help developers test APIs.

## PREVIEW

![preview image](./preview.png)

## INTRODUCTION

- `openAPI`: Global variable
- `plugin`: Plugin object
- `siyuan`: SiYuan plugin api interface

## CHANGELOG

[CHANGE LOG](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/blob/main/CHANGELOG.md)
35 changes: 35 additions & 0 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<div align="center">
<img alt="图标" src="./icon.png" style="width: 8em; height: 8em;">

---
[![GitHub 最新发行版本 (最新一次发行/预发行)](https://img.shields.io/github/v/release/Zuoqiu-Yingyi/siyuan-plugin-open-api?include_prereleases&style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/releases/latest)
[![GitHub 最新发行时间](https://img.shields.io/github/release-date/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/releases/latest)
[![GitHub 许可证](https://img.shields.io/github/license/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/blob/main/LICENSE)
[![GitHub 最后一次提交时间](https://img.shields.io/github/last-commit/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/commits/main)
![GitHub 仓库大小](https://img.shields.io/github/repo-size/Zuoqiu-Yingyi/siyuan-plugin-open-api?style=flat-square)
![查看次数](https://hits.b3log.org/Zuoqiu-Yingyi/siyuan-plugin-open-api.svg)
[![GitHub 发行版本下载次数](https://img.shields.io/github/downloads/Zuoqiu-Yingyi/siyuan-plugin-open-api/total?style=flat-square)](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/releases)

---
简体中文 \| [English](./README.md)

---
</div>

# 开放 API

将插件的 API 公开至全局变量 `globalThis.openAPI` / `window.openAPI` / `openAPI` 以帮助开发者测试 APIs.

## 预览

![预览图片](./preview.png)

## 介绍

- `openAPI`: 全局变量
- `plugin`: 插件对象
- `siyuan`: 思源的插件 API 接口

## 更改日志

[CHANGE LOG](https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api/blob/main/CHANGELOG.md)
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use strict";
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
const siyuan = require("siyuan");
const _OpenApiPlugin = class extends siyuan.Plugin {
onload() {
_OpenApiPlugin.GLOBAL[_OpenApiPlugin.PROPERTY_NAME] = {
plugin: this,
siyuan
};
}
onunload() {
delete _OpenApiPlugin.GLOBAL[_OpenApiPlugin.PROPERTY_NAME];
}
};
let OpenApiPlugin = _OpenApiPlugin;
__publicField(OpenApiPlugin, "GLOBAL", globalThis);
__publicField(OpenApiPlugin, "PROPERTY_NAME", "openAPI");
module.exports = OpenApiPlugin;
30 changes: 30 additions & 0 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "open-api",
"author": "Zuoqiu Yingyi",
"url": "https://github.com/Zuoqiu-Yingyi/siyuan-plugin-open-api",
"version": "1.0.4",
"displayName": {
"default": "🛠 Open API",
"zh_CN": "🛠 开放 API",
"zh_CHT": "🛠 開放 API"
},
"description": {
"default": "Open the plugin's API to the global variable <code class='fn__code'>globalThis.openAPI</code> to help developers test APIs.",
"zh_CN": "将插件的 API 公开至全局变量 <code class='fn__code'>globalThis.openAPI</code> 以帮助开发者测试 APIs。",
"zh_CHT": "將插件的 API 公开至全局變量 <code class='fn__code'>globalThis.openAPI</code> 以幫助開發者測試 APIs。"
},
"readme": {
"default": "README.md",
"zh_CN": "README.zh_CN.md",
"zh_CHT": "README.zh_CN.md"
},
"funding": {
"openCollective": "",
"patreon": "",
"github": "",
"custom": [
"https://afdian.net/a/zuoqiu",
"https://ko-fi.com/zuoqiu"
]
}
}
Binary file added preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f443c2c

Please sign in to comment.