efront 3.35.10 → 3.35.11
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.
- package/coms/frame/chat.js +20 -5
- package/coms/frame/chat.less +19 -2
- package/coms/frame/edit.less +1 -0
- package/coms/kugou/krc.js +1 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/frame/chat.js
CHANGED
|
@@ -16,12 +16,12 @@ function msg(elem, { m }, parentScopes) {
|
|
|
16
16
|
}
|
|
17
17
|
if (m) switch (m.type) {
|
|
18
18
|
case "html":
|
|
19
|
-
elem.innerHTML = m.content;
|
|
19
|
+
elem.innerHTML = /<(script|iframe)(\s|>)|(src|href)=(['"`]|)javascript\:/i.test(m.content) ? `<span color="#c24">对方正试图窃取您的信息</span>` : m.content;
|
|
20
20
|
break;
|
|
21
21
|
case "file":
|
|
22
22
|
var files = m.content;
|
|
23
23
|
elem.setAttribute("files", '');
|
|
24
|
-
elem.innerHTML = files.map(f => `<a class=file>${shapes$file}
|
|
24
|
+
elem.innerHTML = files.map(f => `<a class=file>${f.icon ? `<img src="${f.icon.replace(/\"/g, '')}"/>` : shapes$file}<span>${f.name.replace(/[><]/g, a => `&#${a.codePointAt(0)};`)}</span></a>`).join("");
|
|
25
25
|
elem.files = files;
|
|
26
26
|
onclick(elem, clickfile);
|
|
27
27
|
break;
|
|
@@ -221,10 +221,25 @@ function chat(title = '会话窗口') {
|
|
|
221
221
|
var files = await chooseFile('*.*', true);
|
|
222
222
|
this.sendFiles(files);
|
|
223
223
|
},
|
|
224
|
-
sendFiles(files) {
|
|
224
|
+
async sendFiles(files) {
|
|
225
225
|
var flist = [];
|
|
226
|
+
var URL = window.URL;
|
|
226
227
|
for (var f of files) {
|
|
227
|
-
|
|
228
|
+
if (URL && f.size < 100 * 1000 * 1000 && /\.(png|jpeg|jpg|jpe|gif|bmp)$/.test(f.name)) {
|
|
229
|
+
var canvas = document.createElement('canvas');
|
|
230
|
+
var size = 32;
|
|
231
|
+
canvas.width = size;
|
|
232
|
+
canvas.height = size;
|
|
233
|
+
var context = canvas.getContext("2d");
|
|
234
|
+
var img = new Image;
|
|
235
|
+
var u = URL.createObjectURL(f);
|
|
236
|
+
img.src = u;
|
|
237
|
+
await awaitable(img);
|
|
238
|
+
context.drawImage(img, 0, 0, size, size);
|
|
239
|
+
f.icon = canvas.toDataURL();
|
|
240
|
+
URL.revokeObjectURL(u);
|
|
241
|
+
}
|
|
242
|
+
flist.push({ name: f.name, icon: f.icon, size: f.size, id: ++fid, mtime: +f.lastModified });
|
|
228
243
|
filesMap[fid] = f;
|
|
229
244
|
}
|
|
230
245
|
return this.send('file', flist);
|
|
@@ -248,7 +263,7 @@ function chat(title = '会话窗口') {
|
|
|
248
263
|
if (data.length > 2000) {
|
|
249
264
|
return alert("信息太长,无法发送!");
|
|
250
265
|
}
|
|
251
|
-
if (this.user && this.user.id !== this.localid) {
|
|
266
|
+
if (this.user && this.user.id !== this.localid && type !== "accept") {
|
|
252
267
|
addToMsgList(this.msglist, [msg]);
|
|
253
268
|
}
|
|
254
269
|
data = encode62.timeencode(data);
|
package/coms/frame/chat.less
CHANGED
|
@@ -181,6 +181,21 @@ msg[files] {
|
|
|
181
181
|
text-align: left;
|
|
182
182
|
border-radius: 0;
|
|
183
183
|
|
|
184
|
+
>img {
|
|
185
|
+
width: 32px;
|
|
186
|
+
height: 32px;
|
|
187
|
+
margin-left: -10px;
|
|
188
|
+
vertical-align: top;
|
|
189
|
+
line-height: 32px;
|
|
190
|
+
|
|
191
|
+
&+* {
|
|
192
|
+
display: inline-block;
|
|
193
|
+
margin-left: 6px;
|
|
194
|
+
line-height: 32px;
|
|
195
|
+
vertical-align: top;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
184
199
|
&:hover {
|
|
185
200
|
border-color: #c80;
|
|
186
201
|
background-color: #ffe;
|
|
@@ -192,12 +207,14 @@ msg[files] {
|
|
|
192
207
|
|
|
193
208
|
&:first-child {
|
|
194
209
|
border-top-color: transparent;
|
|
195
|
-
border-radius: 3px
|
|
210
|
+
border-top-right-radius: 3px;
|
|
211
|
+
border-top-left-radius: 3px;
|
|
196
212
|
}
|
|
197
213
|
|
|
198
214
|
&:last-child {
|
|
199
215
|
border-bottom-color: transparent;
|
|
200
|
-
border-radius:
|
|
216
|
+
border-bottom-left-radius: 3px;
|
|
217
|
+
border-bottom-right-radius: 3px;
|
|
201
218
|
}
|
|
202
219
|
}
|
|
203
220
|
}
|
package/coms/frame/edit.less
CHANGED
package/coms/kugou/krc.js
CHANGED
|
@@ -2,7 +2,7 @@ var secret = [64, 71, 97, 119, 94, 50, 116, 71, 81, 54, 49, 45, 206, 210, 110, 1
|
|
|
2
2
|
var isTrident = /Trident/i.test(navigator.userAgent);
|
|
3
3
|
function krc(list = div()) {
|
|
4
4
|
care(list, function (info) {
|
|
5
|
-
if (info.
|
|
5
|
+
if (!info.krc) {
|
|
6
6
|
remove(list.children);
|
|
7
7
|
if (info.lrc) {
|
|
8
8
|
var children = createLRC(info.lrc);
|