config-manager.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. "favoritesMod": "on"
  46. },
  47. "wallet": {
  48. "url": "http://localhost:7474",
  49. "user": "",
  50. "pass": "",
  51. "fee": "5"
  52. },
  53. "walletPub": {
  54. "url": "",
  55. "user": "",
  56. "pass": ""
  57. },
  58. "ai": {
  59. "prompt": "Provide an informative and precise response."
  60. },
  61. "ssbLogStream": {
  62. "limit": 2000
  63. },
  64. "homePage": "activity"
  65. };
  66. fs.writeFileSync(configFilePath, JSON.stringify(defaultConfig, null, 2));
  67. }
  68. const getConfig = () => {
  69. const configData = fs.readFileSync(configFilePath);
  70. return JSON.parse(configData);
  71. };
  72. const saveConfig = (newConfig) => {
  73. fs.writeFileSync(configFilePath, JSON.stringify(newConfig, null, 2));
  74. };
  75. module.exports = {
  76. getConfig,
  77. saveConfig,
  78. };