node-red-contrib-micropub/indieauth.html

63 lines
2.2 KiB
HTML
Raw Normal View History

2019-02-06 14:14:39 +00:00
<script type="text/javascript">
RED.nodes.registerType('indieauth', {
category: 'config',
defaults: {
client_id: {value: ""},
me: {value: ""}
},
credentials: {
micropub_endpoint: {value: "", required: false},
token_endpoint: {value: "", required: false},
auth_token: {value: "", required: false}
},
label: function () {
return this.me || 'indieauth';
},
exportable: false,
oneditprepare: function () {
var id = this.id;
2019-02-07 20:38:13 +00:00
var pathname = document.location.pathname;
if (pathname.slice(-1) != "/") {
pathname += "/";
}
var callback = location.protocol + "//" +
location.hostname +
(location.port?":"+location.port:"")+
pathname + "indieauth/auth/callback";
2019-02-06 14:14:39 +00:00
$('#node-config-start-auth').mousedown(function () {
var clientId = $("#node-config-input-client_id").val();
var me = $("#node-config-input-me").val();
var url = 'indieauth/auth?id=' + id + '&client_id=' + clientId + "&me=" + me + "&callback=" + encodeURIComponent(callback);
$(this).attr("href", url);
});
}
})
</script>
<script type="text/x-red" data-template-name="indieauth">
2019-02-07 20:38:13 +00:00
<div class="form-tips" id="node-config-indieauth-tooltip">
Fill in your Client ID, Me url and click Web Sign In. You will be redirect to your authorization endpoint. When authorization is complete you can close the new tab and
click Done.
</div>
2019-02-06 14:14:39 +00:00
<div class="form-row">
<label for="node-config-input-client_id"><i class="icon-bookmark"></i> Client ID</label>
<input type="text" id="node-config-input-client_id">
</div>
<div class="form-row">
<label for="node-config-input-me"><i class="icon-bookmark"></i> me</label>
<input type="text" id="node-config-input-me">
</div>
<div class="form-row">
<label>&nbsp;</label>
<a class="btn" id="node-config-start-auth" href="#" target="_blank"><span>Web Sign In</span></a>
</div>
</script>