diff --git a/components/app.js b/components/app.js index 3bc5ff8..8fc48d5 100644 --- a/components/app.js +++ b/components/app.js @@ -1571,6 +1571,7 @@ export default class App extends Component { <${Buffer} buffer=${activeBuffer} server=${activeServer} + isBouncer=${isBouncer} onChannelClick=${this.handleChannelClick} onNickClick=${this.handleNickClick}/> diff --git a/components/buffer.js b/components/buffer.js index d08e12e..9c8096a 100644 --- a/components/buffer.js +++ b/components/buffer.js @@ -3,6 +3,7 @@ import linkify from "../lib/linkify.js"; import * as irc from "../lib/irc.js"; import { strip as stripANSI } from "../lib/ansi.js"; import { BufferType, getNickURL, getChannelURL, getMessageURL } from "../state.js"; +import * as store from "../store.js"; import Membership from "./membership.js"; function djb2(s) { @@ -415,6 +416,46 @@ class NotificationNagger extends Component { } } +class ProtocolHandlerNagger extends Component { + state = { nag: true }; + + constructor(props) { + super(props); + + this.handleClick = this.handleClick.bind(this); + + this.state.nag = !store.naggedProtocolHandler.load(); + } + + handleClick(event) { + event.preventDefault(); + + let url = window.location.origin + window.location.pathname + "?open=%s"; + try { + navigator.registerProtocolHandler("irc", url); + navigator.registerProtocolHandler("ircs", url); + } catch (err) { + console.error("Failed to register protocol handler: ", err); + } + + store.naggedProtocolHandler.put(true); + this.setState({ nag: false }); + } + + render() { + if (!navigator.registerProtocolHandler || !this.state.nag) { + return null; + } + return html` +