Skip to content

Commit

Permalink
add custom defined domain and specify token
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Jun 30, 2024
1 parent 898088d commit caa515a
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 84 deletions.
80 changes: 64 additions & 16 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,29 @@
"default": "CloudflaredTunnel",
"required": true
},
"domain": {
"type": "string",
"title": "Domain",
"description": "The domain of the self specified tunnel.",
"required": false
},
"token": {
"type": "string",
"title": "token",
"description": "The token to use for the self specified tunnel.",
"required": false,
"condition": {
"functionBody": "return (!model.url || (!model.protocol && !model.hostname && !model.port));"
}
},
"acceptCloudflareNotice": {
"type": "boolean",
"title": "Auto Start Tunnel Install",
"required": true,
"description": "Automatically start the Cloudflared Tunnel install process."
"description": "Automatically start the Cloudflared Tunnel install process.",
"condition": {
"functionBody": "return (!model.token && !model.domain);"
}
},
"url": {
"type": "string",
Expand All @@ -35,7 +53,9 @@
"format": "uri",
"patternErrorMessage": "URL must start with http:// or https://",
"validationMessage": "URL must start with http:// or https://",
"validationKeywords": ["pattern"],
"validationKeywords": [
"pattern"
],
"validation": {
"pattern": "^https?://"
}
Expand All @@ -48,11 +68,15 @@
"oneOf": [
{
"title": "HTTP",
"enum": ["http"]
"enum": [
"http"
]
},
{
"title": "HTTPS",
"enum": ["https"]
"enum": [
"https"
]
}
],
"description": "The protocol to use for the tunnel. If you are using a URL, you do not need to specify the protocol, hostname, or port.",
Expand All @@ -73,7 +97,9 @@
"validationMessage": "Hostname must be specified if not using a URL",
"pattern": "^(?!\\s*$).+",
"patternErrorMessage": "Hostname must be specified if not using a URL",
"validationKeywords": ["pattern"],
"validationKeywords": [
"pattern"
],
"condition": {
"functionBody": "return (!model.url);"
}
Expand All @@ -87,7 +113,10 @@
"minimum": 1,
"maximum": 65535,
"validationMessage": "Port must be between 1 and 65535",
"validationKeywords": ["minimum", "maximum"],
"validationKeywords": [
"minimum",
"maximum"
],
"validation": {
"minimum": 1,
"maximum": 65535,
Expand Down Expand Up @@ -118,28 +147,45 @@
"oneOf": [
{
"title": "Default Logging",
"enum": [""]
"enum": [
""
]
},
{
"title": "Standard Logging",
"enum": ["standard"]
"enum": [
"standard"
]
},
{
"title": "No Logging",
"enum": ["none"]
"enum": [
"none"
]
},
{
"title": "Debug Logging",
"enum": ["debug"]
"enum": [
"debug"
]
}
]
}
},
"dependentRequired": {
"protocol": ["hostname", "port"],
"hostname": ["protocol", "port"],
"port": ["protocol", "hostname"]
}
"dependentRequired": {
"protocol": [
"hostname",
"port"
],
"hostname": [
"protocol",
"port"
],
"port": [
"protocol",
"hostname"
]
}
},
"layout": [
{
Expand All @@ -148,6 +194,8 @@
"expandable": true,
"expanded": false,
"items": [
"domain",
"token",
"acceptCloudflareNotice",
"url",
"protocol",
Expand All @@ -166,4 +214,4 @@
]
}
]
}
}
47 changes: 19 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"displayName": "Cloudflared Tunnel",
"name": "homebridge-cloudflared-tunnel",
"version": "1.0.3",
"version": "1.1.0",
"description": "The Cloudflared Tunnel plugin allows you to run a Cloudflare-Tunnel for exposing your homebridge instance for remote access.",
"author": {
"name": "donavanbecker",
Expand Down Expand Up @@ -51,15 +51,14 @@
],
"dependencies": {
"@homebridge/plugin-ui-utils": "^1.0.3",
"untun": "^0.1.3"
"untun": "^0.1.3",
"node-cloudflared-tunnel": "^1.0.10"
},
"devDependencies": {
"@eslint/js": "^9.6.0",
"@stylistic/eslint-plugin": "^2.3.0",
"@types/eslint__js": "^8.42.3",
"@types/node": "^20.14.9",
"eslint": "^9.6.0",
"globals": "^15.7.0",
"homebridge": "^1.8.3",
"homebridge-config-ui-x": "4.56.4",
"nodemon": "^3.1.4",
Expand Down
5 changes: 5 additions & 0 deletions src/custom.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* Copyright(C) 2023-2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
*
* custom.d.ts: homebridge-cloudflared-tunnel platform class.
*/
declare module 'node-cloudflared-tunnel';
32 changes: 20 additions & 12 deletions src/homebridge-ui/public/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<p class="text-center">
<img
src="https://raw.githubusercontent.com/donavanbecker/homebridge-cloudflared-tunnel/latest/branding/Homebridge_x_CloudflaredTunnel.svg"
alt="homebridge-cloudflared-tunnel logo"
style="width: 40%" />
alt="homebridge-cloudflared-tunnel logo" style="width: 40%" />
</p>
<div id="pageIntro" style="display: none">
<p class="lead text-center">Thank you for installing <strong>homebridge-cloudflared-tunnel</strong></p>
Expand Down Expand Up @@ -59,42 +58,51 @@ <h5>Setup</h5>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/wiki" target="_blank">Wiki Home</a>
</li>
<li>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/wiki/Configuration" target="_blank">Configuration</a>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/wiki/Configuration"
target="_blank">Configuration</a>
</li>
<li>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/wiki/Beta-Version" target="_blank">Beta Version</a>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/wiki/Beta-Version" target="_blank">Beta
Version</a>
</li>
<li>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/wiki/Node-Version" target="_blank">Node Version</a>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/wiki/Node-Version" target="_blank">Node
Version</a>
</li>
<li>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/wiki/Uninstallation" target="_blank">Uninstallation</a>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/wiki/Uninstallation"
target="_blank">Uninstallation</a>
</li>
</ul>
<h5>Features</h5>
<ul>
<li>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/wiki/Supported-Devices" target="_blank">Supported Devices</a>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/wiki/Supported-Devices"
target="_blank">Supported Devices</a>
</li>
<li>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/wiki/Fan-Modes" target="_blank">Fan Modes</a>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/wiki/Fan-Modes" target="_blank">Fan
Modes</a>
</li>
</ul>
<h5>Help/About</h5>
<ul>
<li>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/issues/new/choose" target="_blank">Support Request</a>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/issues/new/choose" target="_blank">Support
Request</a>
</li>
<li>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/blob/latest/CHANGELOG.md" target="_blank">Changelog</a>
<a href="https://github.com/donavanbecker/homebridge-cloudflared-tunnel/blob/latest/CHANGELOG.md"
target="_blank">Changelog</a>
</li>
<li>
<a href="https://github.com/sponsors/donavanbecker" target="_blank">About Me</a>
</li>
</ul>
<h5>Disclaimer</h5>
<ul>
<li>I am in no way affiliated with Cloudflared and this plugin is a personal project that I maintain in my free time.</li>
<li>I am in no way affiliated with Cloudflared and this plugin is a personal project that I maintain in my free
time.</li>
<li>Use this plugin entirely at your own risk - please see licence for more information.</li>
</ul>
</div>
Expand Down Expand Up @@ -222,4 +230,4 @@ <h5>Disclaimer</h5>
homebridge.hideSpinner();
}
})();
</script>
</script>
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
*
* index.ts: homebridge-cloudflared-tunnel.
*/
import { API } from 'homebridge';

import { CloudflaredTunnelPlatform } from './platform.js';
import { PLATFORM_NAME, PLUGIN_NAME } from './settings.js';

import type { API } from 'homebridge';

// Register our platform with homebridge.
export default (api: API): void => {

Expand Down
Loading

0 comments on commit caa515a

Please sign in to comment.