config-manager.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. const fs = require('fs');
  2. const path = require('path');
  3. const configFilePath = path.join(__dirname, 'oasis-config.json');
  4. if (!fs.existsSync(configFilePath)) {
  5. const defaultConfig = {
  6. "themes": {
  7. "current": "Dark-SNH"
  8. },
  9. "modules": {
  10. "popularMod": "on",
  11. "topicsMod": "on",
  12. "summariesMod": "on",
  13. "latestMod": "on",
  14. "threadsMod": "on",
  15. "multiverseMod": "on",
  16. "invitesMod": "on",
  17. "walletMod": "on",
  18. "legacyMod": "on",
  19. "cipherMod": "on",
  20. "bookmarksMod": "on",
  21. "videosMod": "on",
  22. "docsMod": "on",
  23. "audiosMod": "on",
  24. "tagsMod": "on",
  25. "imagesMod": "on",
  26. "trendingMod": "on",
  27. "eventsMod": "on",
  28. "tasksMod": "on",
  29. "marketMod": "on",
  30. "tribesMod": "on",
  31. "votesMod": "on",
  32. "reportsMod": "on",
  33. "opinionsMod": "on",
  34. "transfersMod": "on",
  35. "feedMod": "on",
  36. "pixeliaMod": "on",
  37. "agendaMod": "on",
  38. "aiMod": "on",
  39. "forumMod": "on",
  40. "jobsMod": "on",
  41. "projectsMod": "on",
  42. "bankingMod": "on",
  43. "parliamentMod": "on",
  44. "courtsMod": "on"
  45. },
  46. "wallet": {
  47. "url": "http://localhost:7474",
  48. "user": "",
  49. "pass": "",
  50. "fee": "5"
  51. },
  52. "walletPub": {
  53. "url": "",
  54. "user": "",
  55. "pass": ""
  56. },
  57. "ai": {
  58. "prompt": "Provide an informative and precise response."
  59. },
  60. "ssbLogStream": {
  61. "limit": 2000
  62. },
  63. "homePage": "activity"
  64. };
  65. fs.writeFileSync(configFilePath, JSON.stringify(defaultConfig, null, 2));
  66. }
  67. const getConfig = () => {
  68. const configData = fs.readFileSync(configFilePath);
  69. return JSON.parse(configData);
  70. };
  71. const saveConfig = (newConfig) => {
  72. fs.writeFileSync(configFilePath, JSON.stringify(newConfig, null, 2));
  73. };
  74. module.exports = {
  75. getConfig,
  76. saveConfig,
  77. };