@gogoqiu/tencent-http-server 0.0.3

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 (84) hide show
  1. package/bin/gogoqiu-node-http-service +3 -0
  2. package/dist/build.d.ts +3 -0
  3. package/dist/build.d.ts.map +1 -0
  4. package/dist/build.js +3 -0
  5. package/dist/build.js.map +1 -0
  6. package/dist/routes/index.d.ts +4 -0
  7. package/dist/routes/index.d.ts.map +1 -0
  8. package/dist/routes/index.js +106 -0
  9. package/dist/routes/index.js.map +1 -0
  10. package/dist/server.d.ts +3 -0
  11. package/dist/server.d.ts.map +1 -0
  12. package/dist/server.js +318 -0
  13. package/dist/server.js.map +1 -0
  14. package/dist/serverCmd.d.ts +8 -0
  15. package/dist/serverCmd.d.ts.map +1 -0
  16. package/dist/serverCmd.js +44 -0
  17. package/dist/serverCmd.js.map +1 -0
  18. package/dist/shell/install.d.ts +5 -0
  19. package/dist/shell/install.d.ts.map +1 -0
  20. package/dist/shell/install.js +221 -0
  21. package/dist/shell/install.js.map +1 -0
  22. package/dist/shell/postinst.d.ts +2 -0
  23. package/dist/shell/postinst.d.ts.map +1 -0
  24. package/dist/shell/postinst.js +4 -0
  25. package/dist/shell/postinst.js.map +1 -0
  26. package/dist/shell.d.ts +2 -0
  27. package/dist/shell.d.ts.map +1 -0
  28. package/dist/shell.js +249 -0
  29. package/dist/shell.js.map +1 -0
  30. package/package.json +82 -0
  31. package/public/captures1//346/265/213/350/257/225/347/224/250captures +0 -0
  32. package/public/chat/offer.html +796 -0
  33. package/public/chat/options.html +58 -0
  34. package/public/chat/server-info.html +32 -0
  35. package/public/chat2.html +272 -0
  36. package/public/chat3.html +246 -0
  37. package/public/chat4.html +302 -0
  38. package/public/chat5.html +41 -0
  39. package/public/formdata.html +41 -0
  40. package/public/hls-player.htm +41 -0
  41. package/public/img/back.svg +1 -0
  42. package/public/img/offline.svg +1 -0
  43. package/public/img/online.svg +1 -0
  44. package/public/ip-record.html +28 -0
  45. package/public/js/encrypt.js +36 -0
  46. package/public/js/socket.io.min.js +7 -0
  47. package/public/js/socket.io.min.js.map +1 -0
  48. package/public/myhost/hostReg.html +35 -0
  49. package/public/mylog-chat.htm +260 -0
  50. package/public/mylog3.html +245 -0
  51. package/public/navbar.css +17 -0
  52. package/public/readme.txt +3 -0
  53. package/public/scroll.htm +139 -0
  54. package/public/ssh-client.html +0 -0
  55. package/public/upload-file.html +226 -0
  56. package/public/upload.html +23 -0
  57. package/public/uploads1/files-1757866537383-447469495.jpg +0 -0
  58. package/public/uploads1/files-1757867389485-764531720.jpg +0 -0
  59. package/public/uploads1/files-1757867518311-278635302.jpg +0 -0
  60. package/public/uploads1/files-1757867629687-688924576.jpg +0 -0
  61. package/public/uploads1/files-1757868630683-52261917.jpg +0 -0
  62. package/public/uploads1/files-1757869187061-619427683.jpg +0 -0
  63. package/public/uploads1/small_files-1757869187061-619427683.jpg +0 -0
  64. package/public/uploads1//346/265/213/350/257/225/347/224/250upload +0 -0
  65. package/public/utils.html +57 -0
  66. package/public/utils.js +161 -0
  67. package/public/webrtc/rtc-client.html +238 -0
  68. package/public/webrtc/rtc-file-transfer-client.html +238 -0
  69. package/public/webrtc/rtc-file-transfer-server.html +453 -0
  70. package/public/webrtc/rtc-server.html +453 -0
  71. package/public/webrtc/video-client-input.html +264 -0
  72. package/public/webrtc/video-server-input.html +312 -0
  73. package/public/webrtc/webrtc-chat-with-files.html +581 -0
  74. package/public/webrtc/webrtc-chat.html +367 -0
  75. package/public/webrtc/webrtc-file-offer.html +88 -0
  76. package/public/webrtc/webrtc1.html +186 -0
  77. package/readme.txt +71 -0
  78. package/views/chat.ejs +53 -0
  79. package/views/index.ejs +125 -0
  80. package/views/special-message.ejs +8 -0
  81. package/views/ssh.ejs +142 -0
  82. package/views/utils.ejs +0 -0
  83. package/views/webrtc/client.ejs +203 -0
  84. package/views/webrtc/server.ejs +365 -0
