Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 2.62 KB

develop.en.md

File metadata and controls

56 lines (36 loc) · 2.62 KB

Development

中文 | English

Project Structure

The src folder of this project is the front-end Vue.js source code, and most of the other folders are the back-end Express source code.

Creating a danmaku sender

The directory for the danmaku sender is located in routes/sender, see routes/sender/danmaku.js.

module.exports = { router, socket, info, init, pushDanmaku };

The explanation is as follows

  • router: used to create Express Router
  • socket: used to bind Socket.IO
  • info: for generating backend panel rendering data
  • init: used to initialize the plugin when it is enabled, e.g. to create Token
  • pushDanmaku: the interface that the file implements itself

These sections are taken as needed, e.g. only the info section is implemented in routes/sender/develop.js.

The authentication function is in utils/auth.js. There are three cases of requesting authentication.

  • Vue backend authentication: auth.routerSessionAuth
  • Express Router uses Token authentication: auth.routerActivityByToken
  • Socket.IO using Token authentication: auth.socketActivityByToken

Please refer to the source code for specific usage.

Create danmaku filters

The directory for the danmaku filter is located in utils/filter, info is used to create additional configuration addons, and filter should be implemented as a middleware to be used in utils/audit.js. See also utils/filter/default.js.

Managing the Web Backend Panel

The data of the Web backend panel is generated by the backend and rendered by the frontend, so you only need to modify the backend sender. See the section defining info in routes/sender/danmaku.js. We specify that each sender has at most one display panel. And additional configuration addons can also be added in filter.

If the current renderer does not meet the requirements, it is also possible to improve the front-end by adding new rendering features.

Multi-language support

When submitting code to the main repository, you should ensure that the display text added to the front-end supports all languages under src/langs, such as following fields:

  • sender:danmaku sender name
  • filter:danmaku filter name
  • New descriptions in the backend panel

Overall, all text you see in the backend panel should be localized.