File size: 4,281 Bytes
1e9310c
711291e
 
 
 
a39a88c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
711291e
1e9310c
711291e
 
248a46e
 
112c1c4
6b5e064
 
6632feb
f1f755c
 
 
dd777e8
 
 
b611780
 
5eda139
9db62d9
 
 
f931191
 
 
bd86e1e
 
 
e426864
 
 
711291e
 
 
 
 
 
 
 
 
 
56d2c8a
6b5e064
1fc8b97
5eda139
9db62d9
f931191
bd86e1e
e426864
 
711291e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1e9310c
b654efd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Settings</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 0;
        }
        h1 {
            color: green;
            text-align: left;
            padding: 20px;
            background-color: #e0e0e0;
            margin: 0;
        }
        form {
            padding: 20px;
        }
        label {
            display: block;
            margin-top: 10px;
            color: green;
            text-align: left;
        }
        input[type="text"] {
            width: 100%;
            padding: 10px;
            margin-top: 5px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        button {
            background-color: green;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            margin-top: 20px;
        }
        button:hover {
            background-color: darkgreen;
        }
    </style>
</head>
<body>
    <h1>Settings</h1>
    <form id="settingsForm">
        <label for="api_key_sys">api_key_sys:</label>
        <input type="text" id="api_key_sys" name="api_key_sys"><br><br>

        <label for="ALLOWED_ORIGIN">ALLOWED_ORIGIN:</label>
        <input type="text" id="ALLOWED_ORIGIN" name="ALLOWED_ORIGIN"><br><br>

        <label for="crypto_key_sys">crypto_key_sys:</label>
        <input type="text" id="crypto_key_sys" name="crypto_key_sys"><br><br>

        <label for="vk_api_key">vk_api_key:</label>
        <input type="text" id="vk_api_key" name="vk_api_key"><br><br>      

        <label for="senler_token">senler_token:</label>
        <input type="text" id="senler_token" name="senler_token"><br><br>

        <label for="wa_ak">wa_ak:</label>
        <input type="text" id="wa_ak" name="wa_ak"><br><br>

        <label for="wa_api_key">wa_api_key:</label>
        <input type="text" id="wa_api_key" name="wa_api_key"><br><br>

        <label for="curators">curators:</label>
        <input type="text" id="curators" name="curators"><br><br>

        <label for="call_api_key">call_api_key:</label>
        <input type="text" id="call_api_key" name="call_api_key"><br><br>

        <button type="button" onclick="saveSettings()">Save</button>
    </form>

    <script>
        function loadSettings() {
            fetch('/settings', {
                method: 'GET'
            })
            .then(response => response.json())
            .then(data => {
                document.getElementById('api_key_sys').value = data.api_key_sys;
                document.getElementById('ALLOWED_ORIGIN').value = data.ALLOWED_ORIGIN;
                document.getElementById('vk_api_key').value = data.vk_api_key;
                document.getElementById('crypto_key_sys').value = data.crypto_key_sys; 
                document.getElementById('senler_token').value = data.senler_token;
                document.getElementById('wa_ak').value = data.wa_ak;
                document.getElementById('wa_api_key').value = data.wa_api_key;
                document.getElementById('curators').value = data.curators; 
                document.getElementById('call_api_key').value = data.call_api_key;                
            })
            .catch(error => console.error('Error:', error));
        }
        function saveSettings() {
            const form = document.getElementById('settingsForm');
            const formData = new FormData(form);
            const data = {};
            formData.forEach((value, key) => {
                if (value !== '') {
                    data[key] = value;
                }
            });
            fetch('/settings', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify(data)
            })
            .then(response => response.json())
            .then(data => {
                console.log('Success:', data);
            })
            .catch(error => console.error('Error:', error));
        }
        window.onload = loadSettings;
    </script>
</body>
</html>