verification.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. const {db, settingsData, sendMsg, createNotice, hasPerm} = require('./util.js');
  2. /**
  3. * Let a user change verifications
  4. * @param {import('http').ServerResponse} res - The server response
  5. * @param {CheerioStatic} $ - The response body
  6. * @param {import('./util.js').Guild} guild - The current guild
  7. * @param {String[]} args - The url parts
  8. */
  9. function dashboard_verification(res, $, guild, args) {
  10. $('.channel#verification').addClass('selected');
  11. db.all( 'SELECT configid, channel, role, editcount, usergroup, accountage, rename FROM verification WHERE guild = ? ORDER BY configid ASC', [guild.id], function(dberror, rows) {
  12. if ( dberror ) {
  13. console.log( '- Dashboard: Error while getting the verifications: ' + dberror );
  14. $('#text .description').text('Failed to load the verifications!');
  15. let body = $.html();
  16. res.writeHead(200, {'Content-Length': body.length});
  17. res.write( body );
  18. return res.end();
  19. }
  20. $('<pre>').text(JSON.stringify(rows, null, '\t')).appendTo('#text .description');
  21. let body = $.html();
  22. res.writeHead(200, {'Content-Length': body.length});
  23. res.write( body );
  24. return res.end();
  25. } );
  26. }
  27. function update_verification() {
  28. }
  29. module.exports = {
  30. get: dashboard_verification,
  31. post: update_verification
  32. };