So, I'm trying to add some settings into the admin panel for a plugin I'm trying to make. But right away, I'm having trouble figuring out how to get a page to come up in the admin panel for the settings.
I looked at the dbsearch plugin among some others to try and figure out how, since I couldn't find much in the docs.
So from there, in my library.js I have this:
Author.addAdminLink = function(custom_header, callback) {
custom_header.plugins.push({
"route": "/plugins/json-auth",
"icon": "fa-book",
"name": "JSON Auth"
});
callback(null, custom_header);
};
The "JSON Auth" button comes up fine in the admin panel, but when I click it I get
/api/admin/plugins/json-auth Not Found
I set up the directory structure to match how dbsearch's is, with
nodebb-plugin-json-auth/templates/admin/plugins/json-auth.tpl
<h1>JSON Auth</h1>
<hr />
<form>
<p>
Auth Settings
</p>
<div class="alert alert-info">
<p>
<label>Client ID <br /><small>Unique ID for the site</small></label>
<input type="text" data-field="json-auth:id" title="Client ID" class="form-control" placeholder="randomness123">
<label>Secret Key <br /><small>Secures the authentication. Do not give it out to anyone.</small></label>
<input type="text" data-field="json-auth:secret-key" title="Secret Key" class="form-control">
<label>Site Name <br /><small>Displayed on buttons to users</small></label>
<input type="text" data-field="json-auth:name" title="Site Name" class="form-control" placeholder="My Site">
<br />
<label>Auth URL <br /><small>URL that will be called that should supply the user information as JSON</small></label>
<input type="text" data-field="json-auth:auth-url" title="Auth URL" class="form-control" placeholder="http://path.to/auth">
<label>Login URL <br /><small>URL where someone logs in if they aren't already.</small></label>
<input type="text" data-field="json-auth:login-url" title="Login URL" class="form-control" placeholder="http://path.to/login">
<label>Registration URL <br /><small>URL for new user registration</small></label>
<input type="text" data-field="json-auth:registration-url" title="Registration URL" class="form-control" placeholder="http://path.to/register">
<br />
</p>
</div>
</form>
<button class="btn btn-primary" id="save">Save</button>
And in plugin.json I've included
"staticDirs": {
"templates": "./public/templates",
"json-auth": "public"
},
"templates": "./public/templates"
I'm not sure what I'm missing here.