nodebb-plugin-niki-loyalty 1.5.8 → 1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/library.js +23 -3
  2. package/package.json +1 -1
package/library.js CHANGED
@@ -51,13 +51,24 @@ const TEST_MODE_UNLIMITED = false;
51
51
  // =========================
52
52
  async function loadAndApplySettings() {
53
53
  try {
54
+ console.log('[NIKI] Ayarlar DB\'den yükleniyor...');
55
+
54
56
  const saved = await new Promise((resolve) => {
55
57
  meta.settings.get('niki-loyalty', (err, settings) => {
56
- resolve(err ? {} : (settings || {}));
58
+ if (err) {
59
+ console.error('[NIKI] meta.settings.get HATA:', err);
60
+ return resolve({});
61
+ }
62
+ resolve(settings || {});
57
63
  });
58
64
  });
59
65
 
60
- if (!saved || Object.keys(saved).length === 0) return;
66
+ console.log('[NIKI] DB\'den gelen ham veri:', JSON.stringify(saved, null, 2));
67
+
68
+ if (!saved || Object.keys(saved).length === 0) {
69
+ console.log('[NIKI] DB\'de kayıtlı ayar yok, varsayılanlar kullanılacak.');
70
+ return;
71
+ }
61
72
 
62
73
  // Genel
63
74
  if (saved.dailyCap) SETTINGS.dailyCap = parseInt(saved.dailyCap, 10) || SETTINGS.dailyCap;
@@ -83,6 +94,12 @@ async function loadAndApplySettings() {
83
94
  if (saved.bonus_vip !== undefined && saved.bonus_vip !== '')
84
95
  GROUP_BONUSES['VIP'] = parseInt(saved.bonus_vip, 10);
85
96
 
97
+ console.log('[NIKI] === UYGULANAN AYARLAR ===');
98
+ console.log('[NIKI] SETTINGS:', JSON.stringify(SETTINGS));
99
+ console.log('[NIKI] ACTIONS:', JSON.stringify(ACTIONS));
100
+ console.log('[NIKI] REWARDS:', JSON.stringify(REWARDS));
101
+ console.log('[NIKI] GROUP_BONUSES:', JSON.stringify(GROUP_BONUSES));
102
+
86
103
  } catch (err) {
87
104
  console.error('[NIKI] Ayarlar yüklenirken hata:', err);
88
105
  }
@@ -126,8 +143,9 @@ async function awardDailyAction(uid, actionKey) {
126
143
  const today = new Date().toISOString().slice(0, 10).replace(/-/g, '');
127
144
  const rule = ACTIONS[actionKey];
128
145
 
129
- if (!rule) {
146
+ console.log(`[NIKI] awardDailyAction => uid:${uid}, action:${actionKey}, rule:${JSON.stringify(rule)}, dailyCap:${SETTINGS.dailyCap}`);
130
147
 
148
+ if (!rule) {
131
149
  return { success: false, reason: 'unknown_action' };
132
150
  }
133
151
 
@@ -954,11 +972,13 @@ Plugin.adminGetStats = async function (socket, data) {
954
972
 
955
973
  // 6) AYARLARI YENİDEN YÜKLE (Admin panelden kaydet sonrası)
956
974
  Plugin.reloadSettings = async function (socket) {
975
+ console.log('[NIKI] reloadSettings socket çağrıldı, uid:', socket.uid);
957
976
  const uid = socket.uid;
958
977
  if (!uid) throw new Error('Giriş yapmalısınız.');
959
978
  const isAdmin = await user.isAdministrator(uid);
960
979
  if (!isAdmin) throw new Error('Yetkisiz Erişim');
961
980
  await loadAndApplySettings();
981
+ console.log('[NIKI] reloadSettings tamamlandı.');
962
982
  return { success: true };
963
983
  };
964
984
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-niki-loyalty",
3
- "version": "1.5.8",
3
+ "version": "1.5.9",
4
4
  "description": "Niki The Cat Coffee Loyalty System - Earn points while studying on IEU Forum.",
5
5
  "main": "library.js",
6
6
  "nbbpm": {