Skip to content
This repository was archived by the owner on Apr 16, 2025. It is now read-only.

Commit 062d732

Browse files
committed
init.
修复bug。
1 parent ec73d1c commit 062d732

4 files changed

Lines changed: 43 additions & 0 deletions

File tree

ext/built-in/textweb/src/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,11 @@ export class application extends extType.application.base {
474474
} catch (e) {
475475
console.log('[picProcessServer] picProcessServerError', e);
476476
try {
477+
<<<<<<< HEAD
478+
=======
479+
res.writeHead(200, 'OK', { 'content-type': 'image/png', 'content-length': `${picLoadFailTip.length}` });
480+
res.write(picLoadFailTip);
481+
>>>>>>> 5220509 (init.)
477482
res.end();
478483
} catch (ee) { }
479484
}

ext/built-in/textweb/src/libPic.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ import * as fs from "node:fs";
99
async function ffmpegDecodeToPng(data,extname){
1010
return new Promise((resolve,reject)=>{
1111
var fn = sharedLib.random.randomUUID();
12+
<<<<<<< HEAD
1213
fs.writeFileSync(`/ydpsys/tmp/${fn}.${extname}`,data);
1314
var ffmpeg = childProcess.spawn('chroot',['.','ffmpeg','-i',`/tmp/${fn}.${extname}`,`/tmp/${fn}.png`],{cwd:'/ydpsys'});
15+
=======
16+
fs.writeFileSync(`${process.env['ydpSysRootPath']}/tmp/${fn}.${extname}`,data);
17+
var ffmpeg = childProcess.spawn('chroot',['.','ffmpeg','-i',`/tmp/${fn}.${extname}`,`/tmp/${fn}.png`],{cwd:`${process.env['ydpSysRootPath']}`});
18+
>>>>>>> 5220509 (init.)
1419
var outTxt = '';
1520
ffmpeg.stdout.on('data',(d)=>{
1621
outTxt += String(d);
@@ -24,13 +29,23 @@ async function ffmpegDecodeToPng(data,extname){
2429
}else{
2530
console.log('[libPic] ffmpeg exit with code',code,'. ');
2631
}
32+
<<<<<<< HEAD
2733
if (!fs.existsSync(`/ydpsys/tmp/${fn}.png`)){
2834
reject(outTxt);
2935
return;
3036
}
3137
var res = fs.readFileSync(`/ydpsys/tmp/${fn}.png`);
3238
fs.unlinkSync(`/ydpsys/tmp/${fn}.png`);
3339
fs.unlinkSync(`/ydpsys/tmp/${fn}.${extname}`);
40+
=======
41+
if (!fs.existsSync(`${process.env['ydpSysRootPath']}/tmp/${fn}.png`)){
42+
reject(outTxt);
43+
return;
44+
}
45+
var res = fs.readFileSync(`${process.env['ydpSysRootPath']}/tmp/${fn}.png`);
46+
fs.unlinkSync(`${process.env['ydpSysRootPath']}/tmp/${fn}.png`);
47+
fs.unlinkSync(`${process.env['ydpSysRootPath']}/tmp/${fn}.${extname}`);
48+
>>>>>>> 5220509 (init.)
3449
resolve(res);
3550
});
3651
});
@@ -139,6 +154,10 @@ export async function processPic(path) {
139154
data = await ffmpegDecodeToPng(data,'pic');
140155
img = await imageJs.Image.load(data);
141156
}catch(ee){
157+
<<<<<<< HEAD
158+
=======
159+
console.log('[libPic] try ffmpeg failed. \n',ee);
160+
>>>>>>> 5220509 (init.)
142161
return {
143162
type: 'text/plain',
144163
buff:Buffer.from(`${url}\n${JSON.stringify(opt)}\n${ee}`)
@@ -172,7 +191,11 @@ export async function processPic(path) {
172191
type: 'image/png'
173192
};
174193
}
194+
<<<<<<< HEAD
175195
export async function process(Url, nowUrl, processServerHost, opt,svgOpt) {
196+
=======
197+
export async function processLagacy(Url, nowUrl, processServerHost, opt,svgOpt) {
198+
>>>>>>> 5220509 (init.)
176199
return new Promise((resolve, reject) => {
177200
try {
178201
/*

ext/built-in/textweb/src/sharedLib.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,11 @@ export async function lagacyProcess(input, processServerHost) {
214214
break;
215215
}
216216
case 'pic': {
217+
<<<<<<< HEAD
217218
let o = await pic.process(c.data, input.url, processServerHost, input.opt,input.svgOpt);
219+
=======
220+
let o = await pic.processLagacy(c.data, input.url, processServerHost, input.opt,input.svgOpt);
221+
>>>>>>> 5220509 (init.)
218222
if (!pics.includes(o[0].data)) pics.push(o[0].data);
219223
out = out.concat(o);
220224
break;

ext/example/async/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,22 @@ export async function input(session,msg,update,done,isAlive,hold){
6363
}
6464

6565
export async function switchIn(session,cb){
66+
<<<<<<< HEAD
6667
return new Promise(async (resolve,reject)=>{
6768
await fadeIn(`this input event used \`Promise\`.`,fadeTime,update,0,2048,[]);
6869
setTimeout(async ()=>{
6970
await fadeOut(`this input event used \`Promise\`.`,fadeTime,update,0,2048,[]);
7071
await fadeIn(helpInfo,fadeTime,update,0,2048,recommendRes);
72+
=======
73+
const f = (txt,nowNum,maxNum,suggestedResponse)=>{
74+
cb(txt,suggestedResponse,nowNum,maxNum);
75+
};
76+
return new Promise(async (resolve,reject)=>{
77+
await fadeIn(`this input event used \`Promise\`.`,fadeTime,f,0,2048,[]);
78+
setTimeout(async ()=>{
79+
await fadeOut(`this input event used \`Promise\`.`,fadeTime,f,0,2048,[]);
80+
await fadeIn(helpInfo,fadeTime,f,0,2048,recommendRes);
81+
>>>>>>> 5220509 (init.)
7182
resolve();
7283
},3000);
7384
});

0 commit comments

Comments
 (0)