DmitrMakeev commited on
Commit
975e48d
1 Parent(s): c52dcef

Update up_gr.html

Browse files
Files changed (1) hide show
  1. up_gr.html +24 -11
up_gr.html CHANGED
@@ -31,7 +31,10 @@
31
  border: 1px solid #ccc;
32
  border-radius: 5px;
33
  }
34
- .create-button {
 
 
 
35
  color: white;
36
  background-color: #4CAF50;
37
  border: none;
@@ -41,21 +44,20 @@
41
  border-radius: 5px;
42
  margin-top: 20px;
43
  }
44
- .create-button:hover {
45
  background-color: #388E3C;
46
  }
47
  .group-id-container {
48
  margin-top: 20px;
49
  }
50
  .group-id {
51
- color: #007BFF;
52
- text-decoration: none;
53
- font-size: 16px;
 
 
54
  cursor: pointer;
55
  }
56
- .group-id:hover {
57
- text-decoration: underline;
58
- }
59
  </style>
60
  </head>
61
  <body>
@@ -65,7 +67,7 @@
65
  <input type="text" id="groupNameInput" placeholder="Enter group name">
66
  </div>
67
  <input type="file" id="fileInput" accept=".txt">
68
- <button class="create-button" id="createGroupButton">Create Group</button>
69
  <div class="group-id-container">
70
  <span class="group-id" id="groupIdToCopy" onclick="copyToClipboard(this)">Click here to copy the group ID</span>
71
  </div>
@@ -76,10 +78,12 @@
76
  const groupName = document.getElementById('groupNameInput').value;
77
  const fileInput = document.getElementById('fileInput');
78
  const file = fileInput.files[0];
 
79
  if (!apiKey || !groupName || !file) {
80
  alert('Please enter an API key, group name, and select a file.');
81
  return;
82
  }
 
83
  const reader = new FileReader();
84
  reader.onload = async function(event) {
85
  const text = event.target.result;
@@ -88,6 +92,9 @@
88
  groupName: groupName,
89
  chatIds: chatIds
90
  };
 
 
 
91
  try {
92
  const url = `https://api.green-api.com/waInstance1101952913/createGroup/${apiKey}`;
93
  const response = await fetch(url, {
@@ -97,9 +104,15 @@
97
  },
98
  body: JSON.stringify(payload)
99
  });
 
 
 
100
  if (!response.ok) {
101
- throw new Error(`HTTP error! status: ${response.status}`);
 
 
102
  }
 
103
  const data = await response.json();
104
  document.getElementById('groupIdToCopy').innerText = data.chatId;
105
  alert('Group created successfully!');
@@ -123,4 +136,4 @@
123
  }
124
  </script>
125
  </body>
126
- </html>
 
31
  border: 1px solid #ccc;
32
  border-radius: 5px;
33
  }
34
+ #fileInput {
35
+ margin-top: 20px;
36
+ }
37
+ #createGroupButton {
38
  color: white;
39
  background-color: #4CAF50;
40
  border: none;
 
44
  border-radius: 5px;
45
  margin-top: 20px;
46
  }
47
+ #createGroupButton:hover {
48
  background-color: #388E3C;
49
  }
50
  .group-id-container {
51
  margin-top: 20px;
52
  }
53
  .group-id {
54
+ display: inline-block;
55
+ padding: 10px;
56
+ background-color: #fff;
57
+ border: 1px solid #ccc;
58
+ border-radius: 5px;
59
  cursor: pointer;
60
  }
 
 
 
61
  </style>
62
  </head>
63
  <body>
 
67
  <input type="text" id="groupNameInput" placeholder="Enter group name">
68
  </div>
69
  <input type="file" id="fileInput" accept=".txt">
70
+ <button id="createGroupButton">Create Group</button>
71
  <div class="group-id-container">
72
  <span class="group-id" id="groupIdToCopy" onclick="copyToClipboard(this)">Click here to copy the group ID</span>
73
  </div>
 
78
  const groupName = document.getElementById('groupNameInput').value;
79
  const fileInput = document.getElementById('fileInput');
80
  const file = fileInput.files[0];
81
+
82
  if (!apiKey || !groupName || !file) {
83
  alert('Please enter an API key, group name, and select a file.');
84
  return;
85
  }
86
+
87
  const reader = new FileReader();
88
  reader.onload = async function(event) {
89
  const text = event.target.result;
 
92
  groupName: groupName,
93
  chatIds: chatIds
94
  };
95
+
96
+ console.log('Payload:', payload);
97
+
98
  try {
99
  const url = `https://api.green-api.com/waInstance1101952913/createGroup/${apiKey}`;
100
  const response = await fetch(url, {
 
104
  },
105
  body: JSON.stringify(payload)
106
  });
107
+
108
+ console.log('Response status:', response.status);
109
+
110
  if (!response.ok) {
111
+ const errorText = await response.text();
112
+ console.error('Error response:', errorText);
113
+ throw new Error(`HTTP error! status: ${response.status} - ${errorText}`);
114
  }
115
+
116
  const data = await response.json();
117
  document.getElementById('groupIdToCopy').innerText = data.chatId;
118
  alert('Group created successfully!');
 
136
  }
137
  </script>
138
  </body>
139
+ </html>