ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.js 1.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. async function register ({
  2. registerIdAndPassAuth,
  3. peertubeHelpers,
  4. settingsManager,
  5. unregisterIdAndPassAuth
  6. }) {
  7. registerIdAndPassAuth({
  8. authName: 'spyro-auth',
  9. onLogout: () => {
  10. peertubeHelpers.logger.info('On logout for auth 1 - 1')
  11. },
  12. getWeight: () => 15,
  13. login (body) {
  14. if (body.id === 'spyro' && body.password === 'spyro password') {
  15. return Promise.resolve({
  16. username: 'spyro',
  17. email: 'spyro@example.com',
  18. role: 2,
  19. displayName: 'Spyro the Dragon'
  20. })
  21. }
  22. return null
  23. }
  24. })
  25. registerIdAndPassAuth({
  26. authName: 'crash-auth',
  27. onLogout: () => {
  28. peertubeHelpers.logger.info('On logout for auth 1 - 2')
  29. },
  30. getWeight: () => 50,
  31. login (body) {
  32. if (body.id === 'crash' && body.password === 'crash password') {
  33. return Promise.resolve({
  34. username: 'crash',
  35. email: 'crash@example.com',
  36. role: 1,
  37. displayName: 'Crash Bandicoot'
  38. })
  39. }
  40. return null
  41. }
  42. })
  43. settingsManager.onSettingsChange(settings => {
  44. if (settings.disableSpyro) {
  45. unregisterIdAndPassAuth('spyro-auth')
  46. }
  47. })
  48. }
  49. async function unregister () {
  50. return
  51. }
  52. module.exports = {
  53. register,
  54. unregister
  55. }
  56. // ###########################################################################