neko mirror
Go to file
2024-03-17 11:20:33 +01:00
.github/workflows fix ci. 2023-02-26 22:17:00 +01:00
.vscode WIP. 2024-03-17 00:00:14 +01:00
dev Upgrade to node 18 and dependencies (#46) 2024-01-26 19:25:22 +01:00
e2e WIP. 2024-03-17 00:00:14 +01:00
src WIP. 2024-03-17 00:00:14 +01:00
.editorconfig inital commit. 2020-11-05 11:56:26 +01:00
.eslintrc.cjs WIP. 2024-03-17 00:00:14 +01:00
.gitattributes bump openapi generator version. 2021-02-26 22:54:43 +01:00
.gitignore WIP. 2024-03-17 00:00:14 +01:00
.prettierrc.json WIP. 2024-03-17 00:00:14 +01:00
env.d.ts WIP. 2024-03-17 00:00:14 +01:00
index.html WIP. 2024-03-17 00:00:14 +01:00
LICENSE add LICENSE. 2022-07-18 22:08:36 +02:00
package-lock.json WIP. 2024-03-17 00:00:14 +01:00
package.json WIP. 2024-03-17 00:00:14 +01:00
playwright.config.ts WIP. 2024-03-17 00:00:14 +01:00
README.md WIP. 2024-03-17 00:00:14 +01:00
tsconfig.app.json WIP. 2024-03-17 00:00:14 +01:00
tsconfig.json WIP. 2024-03-17 00:00:14 +01:00
tsconfig.node.json WIP. 2024-03-17 00:00:14 +01:00
tsconfig.vitest.json WIP. 2024-03-17 00:00:14 +01:00
vite.config.ts add proxy server. 2024-03-17 11:20:33 +01:00
vitest.config.ts WIP. 2024-03-17 00:00:14 +01:00

neko-client

Connect to demodesk/neko backend with self contained vue component.

For community edition neko with GUI and plug & play deployment visit m1k1o/neko.

Installation

Code is published to public NPM registry and GitHub npm repository.

# npm command
npm i @demodesk/neko
# yarn command
yarn add @demodesk/neko

Build

You can set keyboard provider at build time, either novnc or the default guacamole.

# by default uses guacamole keyboard
npm run build
# uses novnc keyboard
KEYBOARD=novnc npm run build

VSCode + Volar (and disable Vetur).

Type Support for .vue Imports in TS

TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need Volar to make the TypeScript language service aware of .vue types.

Customize configuration

See Vite Configuration Reference.

Project Setup

npm install

Compile and Hot-Reload for Development

npm run dev

Type-Check, Compile and Minify for Production

npm run build

Run Unit Tests with Vitest

npm run test:unit

Run End-to-End Tests with Playwright

# Install browsers for the first run
npx playwright install

# When testing on CI, must build the project first
npm run build

# Runs the end-to-end tests
npm run test:e2e
# Runs the tests only on Chromium
npm run test:e2e -- --project=chromium
# Runs the tests of a specific file
npm run test:e2e -- tests/example.spec.ts
# Runs the tests in debug mode
npm run test:e2e -- --debug

Lint with ESLint

npm run lint

Example

API consists of accessing Vue reactive state, calling various methods and subscribing to events. Simple usage:

<!-- import vue -->
<script src="https://unpkg.com/vue"></script>

<!-- import neko -->
<script src="./neko.umd.js"></script>
<link rel="stylesheet" href="./neko.css">

<div id="app">
  <neko ref="neko" server="http://127.0.0.1:3000/api" autologin autoplay />
</div>

<script>
new Vue({
  components: { neko },
  mounted() {
    // access state
    // this.$refs.neko.state.session_id
  
    // call methods
    // this.$refs.neko.setUrl('http://127.0.0.1:3000/api')
    // this.$refs.neko.login('username', 'password')
    // this.$refs.neko.logout()
  
    // subscribe to events
    // this.$refs.neko.events.on('room.control.host', (id) => { })
  },
}).$mount('#app')
</script>