sequelize-game-bank 1.0.0-beta.1 → 1.0.0

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.
Binary file
package/index.js CHANGED
@@ -11,11 +11,13 @@ const { writeTemplatesIfNotExist } = require('./database/services/bot/write');
11
11
  const registerRoutes = require('./server/server');
12
12
  const Transaction = require('./database/models/Transaction');
13
13
  const app = express();
14
-
14
+ const path = require("path")
15
+ const { verifySession } = require('./server/server');
15
16
  app.use(express.json());
16
17
  app.use(cookieParser());
17
18
 
18
19
 
20
+
19
21
  async function initBankModule() {
20
22
  try {
21
23
  await sequelize.sync();
@@ -42,10 +44,38 @@ async function initBankModule() {
42
44
  console.log(logger.ServerBankInfo(`Супер пользвотель создан`))
43
45
 
44
46
  const configuredApp = registerRoutes(app);
45
- configuredApp.use(express.static('public'));
47
+
48
+ // 1. Открытые папки со стилями, скриптами фронтенда и стандартными картинками
49
+ // (Файлы должны лежать в public/css, public/js и т.д.)
50
+ app.use('/css', express.static(path.join(__dirname, 'public/css')));
51
+ app.use('/js', express.static(path.join(__dirname, 'public/js')));
52
+ app.use('/uploads', express.static(path.join(__dirname, 'public/uploads')));
53
+
54
+ const { verifyPageSession } = require('./server/middleware/auth');
55
+
56
+ const pages = ['general.html', 'profile.html', 'accounts.html', 'transfer.html', 'history.html', 'credit.html', 'admin.html'];
57
+
58
+ pages.forEach(page => {
59
+ // Защита страниц: при переходе между ними вылетов не будет
60
+ app.get(`/${page}`, verifyPageSession, (req, res) => {
61
+ res.sendFile(path.join(__dirname, 'public', page));
62
+ });
63
+ });
64
+
65
+
66
+ // 3. Открытые страницы, доступные БЕЗ авторизации
67
+ app.get('/login.html', (req, res) => res.sendFile(path.join(__dirname, 'public', 'login.html')));
68
+ app.get('/register.html', (req, res) => res.sendFile(path.join(__dirname, 'public', 'register.html')));
69
+ app.get('/home.html', (req, res) => res.sendFile(path.join(__dirname, 'public', 'home.html')));
70
+ app.get('/favicon.ico', (req, res) => res.sendFile(path.join(__dirname, 'public', 'icon', 'icon.png')));
71
+ // Перенаправление с глав,,,,,,ного адреса на главную страницу банка
72
+ app.get('/', verifySession, (req, res) => res.redirect('/general.html'));
73
+ app.get('/', (req, res) => res.redirect('/home.html'));
74
+ // ... (остальной код возврата configuredApp)
75
+
46
76
  return configuredApp;
47
77
  } catch (err) {
48
- console.log(logger.ServerBankError("[-100] Критическая ошибка инициализации модулей"));
78
+ console.log(logger.ServerBankError("[-100] Критическая ошибка инициализации модулей", err));
49
79
  throw err;
50
80
  }
51
81
  }
@@ -0,0 +1,14 @@
1
+
2
+ ------------------------------[ 27.09.2026, 18:54:32 ]------------------------------
3
+ TYPE: UNCAUGHT_EXCEPTION
4
+ MESSAGE: Cannot find module './middleware/auth'
5
+ Require stack:
6
+ - /home/pl/Desktop/sequelize-game-bank/index.js
7
+ - /home/pl/Desktop/sequelize-game-bank/test.js
8
+ STACK:
9
+ Error: Cannot find module './middleware/auth'
10
+ Require stack:
11
+ - /home/pl/Desktop/sequelize-game-bank/index.js
12
+ - /home/pl/Desktop/sequelize-game-bank/test.js
13
+ at Object.<anonymous> (/home/pl/Desktop/sequelize-game-bank/index.js:7:30)
14
+ ----------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sequelize-game-bank",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0",
4
4
  "description": "Модульная архитектура City-bank с поддержкой кредитов и 2FA",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -15,6 +15,7 @@
15
15
  "dotenv": "^18.0.0",
16
16
  "express": "^5.2.1",
17
17
  "jsonwebtoken": "^9.0.3",
18
+ "load-stopper": "^1.1.0",
18
19
  "multer": "^2.4.0",
19
20
  "nodemailer": "^10.0.10",
20
21
  "otplib": "^12.0.1",
@@ -0,0 +1,44 @@
1
+ <!DOCTYPE html>
2
+ <html lang="ru">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>City-Bank | Мои Счета</title>
6
+ <link rel="stylesheet" href="/css/style.css">
7
+ </head>
8
+ <body>
9
+ <div class="main-container">
10
+ <div class="sidebar">
11
+ <div style="text-align: center; margin-bottom: 15px;">
12
+ <img id="user-avatar" src="/uploads/avatars/default.png" style="width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid #1abc9c;">
13
+ </div>
14
+ <h2 id="user-display">Загрузка...</h2>
15
+ <p style="text-align: center; color: #bbb;">Всего средств: <span id="total-manny" style="font-weight: bold; color: #1abc9c;">0.00</span> руб.</p>
16
+ <hr style="border-color: #34495e;">
17
+ <a href="/general.html" class="nav-item"><button class="menu-btn">Главная</button></a>
18
+ <a href="/accounts.html" class="nav-item"><button class="menu-btn active">Мои Счета</button></a>
19
+ <a href="/transfer.html" class="nav-item"><button class="menu-btn">Перевод средств</button></a>
20
+ <a href="/history.html" class="nav-item"><button class="menu-btn">История транзакций</button></a>
21
+ <a href="/credit.html" class="nav-item"><button class="menu-btn">Оформить Кредит</button></a>
22
+ <a href="/profile.html" class="nav-item"><button class="menu-btn">Управление профилем</button></a>
23
+ <button class="menu-btn" onclick="location.href='/admin.html'" id="admin-nav" style="display: none; color: #ffc107;">Админ-панель</button>
24
+ <br><br>
25
+ <button class="menu-btn btn-danger" id="logoutBtn" style="text-align: center;">Выйти из системы</button>
26
+ </div>
27
+ <div class="container">
28
+ <div class="container-center">
29
+ <h3>Ваши активные банковские счета</h3>
30
+ <div class="card">
31
+ <button class="btn" onclick="openCreateAccountModal()">+ Открыть новый счет (0.00 руб)</button>
32
+ <table id="table-accounts">
33
+ <thead><tr><th>ID Счета</th><th>Баланс</th><th>2FA Защита</th><th>Статус</th><th>Действие</th></tr></thead>
34
+ <tbody></tbody>
35
+ </table>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/4.4.2/zxcvbn.js"></script>
41
+ <script src="/js/sweetalert2.js"></script>
42
+ <script src="/js/js.js"></script>
43
+ </body>
44
+ </html>
package/public/admin.html CHANGED
@@ -40,7 +40,7 @@
40
40
 
41
41
  <div class="container">
42
42
  <h2>👑 ЦЕНТРАЛЬНЫЙ ПУЛЬТ АДМИНИСТРАТОРА (ROOT)</h2>
43
- <button class="btn" onclick="location.href='/dashboard.html'" style="background:#6c757d;"><- В личный кабинет</button>
43
+ <button class="btn" onclick="location.href='/general.html'" style="background:#6c757d;"><- В личный кабинет</button>
44
44
 
45
45
  <!-- Интерактивная таблица всех счетов -->
46
46
  <table id="all-accounts-table">
@@ -0,0 +1,61 @@
1
+ <!DOCTYPE html>
2
+ <html lang="ru">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>City-Bank | Кредитование</title>
6
+ <link rel="stylesheet" href="/css/style.css">
7
+ </head>
8
+ <body>
9
+ <div class="main-container">
10
+ <div class="sidebar">
11
+ <div style="text-align: center; margin-bottom: 15px;">
12
+ <img id="user-avatar" src="/uploads/avatars/default.png" style="width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid #1abc9c;">
13
+ </div>
14
+ <h2 id="user-display">Загрузка...</h2>
15
+ <p style="text-align: center; color: #bbb;">Всего средств: <span id="total-manny" style="font-weight: bold; color: #1abc9c;">0.00</span> руб.</p>
16
+ <hr style="border-color: #34495e;">
17
+ <a href="/general.html" class="nav-item"><button class="menu-btn active">Главная</button></a>
18
+ <a href="/accounts.html" class="nav-item"><button class="menu-btn">Мои Счета</button></a>
19
+ <a href="/transfer.html" class="nav-item"><button class="menu-btn">Перевод средств</button></a>
20
+ <a href="/history.html" class="nav-item"><button class="menu-btn">История транзакций</button></a>
21
+ <a href="/credit.html" class="nav-item"><button class="menu-btn">Оформить Кредит</button></a>
22
+ <a href="/profile.html" class="nav-item"><button class="menu-btn">Управление профилем</button></a>
23
+ <button class="menu-btn" onclick="location.href='/admin.html'" id="admin-nav" style="display: none; color: #ffc107;">Админ-панель</button>
24
+ <br><br>
25
+ <button class="menu-btn btn-danger" id="logoutBtn" style="text-align: center;">Выйти из системы</button>
26
+ </div>
27
+
28
+ <div class="container">
29
+ <div class="container-center">
30
+ <h3>Заявка на автономный кредит City-bank</h3>
31
+ <div class="card">
32
+ <div class="form-group">
33
+ <label>Счет для зачисления кредита</label>
34
+ <select id="credit-target"></select>
35
+ </div>
36
+ <div class="form-group">
37
+ <label>Сумма кредитования</label>
38
+ <input type="number" id="credit-amount" placeholder="0.00">
39
+ </div>
40
+ <div class="form-group">
41
+ <label>Срок погашения (Кол-во платежей)</label>
42
+ <input type="number" id="credit-payments" placeholder="Например: 12">
43
+ </div>
44
+ <div class="checkbox-group" style="margin-bottom: 15px;">
45
+ <input type="checkbox" id="credit-auto" checked style="width: auto;">
46
+ <label style="display: inline;" for="credit-auto">Разрешить автоматическое списание взносов со счета</label>
47
+ </div>
48
+ <div class="form-group">
49
+ <label>Пин-код счета</label>
50
+ <input type="password" id="credit-pin" placeholder="Введите пин-код счета">
51
+ </div>
52
+ <button class="btn" onclick="applyForCredit()">Оформить заем</button>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/4.4.2/zxcvbn.js"></script>
58
+ <script src="/js/sweetalert2.js"></script>
59
+ <script src="/js/js.js"></script>
60
+ </body>
61
+ </html>
@@ -0,0 +1,58 @@
1
+ @import url('https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css');
2
+ body { font-family: sans-serif; margin: 0; background: #f4f6f9; display: flex; }
3
+ .sidebar { width: 260px; background: #2c3e50; color: white; height: 100vh; padding: 20px; box-sizing: border-box; }
4
+ .content { flex: 1; padding: 30px; box-sizing: border-box; overflow-y: auto; height: 100vh; }
5
+ .sidebar h2 { color: #1abc9c; margin-top: 0; text-align: center; }
6
+ .menu-btn { width: 100%; padding: 12px; background: none; border: none; color: white; text-align: left; font-size: 16px; cursor: pointer; border-radius: 4px; margin-bottom: 5px; }
7
+ .menu-btn:hover, .menu-btn.active { background: #34495e; color: #1abc9c; }
8
+ .card { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); margin-bottom: 25px; }
9
+ .section { display: none; }
10
+ .section.active { display: block; }
11
+ table { width: 100%; border-collapse: collapse; margin-top: 15px; }
12
+ th, td { padding: 12px; border-bottom: 1px solid #ddd; text-align: left; }
13
+ th { background: #f8f9fa; }
14
+ .form-group { margin-bottom: 15px; max-width: 400px; }
15
+ label { display: block; margin-bottom: 5px; font-weight: bold; font-size: 14px; }
16
+ input, select { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; }
17
+ .btn { padding: 10px 20px; background: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; }
18
+ .btn-danger { background: #dc3545; }
19
+ div.container{
20
+ display: flex;
21
+ flex-direction: column;
22
+ justify-content:start;
23
+ align-items: center;
24
+ width: 1400px;
25
+ }
26
+ div.container-center{
27
+ display: flex;
28
+ flex-direction: column;
29
+ justify-content:center;
30
+ align-items: center;
31
+ }
32
+ div.main-container{
33
+ display: flex;
34
+ flex-direction: row;
35
+ justify-content: center;
36
+
37
+ }
38
+ #user-display-page{
39
+ color:Blue
40
+ }
41
+ form.help_msg-form{
42
+ background-color: #6cb3ff;
43
+ padding: 10px 100px;
44
+ border-radius: 2px #0026ff solid;
45
+ border-radius: 30px;
46
+ gap: 30px;
47
+ }
48
+ form input[type="text"]{
49
+ background-color: lightgreen;
50
+ border: 1px solid green;
51
+ border-radius: 10px;
52
+ }
53
+ form input[type="submit"]{
54
+ background-color: lightgreen;
55
+ border: 1px solid green;
56
+ border-radius: 10px;
57
+ }
58
+
@@ -0,0 +1,53 @@
1
+ <!DOCTYPE html>
2
+ <html lang="ru">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>City-Bank | Главная</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+ <link rel="stylesheet" href="/css/style.css">
8
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
9
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
10
+ </head>
11
+ <body>
12
+ <div class="main-container">
13
+ <div class="sidebar">
14
+ <div style="text-align: center; margin-bottom: 15px;">
15
+ <img id="user-avatar" src="/uploads/avatars/default.png" style="width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid #1abc9c;">
16
+ </div>
17
+ <h2 id="user-display">Загрузка...</h2>
18
+ <p style="text-align: center; color: #bbb;">Всего средств: <span id="total-manny" style="font-weight: bold; color: #1abc9c;">0.00</span> руб.</p>
19
+ <hr style="border-color: #34495e;">
20
+ <a href="/general.html" class="nav-item"><button class="menu-btn active">Главная</button></a>
21
+ <a href="/accounts.html" class="nav-item"><button class="menu-btn">Мои Счета</button></a>
22
+ <a href="/transfer.html" class="nav-item"><button class="menu-btn">Перевод средств</button></a>
23
+ <a href="/history.html" class="nav-item"><button class="menu-btn">История транзакций</button></a>
24
+ <a href="/credit.html" class="nav-item"><button class="menu-btn">Оформить Кредит</button></a>
25
+ <a href="/profile.html" class="nav-item"><button class="menu-btn">Управление профилем</button></a>
26
+ <button class="menu-btn" onclick="location.href='/admin.html'" id="admin-nav" style="display: none; color: #ffc107;">Админ-панель</button>
27
+ <br><br>
28
+ <button class="menu-btn btn-danger" id="logoutBtn" style="text-align: center;">Выйти из системы</button>
29
+ </div>
30
+
31
+ <div class="container">
32
+ <div class="container-center">
33
+ <div style="text-align: center; margin-bottom: 15px;" onclick="uploadAvatar()">
34
+ <img id="user-avatar2" src="/uploads/avatars/default.png" style="width: 250px; height: 250px; border-radius: 50%; object-fit: cover; border: 3px solid #1abc9c;">
35
+ </div>
36
+ <h1 id="user-display-page">Загрузка...</h1>
37
+ <!--и так далее-->
38
+ <p>Подать запрос в поддержку</p>
39
+ <form action="/help-message" method="post" class="help_msg-form">
40
+ <input type="text" name="hm" placeholder="Здраствуйте. Я .. хочу попросить помощи. У меня не работает ... . Спасибо">
41
+ <input type="submit" value="Отправить">
42
+ </form>
43
+ <footer>
44
+ <p style="color: lightslategray;">Банк ©2026</p>
45
+ </footer>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/4.4.2/zxcvbn.js"></script>
50
+ <script src="/js/sweetalert2.js"></script>
51
+ <script src="/js/js.js"></script>
52
+ </body>
53
+ </html>
@@ -0,0 +1,62 @@
1
+ <!DOCTYPE html>
2
+ <html lang="ru">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>City-Bank | История</title>
6
+ <link rel="stylesheet" href="/css/style.css">
7
+ </head>
8
+ <body>
9
+ <div class="main-container">
10
+ <div class="sidebar">
11
+ <div style="text-align: center; margin-bottom: 15px;">
12
+ <img id="user-avatar" src="/uploads/avatars/default.png" style="width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid #1abc9c;">
13
+ </div>
14
+ <h2 id="user-display">Загрузка...</h2>
15
+ <p style="text-align: center; color: #bbb;">Всего средств: <span id="total-manny" style="font-weight: bold; color: #1abc9c;">0.00</span> руб.</p>
16
+ <hr style="border-color: #34495e;">
17
+ <a href="/general.html" class="nav-item"><button class="menu-btn active">Главная</button></a>
18
+ <a href="/accounts.html" class="nav-item"><button class="menu-btn">Мои Счета</button></a>
19
+ <a href="/transfer.html" class="nav-item"><button class="menu-btn">Перевод средств</button></a>
20
+ <a href="/history.html" class="nav-item"><button class="menu-btn">История транзакций</button></a>
21
+ <a href="/credit.html" class="nav-item"><button class="menu-btn">Оформить Кредит</button></a>
22
+ <a href="/profile.html" class="nav-item"><button class="menu-btn">Управление профилем</button></a>
23
+ <button class="menu-btn" onclick="location.href='/admin.html'" id="admin-nav" style="display: none; color: #ffc107;">Админ-панель</button>
24
+ <br><br>
25
+ <button class="menu-btn btn-danger" id="logoutBtn" style="text-align: center;">Выйти из системы</button>
26
+ </div>
27
+ <div class="container">
28
+ <div class="container-center">
29
+ <div style="text-align: center; margin-bottom: 15px;">
30
+ <img id="user-avatar2" src="/uploads/avatars/default.png" style="width: 250px; height: 250px; border-radius: 50%; object-fit: cover; border: 3px solid #1abc9c;">
31
+ </div>
32
+ <h3>История финансовых операций</h3>
33
+ <div class="card">
34
+ <table id="table-logs">
35
+ <thead>
36
+ <tr>
37
+ <th>Дата</th>
38
+ <th>Время</th>
39
+ <th>Счет в банке</th>
40
+ <th>Тип операции</th>
41
+ <th>Отправитель / Инициатор</th>
42
+ <th>Сумма изменений</th>
43
+ </tr>
44
+ </thead>
45
+ <tbody>
46
+ </tbody>
47
+ </table>
48
+ </div>
49
+ <footer>
50
+ <p style="color: lightslategray;">Банк ©2026</p>
51
+ </footer>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ <dialog id="admin">
56
+ <h1>hello</h1>
57
+ </dialog>
58
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/4.4.2/zxcvbn.js"></script>
59
+ <script src="/js/sweetalert2.js"></script>
60
+ <script src="/js/js.js"></script>
61
+ </body>
62
+ </html>