akra35567 commited on
Commit
d37f8ec
Β·
verified Β·
1 Parent(s): 1fdbae7

Update modules/LevelSystem.js

Browse files
Files changed (1) hide show
  1. modules/LevelSystem.js +13 -3
modules/LevelSystem.js CHANGED
@@ -6,13 +6,22 @@ class LevelSystem {
6
  constructor(logger = console) {
7
  this.config = ConfigManager.getInstance();
8
  this.logger = logger;
9
- this.dbPath = path.join(this.config.DATABASE_FOLDER, 'data', 'group_levels.json');
10
- this.promoPath = path.join(this.config.DATABASE_FOLDER, 'datauser', 'level_adm_promotion.json');
 
 
 
 
 
 
 
 
 
11
  this._ensureFiles();
12
  this.data = this._load(this.dbPath, []);
13
  this.promos = this._load(this.promoPath, {});
14
  this.windowDays = this.config.LEVEL_WINDOW_DAYS || 3;
15
- this.maxLevel = this.config.LEVEL_MAX || 60; // agora 60 nΓ­veis por padrΓ£o
16
  this.topForAdm = this.config.LEVEL_TOP_FOR_ADM || 3;
17
  }
18
 
@@ -24,6 +33,7 @@ class LevelSystem {
24
  if (!fs.existsSync(this.promoPath)) fs.writeFileSync(this.promoPath, JSON.stringify({}, null, 2));
25
  } catch (e) {
26
  this.logger.warn('LevelSystem: erro ao garantir arquivos:', e.message);
 
27
  }
28
  }
29
 
 
6
  constructor(logger = console) {
7
  this.config = ConfigManager.getInstance();
8
  this.logger = logger;
9
+
10
+ // ═══════════════════════════════════════════════════════════════════
11
+ // HF SPACES: Usar /tmp para garantir permissΓ΅es de escrita
12
+ // O HF Spaces tem sistema de arquivos somente-leitura em /
13
+ // ═══════════════════════════════════════════════════════════════════
14
+
15
+ // ForΓ§ar uso de /tmp no HF Spaces (sistema read-only)
16
+ const basePath = '/tmp/akira_data';
17
+ this.dbPath = path.join(basePath, 'data', 'group_levels.json');
18
+ this.promoPath = path.join(basePath, 'datauser', 'level_adm_promotion.json');
19
+
20
  this._ensureFiles();
21
  this.data = this._load(this.dbPath, []);
22
  this.promos = this._load(this.promoPath, {});
23
  this.windowDays = this.config.LEVEL_WINDOW_DAYS || 3;
24
+ this.maxLevel = this.config.LEVEL_MAX || 60;
25
  this.topForAdm = this.config.LEVEL_TOP_FOR_ADM || 3;
26
  }
27
 
 
33
  if (!fs.existsSync(this.promoPath)) fs.writeFileSync(this.promoPath, JSON.stringify({}, null, 2));
34
  } catch (e) {
35
  this.logger.warn('LevelSystem: erro ao garantir arquivos:', e.message);
36
+ // Silenciosamente falha em caso de erro no HF Spaces
37
  }
38
  }
39