From f7bcd2d7d1f6fa98e012fed4102a47660346cc38 Mon Sep 17 00:00:00 2001 From: Donavan Becker Date: Thu, 21 Dec 2023 17:51:14 -0600 Subject: [PATCH] v1.0.0 --- .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/labeler.yml | 3 +- .github/workflows/beta-release.yml | 2 +- .github/workflows/codeql-analysis.yml | 13 -------- .github/workflows/dependabot.yml | 2 +- config.schema.json | 8 ++--- package-lock.json | 44 +++------------------------ package.json | 14 +++++---- src/platform.ts | 11 ++----- src/settings.ts | 10 +++--- 10 files changed, 30 insertions(+), 79 deletions(-) delete mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 33d9ff8..e16be5f 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -3,6 +3,6 @@ contact_links: - name: Homebridge Discord Channel for Cloudflared Tunnel url: https://discord.gg/8fpZA4S about: Please ask and answer questions here. - - name: Homebridge-cloudflared-tunnel - Pull Requests + - name: homebridge-cloudflared-tunnel - Pull Requests url: https://github.com/donavanbecker/homebridge-cloudflared-tunnel/pulls about: Please report security vulnerabilities here. diff --git a/.github/labeler.yml b/.github/labeler.yml index 67d5c2d..a30e8e7 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,5 +1,6 @@ # Add 'branding' to any file changes within 'branding' folder -branding: branding/* +branding: + - branding/* # Add 'enhancement' label to any change to index.js file enhancement: diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml index e450aab..6e114bc 100644 --- a/.github/workflows/beta-release.yml +++ b/.github/workflows/beta-release.yml @@ -19,7 +19,7 @@ jobs: publish: needs: lint - if: ${{ github.repository == 'donavanbecker/homebridge-clouldflared-tunnel' }} + if: ${{ github.repository == 'donavanbecker/homebridge-cloudflared-tunnel' }} uses: donavanbecker/.github/.github/workflows/npm-publish.yml@latest with: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 6aa5d49..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [ latest, beta* ] - pull_request: - branches: [ latest, beta* ] - schedule: - - cron: '17 9 * * 2' - -jobs: - analyze: - uses: donavanbecker/.github/.github/workflows/codeql-analysis.yml@latest diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 36f19d8..073c85a 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -11,7 +11,7 @@ jobs: name: Auto-merge dependabot updates runs-on: ubuntu-latest steps: - - uses: mitto98/dependabot-automerge-action@master + - uses: mitto98/dependabot-automerge-action@v1.0.2 with: token: ${{ github.token }} merge: true diff --git a/config.schema.json b/config.schema.json index 3e1db9c..7c6f25e 100644 --- a/config.schema.json +++ b/config.schema.json @@ -16,8 +16,8 @@ }, "url": { "type": "string", - "title": "Name", - "default": "URL", + "title": "URL", + "placeholder": "http://localhost:8581", "pattern": "^https?://", "required": false }, @@ -29,8 +29,8 @@ }, "hostname": { "type": "string", - "title": "Name", - "default": "hostname", + "title": "hostname", + "placeholder": "homebridge.local", "required": true }, "protocol": { diff --git a/package-lock.json b/package-lock.json index 80184b1..46c8de3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "homebridge-cloudflared-tunnel", - "version": "0.1.0", + "version": "0.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "homebridge-cloudflared-tunnel", - "version": "0.1.0", + "version": "0.2.0", "funding": [ { "type": "Paypal", @@ -20,10 +20,7 @@ "license": "Apache-2.0", "dependencies": { "@homebridge/plugin-ui-utils": "^1.0.0", - "ctun": "^0.0.10", - "rxjs": "^7.8.1", - "super-stringify": "^1.0.0", - "undici": "^6.2.0" + "ctun": "^0.0.10" }, "devDependencies": { "@types/node": "^20.10.5", @@ -935,14 +932,6 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@fastify/busboy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", - "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==", - "engines": { - "node": ">=14" - } - }, "node_modules/@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", @@ -7852,14 +7841,6 @@ "queue-microtask": "^1.2.2" } }, - "node_modules/rxjs": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", - "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", - "dependencies": { - "tslib": "^2.1.0" - } - }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -8334,11 +8315,6 @@ "postcss": "^8.4.31" } }, - "node_modules/super-stringify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/super-stringify/-/super-stringify-1.0.0.tgz", - "integrity": "sha512-rWfRZG1oe8T9Ai9HiRpkfPynTj0jfpxKusXDeYyCrCEqUhpZgOYqF0HhP/oNAjWnkYZb1Lp501fN3XkjC3ejMQ==" - }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -8561,7 +8537,8 @@ "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true }, "node_modules/tuf-js": { "version": "1.1.7", @@ -8714,17 +8691,6 @@ "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", "dev": true }, - "node_modules/undici": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.2.0.tgz", - "integrity": "sha512-bglzaehBOLMe+BfK+Gv5Vpwpgdq2skaEBbSH92tcAv37wHHHTEGu43boyfTaHB+mwSo3VjyD/8d+ytPGeqsFIg==", - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, - "engines": { - "node": ">=18.0" - } - }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", diff --git a/package.json b/package.json index e1fe85c..23e9c0a 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,13 @@ { "displayName": "Cloudflared Tunnel", "name": "homebridge-cloudflared-tunnel", - "version": "0.1.0", + "version": "0.2.0", "description": "The Cloudflared Tunnel plugin allows you to run a Cloudflare-Tunnel for exposing your homebridge instance for remote access.", - "author": "donavanbecker", + "author": { + "name": "donavanbecker", + "url": "https://github.com/donavanbecker" + }, + "type": "commonjs", "license": "Apache-2.0", "icon": "https://raw.githubusercontent.com/donavanbecker/homebridge-cloudflared-tunnel/latest/branding/icon.png", "repository": { @@ -23,6 +27,7 @@ "update": "ncu -u && npm update && npm install", "update dependencies": "npm run check && npm run update", "lint": "eslint src/**.ts", + "jlint": "eslint homebridge-ui/public/**.mjs", "watch": "npm run build && npm link && nodemon", "build": "rimraf ./dist && tsc", "prepublishOnly": "npm run lint && npm run build", @@ -48,10 +53,7 @@ ], "dependencies": { "@homebridge/plugin-ui-utils": "^1.0.0", - "ctun": "^0.0.10", - "undici": "^6.2.0", - "rxjs": "^7.8.1", - "super-stringify": "^1.0.0" + "ctun": "^0.0.10" }, "devDependencies": { "@types/node": "^20.10.5", diff --git a/src/platform.ts b/src/platform.ts index c9670d0..b3b21e8 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -1,4 +1,4 @@ -import { startTunnel } from "ctun"; +import { startTunnel } from 'ctun'; import { CloudflaredTunnelPlatformConfig } from './settings'; import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, Service, Characteristic } from 'homebridge'; @@ -77,7 +77,7 @@ export class CloudflaredTunnelPlatform implements DynamicPlatformPlugin { if (this.config.url && this.config.hostname) { this.debugLog(`URL: ${this.config.url}`); this.debugLog(`Hostname: ${this.config.hostname}`); - throw new Error(`Cannot have both url and hostname in config. Please remove one.`); + throw new Error('Cannot have both url and hostname in config. Please remove one.'); } if (!this.config.logging) { this.config.logging = 'standard'; @@ -106,12 +106,7 @@ export class CloudflaredTunnelPlatform implements DynamicPlatformPlugin { //Default: {protocol}://{hostname}:{port} //The local server URL to tunnel. - const tunnel = await startTunnel( - { - url: url, - verifyTLS: this.config.verifyTLS, - } - ); // pass in the port of the server you want to tunnel + const tunnel = await startTunnel({ url: url, verifyTLS: this.config.verifyTLS}); this.infoLog(`Tunnel URL: ${tunnel}`); } catch { this.errorLog('Failed to Start Tunnel'); diff --git a/src/settings.ts b/src/settings.ts index 7ab7e2e..a88ac71 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -11,10 +11,10 @@ export const PLUGIN_NAME = 'homebridge-cloudflared-tunnel'; //Config export interface CloudflaredTunnelPlatformConfig extends PlatformConfig { - url: string; - port: number; - hostname: string; - protocol: string; - verifyTLS: boolean; + url?: string; + port?: number; + hostname?: string; + protocol?: string; + verifyTLS?: boolean; logging?: string; }