@@ -0,0 +1,58 @@
1
+ <!--
2
+ 用户选择
3
+ 加密密钥编辑
4
+ -->
5
+ <title>配置</title>
6
+ <script src="https://cdn.tailwindcss.com"></script>
7
+ <!--/dist/public-->
8
+ <script src="/js/socket.io.min.js"></script>
9
+ <script src="/js/encrypt.js"></script>
10
+ <script src="/utils.js"></script>
11
+ <!--/dist/web-->
12
+ <style>
13
+ .center{
14
+ display: flex;
15
+ flex-direction: column;
16
+ width: 50%;
17
+ left: 30%;
18
+ position: relative;
19
+ top: 5%;
20
+ }
21
+ .row{
22
+ padding-top: 5px;
23
+
24
+ }
25
+ </style>
26
+ <link rel="stylesheet" href="/navbar.css">
27
+ <body>
28
+ <div class="center">
29
+
30
+ <!--做一个时钟,看载入的倒计时, 刷新数据的倒计时-->
31
+ <div class="row">
32
+ <a href="/"><img id="icon" class="back imgbutton"></img></a>
33
+ <label>from</label>
34
+ <select id="from"></select>
35
+ <label>to</label>
36
+ <label>加密字符</label>
37
+ <input id="encKey" />
38
+ </div>
39
+
40
+ <div class="row">
41
+ <label>轮巡时间</label>
42
+ <input id="interval" />
43
+ </div>
44
+ </div>
45
+ </body>
46
+ <script>
47
+ /*
48
+ const hostname = localStorage.getItem("from")
49
+ */
50
+ fillselects(false).then(() => {
51
+ console.log( "获取信息成功" )
52
+ }).catch((e) => {
53
+ console.log( "获取信息失败", e )
54
+ })
55
+
56
+ // 轮巡时间, 15000
57
+
58
+ </script>
@@ -0,0 +1,32 @@
1
+
2
+ <title>服务器信息</title>
3
+ <script src="https://cdn.tailwindcss.com"></script>
4
+ <!--/dist/public-->
5
+ <script src="/js/socket.io.min.js"></script>
6
+ <script src="/js/encrypt.js"></script>
7
+
8
+ <!--/dist/web-->
9
+ <style>
10
+ </style>
11
+ <script>
12
+ let socket;
13
+ document.addEventListener("DOMContentLoaded", function() {
14
+ socket = io();
15
+ socket.on('chat info', function (resps) {
16
+ //console.log("chat info", resps)
17
+ document.getElementById("chat-info").value = JSON.stringify(resps, null, 2);
18
+ });
19
+ })
20
+
21
+ function getChatInfo() {
22
+ socket.emit('chat info');
23
+ }
24
+ </script>
25
+ <body>
26
+ <button onclick="getChatInfo()"
27
+ class="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 transition-colors"
28
+ >Get Chat Info</button>
29
+ <textarea id="chat-info"
30
+ class="w-full p-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all"
31
+ ></textarea>
32
+ </body>
@@ -0,0 +1,272 @@
1
+ <!--
2
+ 登陆模式,长期设定本定storage,选择一个主机名
3
+ 数据结构:
4
+ 显示在线情况
5
+ -->
6
+ <title>聊天</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="/js/socket.io.min.js"></script>
9
+ <script src="/js/encrypt.js"></script>
10
+ <script src="/utils.js"></script>
11
+ <style>
12
+ body {
13
+ font-family: Arial, sans-serif;
14
+ }
15
+
16
+ #messages {
17
+ list-style-type: none;
18
+ height: 80%;
19
+ overflow-y: auto;
20
+ border: 2px solid #e2e8f0;
21
+ border-radius: 6px;
22
+ transition: border-color 0.3s ease;
23
+ }
24
+
25
+ #messages1 li {
26
+ padding: 8px;
27
+ margin-bottom: 2px;
28
+ background-color: #f3f3f3;
29
+ }
30
+
31
+ #form {
32
+ background: #000;
33
+ padding: 3px;
34
+ position: fixed;
35
+ bottom: 0;
36
+ width: 100%;
37
+ }
38
+
39
+ #input {
40
+ border: none;
41
+ padding: 10px;
42
+ width: 90%;
43
+ margin-right: .5%;
44
+ }
45
+
46
+ #send {
47
+ width: 9%;
48
+ background: rgb(130, 224, 170);
49
+ border: none;
50
+ padding: 10px;
51
+ }
52
+
53
+ .row {
54
+ display: flex;
55
+ flex-direction: row;
56
+ }
57
+
58
+ div .created {
59
+ padding-left: 10px;
60
+ }
61
+
62
+ div .from {
63
+ padding-left: 10px;
64
+ }
65
+ #encKey{
66
+ background-color: gray;
67
+ }
68
+ </style>
69
+ <div>
70
+ <div class="row">
71
+ <a href="/"><img id="icon" src="/img/back.svg"></img></a>
72
+ <img id="status" />
73
+ <label>from</label>
74
+ <select id="from" onchange="setHostname()"></select>
75
+ <label>to</label>
76
+ <select id="to" onchange=""></select>
77
+ <!--可以做成浏览器“密码保存”的?-->
78
+ <label>加密字符</label>
79
+ <input id="encKey" oninput="setEncKey()" />
80
+ </div>
81
+ <ul id="messages" class="scrollable-list p-3 space-y-2"></ul>
82
+ <form id="form" action="">
83
+ <input id="input" autocomplete="off" /><button id="send">Send</button>
84
+ </form>
85
+ </div>
86
+ <script>
87
+ function getEncKey(){
88
+ const v = document.getElementById('encKey').value
89
+ if( v.length<10 ){
90
+ alert('请输入长度大于10的字符')
91
+ }else{
92
+ return v
93
+ }
94
+ }
95
+
96
+ function setEncKey(){
97
+ // console.log(document.querySelector('#encKey').value)
98
+ localStorage.setItem('encKey', document.querySelector('#encKey').value)
99
+ }
100
+
101
+ function loadEncKey(){
102
+ if( localStorage.getItem('encKey') ){
103
+ // console.log( localStorage.getItem('encKey'))
104
+ document.getElementById('encKey').value = localStorage.getItem('encKey')
105
+ }
106
+ }
107
+
108
+ function setHostname() {
109
+ //console.log(document.querySelector('select').value)
110
+ localStorage.setItem('from', document.querySelector('#from').value)
111
+ }
112
+
113
+ function getHostname() {
114
+ return localStorage.getItem('from')
115
+ }
116
+
117
+ function drawMsg(msg){
118
+
119
+ }
120
+
121
+ let firstId = -1
122
+ window.onload = function () {
123
+
124
+ const socket = io();
125
+
126
+ const from = document.getElementById('from');
127
+ const to = document.getElementById('to');
128
+ const input = document.getElementById('input');
129
+ const messages = document.getElementById('messages');
130
+ const status = document.getElementById("status")
131
+ const encKey = document.getElementById('encKey')
132
+
133
+ const form = document.getElementById('form');
134
+ loadEncKey()
135
+ form.addEventListener('submit', function (e) {
136
+ e.preventDefault();
137
+ //const user = document.querySelector('select').value;
138
+ if (input.value && to.value!=="unknown") {
139
+ const value = encryptWithKeyword(input.value, encKey.value)
140
+ socket.emit('chat message', { method: "set", from: from.value, to: to.value, message: value });
141
+ input.value = '';
142
+ }else{
143
+ alert("请输入内容|请选择接收方")
144
+ }
145
+ });
146
+
147
+ /*
148
+ "'l;llljd", 发送异常了
149
+ */
150
+ socket.on('chat message', function (msg) {
151
+ //console.log(msg);
152
+ //return
153
+ if (msg.method == "set") {
154
+ msg.result.forEach((row) => {
155
+ const item = document.createElement('li');
156
+ item.className = ('p-3 bg-blue-50 rounded-md border border-blue-100');
157
+ item.innerHTML = buildItem(row);
158
+ messages.appendChild(item);
159
+ }) //window.scrollTo(0, document.body.scrollHeight);
160
+ messages.scrollTop = messages.scrollHeight;
161
+ } else if (msg.method == "get") {
162
+
163
+ msg.result.forEach((row) => {
164
+ const item = document.createElement('li');
165
+ item.className = ('p-3 bg-blue-50 rounded-md border border-blue-100');
166
+ item.innerHTML = buildItem(row);
167
+ messages.insertBefore(item, document.querySelector("li"));
168
+ })
169
+ if (firstId == -1)
170
+ messages.scrollTop = messages.scrollHeight + 50;
171
+ else
172
+ messages.scrollTop = 150;
173
+ if (msg.result.length) {
174
+ // 有bug, 可能会回转到3,4等,反复获取几条
175
+ firstId = msg.result[msg.result.length - 1].id
176
+ }
177
+ }
178
+ });
179
+
180
+ socket.on('connect', function () {
181
+ //socket.emit('add user', username);
182
+ status.src = "/img/online.svg"
183
+ fillselects(true).then(() => {
184
+ if (localStorage.getItem('hostname')) {
185
+ from.value = localStorage.getItem('hostname')
186
+ }
187
+ loadprev(socket)
188
+ })
189
+ });
190
+
191
+ socket.on('disconnect', function () {
192
+ //log('you have been disconnected');
193
+ status.src = "/img/offline.svg"
194
+ });
195
+
196
+ checkScrollPosition()
197
+
198
+ // 监听滚动事件
199
+ messages.addEventListener('wheel', function (event) {
200
+ // 判断滚动方向
201
+ const isScrollingDown = event.deltaY > 0;
202
+ //scrollDirection.textContent = isScrollingDown ? '向下滚动' : '向上滚动';
203
+ //scrollDirection.className = `font-medium ${isScrollingDown ? 'text-green-600' : 'text-red-600'}`;
204
+
205
+ // 检查是否滚动到顶部或底部(使用setTimeout确保在滚动完成后检测)
206
+ setTimeout(checkScrollPosition, 10);
207
+ });
208
+
209
+ // 也监听scroll事件,确保在所有滚动方式下都能检测(如拖动滚动条)
210
+ messages.addEventListener('scroll', function () {
211
+ checkScrollPosition();
212
+ });
213
+
214
+ function buildItem(row) {
215
+ row.message = decryptWithKeyword(row.message, encKey.value)
216
+ return `<div class="item" id="${row.id}">
217
+ <div class="row">
218
+ <div class="time">${row.created}</div>
219
+ <div class="from">${row.from}</div>
220
+ </div>
221
+ <div class="message">${row.message}</div>
222
+ </div>`
223
+ }
224
+
225
+ function loadprev() {
226
+ if (from.value !== "unknow") {
227
+ socket.emit('chat message', { method: "get", from: from.value, numWant: 10, id: firstId });
228
+ }
229
+ }
230
+
231
+ // 检查滚动位置的函数
232
+ // "messages.scrollTop为什么总是0"
233
+ function checkScrollPosition() {
234
+
235
+ // 清除之前的状态类
236
+ messages.classList.remove('scrolled-top', 'scrolled-bottom');
237
+
238
+ // 滚动元素的属性
239
+ const scrollTop = messages.scrollTop; // 已滚动的顶部距离
240
+ const scrollHeight = messages.scrollHeight; // 内容总高度
241
+ const clientHeight = messages.clientHeight; // 可见区域高度
242
+ const isAtTop = scrollTop <= 1; // 允许1px误差
243
+ const isAtBottom = (scrollTop + clientHeight) >= (scrollHeight - 1); // 允许1px误差
244
+
245
+ // 更新状态显示
246
+
247
+ if (isAtTop && isAtBottom) {
248
+ console.log("内容不足以滚动的情况")
249
+ //scrollStatus.textContent = '内容未超出可视区域';
250
+ //scrollStatus.className = 'font-medium text-purple-600';
251
+ //hideEdgeIndicator();
252
+ } else if (isAtTop) {
253
+ console.log('已滚动到顶部');
254
+ //scrollStatus.className = 'font-medium text-blue-600';
255
+ //messages.classList.add('scrolled-top');
256
+ //showEdgeIndicator('已滚动到顶部', 'blue-100', 'blue-600');
257
+ loadprev();
258
+ } else if (isAtBottom) {
259
+ console.log('已滚动到底部');
260
+ //scrollStatus.className = 'font-medium text-green-600';
261
+ //messages.classList.add('scrolled-bottom');
262
+ //showEdgeIndicator('已滚动到底部', 'green-100', 'green-600');
263
+ } else {
264
+ console.log('正常位置');
265
+ //scrollStatus.className = 'font-medium text-gray-800';
266
+ //hideEdgeIndicator();
267
+ }
268
+ }
269
+ }
270
+
271
+
272
+ </script>
@@ -0,0 +1,246 @@
1
+ <!--
2
+ 登陆模式,长期设定本定storage,选择一个主机名
3
+ 数据结构:
4
+ 显示在线情况
5
+ -->
6
+ <title>聊天</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="/js/socket.io.min.js"></script>
9
+ <script src="/js/encrypt.js"></script>
10
+ <script src="/utils.js"></script>
11
+ <style>
12
+ body {
13
+ font-family: Arial, sans-serif;
14
+ }
15
+
16
+ #messages {
17
+ list-style-type: none;
18
+ height: 80%;
19
+ overflow-y: auto;
20
+ border: 2px solid #e2e8f0;
21
+ border-radius: 6px;
22
+ transition: border-color 0.3s ease;
23
+ }
24
+
25
+ #messages1 li {
26
+ padding: 8px;
27
+ margin-bottom: 2px;
28
+ background-color: #f3f3f3;
29
+ }
30
+
31
+ #form {
32
+ background: #000;
33
+ padding: 3px;
34
+ position: fixed;
35
+ bottom: 0;
36
+ width: 100%;
37
+ }
38
+
39
+ #input {
40
+ border: none;
41
+ padding: 10px;
42
+ width: 90%;
43
+ margin-right: .5%;
44
+ }
45
+
46
+ #send {
47
+ width: 9%;
48
+ background: rgb(130, 224, 170);
49
+ border: none;
50
+ padding: 10px;
51
+ }
52
+
53
+ .row {
54
+ display: flex;
55
+ flex-direction: row;
56
+ }
57
+
58
+ div .created {
59
+ padding-left: 10px;
60
+ }
61
+
62
+ div .from {
63
+ padding-left: 10px;
64
+ }
65
+ #encKey{
66
+ background-color: gray;
67
+ }
68
+
69
+ </style>
70
+ <link rel="stylesheet" href="navbar.css">
71
+ <div>
72
+ <div class="row">
73
+ <a href="/"><img id="icon" class="back imgbutton"></img></a>
74
+ <img id="status" class="imgbutton offline" />
75
+ <label>from</label>
76
+ <select id="from"></select>
77
+ <label>to</label>
78
+ <select id="to"></select>
79
+ <!--可以做成浏览器“密码保存”的?-->
80
+ <label>加密字符</label>
81
+ <input id="encKey" />
82
+ </div>
83
+ <ul id="messages" class="scrollable-list p-3 space-y-2"></ul>
84
+ <form id="form" action="">
85
+ <input id="input" autocomplete="off" /><button id="send">Send</button>
86
+ </form>
87
+ </div>
88
+ <script>
89
+
90
+ let firstId = -1
91
+ window.onload = function () {
92
+
93
+ const socket = io();
94
+
95
+ const from = document.getElementById('from');
96
+ const to = document.getElementById('to');
97
+ const input = document.getElementById('input');
98
+ const messages = document.getElementById('messages');
99
+ const status = document.getElementById("status")
100
+ const encKey = document.getElementById('encKey')
101
+
102
+ const form = document.getElementById('form');
103
+
104
+ form.addEventListener('submit', function (e) {
105
+ e.preventDefault();
106
+ if( prepost_chat() && input.value ){
107
+ const value = encryptWithKeyword(input.value, getEncKey())
108
+ const msg = {
109
+ command: "set",
110
+ from: from.value,
111
+ to: to.value,
112
+ content: value
113
+ }
114
+ socket.emit('chat message', msg );
115
+ input.value = '';
116
+ }else{
117
+ alert("请输入内容|请选择接收方")
118
+ }
119
+ });
120
+
121
+ /*
122
+ "'l;llljd", 发送异常了
123
+ */
124
+ socket.on('chat message', function (resps) {
125
+ if( resps[resps.length-1].retVal ){
126
+ const {command, results} = resps[resps.length-1].data
127
+ results.forEach((row) => {
128
+ const item = document.createElement('li');
129
+ item.className = ('p-3 bg-blue-50 rounded-md border border-blue-100');
130
+ item.innerHTML = buildItem(row);
131
+ //messages.insertBefore(item, document.querySelector("li"));
132
+ messages.appendChild(item);
133
+ })
134
+ }else{
135
+ console.log( resps[resps.length-1].msg )
136
+ }
137
+ //console.log(msg);
138
+ return
139
+ });
140
+
141
+ socket.on('connect', function () {
142
+ //socket.emit('add user', username);
143
+ //status.src = "/img/online.svg"
144
+ status.classList.remove('offline')
145
+ status.classList.add('online');
146
+ // 改写为ws获取信息
147
+ fillselects(true).then(() => {
148
+ loadprev(socket)
149
+ })
150
+ });
151
+
152
+ socket.on('disconnect', function () {
153
+ //log('you have been disconnected');
154
+ //status.src = "/img/offline.svg"
155
+ status.classList.remove('online')
156
+ status.classList.add('offline');
157
+ });
158
+
159
+ checkScrollPosition()
160
+
161
+ // 监听滚动事件
162
+ messages.addEventListener('wheel', function (event) {
163
+ // 判断滚动方向
164
+ const isScrollingDown = event.deltaY > 0;
165
+ //scrollDirection.textContent = isScrollingDown ? '向下滚动' : '向上滚动';
166
+ //scrollDirection.className = `font-medium ${isScrollingDown ? 'text-green-600' : 'text-red-600'}`;
167
+
168
+ // 检查是否滚动到顶部或底部(使用setTimeout确保在滚动完成后检测)
169
+ setTimeout(checkScrollPosition, 10);
170
+ });
171
+
172
+ // 也监听scroll事件,确保在所有滚动方式下都能检测(如拖动滚动条)
173
+ messages.addEventListener('scroll', function () {
174
+ checkScrollPosition();
175
+ });
176
+
177
+ function buildItem(row) {
178
+ row.message = decryptWithKeyword(row.content, encKey.value)
179
+ return `<div class="item" id="${row.id}">
180
+ <div class="row">
181
+ <div class="time">${row.created}</div>
182
+ <div class="from">${row.from}</div>
183
+ </div>
184
+ <div class="message">${row.message}</div>
185
+ </div>`
186
+ }
187
+
188
+ function loadprev() {
189
+ if (from.value !== "unknow") {
190
+ const msg = {
191
+ command: "get",
192
+ queryConstraint:JSON.stringify({
193
+ startIdx: 0,
194
+ count: 10,
195
+ id: {
196
+ lt: firstId
197
+ },
198
+ from: from.value
199
+ })
200
+ }
201
+ socket.emit('chat message', msg );
202
+ }
203
+ }
204
+
205
+ // 检查滚动位置的函数
206
+ // "messages.scrollTop为什么总是0"
207
+ function checkScrollPosition() {
208
+
209
+ // 清除之前的状态类
210
+ messages.classList.remove('scrolled-top', 'scrolled-bottom');
211
+
212
+ // 滚动元素的属性
213
+ const scrollTop = messages.scrollTop; // 已滚动的顶部距离
214
+ const scrollHeight = messages.scrollHeight; // 内容总高度
215
+ const clientHeight = messages.clientHeight; // 可见区域高度
216
+ const isAtTop = scrollTop <= 1; // 允许1px误差
217
+ const isAtBottom = (scrollTop + clientHeight) >= (scrollHeight - 1); // 允许1px误差
218
+
219
+ // 更新状态显示
220
+
221
+ if (isAtTop && isAtBottom) {
222
+ console.log("内容不足以滚动的情况")
223
+ //scrollStatus.textContent = '内容未超出可视区域';
224
+ //scrollStatus.className = 'font-medium text-purple-600';
225
+ //hideEdgeIndicator();
226
+ } else if (isAtTop) {
227
+ console.log('已滚动到顶部');
228
+ //scrollStatus.className = 'font-medium text-blue-600';
229
+ //messages.classList.add('scrolled-top');
230
+ //showEdgeIndicator('已滚动到顶部', 'blue-100', 'blue-600');
231
+ loadprev();
232
+ } else if (isAtBottom) {
233
+ console.log('已滚动到底部');
234
+ //scrollStatus.className = 'font-medium text-green-600';
235
+ //messages.classList.add('scrolled-bottom');
236
+ //showEdgeIndicator('已滚动到底部', 'green-100', 'green-600');
237
+ } else {
238
+ console.log('正常位置');
239
+ //scrollStatus.className = 'font-medium text-gray-800';
240
+ //hideEdgeIndicator();
241
+ }
242
+ }
243
+ }
244
+
245
+
246
+ </script>