Giter Club home page Giter Club logo

Comments (28)

lonnywong avatar lonnywong commented on June 24, 2024

Not yet. trzsz.js will support the feature.

It should be an api of TrzszFilter and TrzszAddon. I may name it uploadFiles.

The client of trzsz.js can listen on the drag event, and call trzsz.js api to upload the dragging files.

See also:
https://www.geeksforgeeks.org/drag-and-drop-files-in-electronjs/

https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/File_drag_and_drop

from trzsz.js.

wenbingzhang avatar wenbingzhang commented on June 24, 2024

I'm looking forward to this feature being developed

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

v0.4.0 supports dragging files and directories to upload.

from trzsz.js.

wenbingzhang avatar wenbingzhang commented on June 24, 2024

Drag and drop uploads work fine, the display is just a little unfriendly.

image

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

I've try to hide the trz. Sounds like it's not working.

trzsz.js/src/filter.ts

Lines 130 to 139 in 7f43fe4

if (this.uploadFilesList) {
const out = stripServerOutput(output);
if (out === "trz" || out === "trz -d") {
this.writeToTerminal("\r\n");
return;
}
if (out === "" || out === '"') {
return;
}
}

Could you try to figure out why?

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

What's the type of the server output? Blob, or Uint8Array, or ArrayBuffer?

from trzsz.js.

wenbingzhang avatar wenbingzhang commented on June 24, 2024

this.sendToServer(hasDir ? "trz -d\r" : "trz\r");

Although the complete command is sent here, "processServerOutput" may receive split characters.

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

Maybe. Could you print some log in here?

trzsz.js/src/filter.ts

Lines 130 to 139 in 7f43fe4

if (this.uploadFilesList) {
const out = stripServerOutput(output);
if (out === "trz" || out === "trz -d") {
this.writeToTerminal("\r\n");
return;
}
if (out === "" || out === '"') {
return;
}
}

Figure out the server output, then we can skip it.

from trzsz.js.

wenbingzhang avatar wenbingzhang commented on June 24, 2024

image

from trzsz.js.

wenbingzhang avatar wenbingzhang commented on June 24, 2024

I've tested it many times. Sometimes it's a different result.

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

Is it Uint8Array? It may has some characters unprintable. Could you print the char codes too?

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

I've tested it many times. Sometimes it's a different result.

Collect all the cases, we can do it. We need to print each ascii code.

from trzsz.js.

wenbingzhang avatar wenbingzhang commented on June 24, 2024

image

from trzsz.js.

wenbingzhang avatar wenbingzhang commented on June 24, 2024

trzsz.js/src/filter.ts

Lines 130 to 139 in 7f43fe4

if (this.uploadFilesList) {
const out = stripServerOutput(output);
if (out === "trz" || out === "trz -d") {
this.writeToTerminal("\r\n");
return;
}
if (out === "" || out === '"') {
return;
}
}

If no breakpoint is set, the returned data is the same, but after setting a breakpoint, the automatic upload will be disabled and a file selection dialog will be prompted.

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024
image

Could you print the printable log and char codes together? It would be easy to analyze. Thanks very much.

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

trzsz.js/src/filter.ts

Lines 130 to 139 in 7f43fe4

if (this.uploadFilesList) {
const out = stripServerOutput(output);
if (out === "trz" || out === "trz -d") {
this.writeToTerminal("\r\n");
return;
}
if (out === "" || out === '"') {
return;
}
}

If no breakpoint is set, the returned data is the same, but after setting a breakpoint, the automatic upload will be disabled and a file selection dialog will be prompted.

The reason is:

trzsz.js/src/filter.ts

Lines 235 to 245 in 7f43fe4

// cleanup if it's not uploading
setTimeout(() => {
if (this.uploadFilesList) {
this.uploadFilesList = null;
this.uploadFilesResolve = null;
if (this.uploadFilesReject) {
this.uploadFilesReject("Upload does not start");
this.uploadFilesReject = null;
}
}
}, 1000);

from trzsz.js.

wenbingzhang avatar wenbingzhang commented on June 24, 2024

I think "trz" can be displayed in "xterm", but it needs the correct line break.

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

I think "trz" can be displayed in "xterm", but it needs the correct line break.

But we need to figure out the server output first. Could you print the printable log and ascii codes together?

from trzsz.js.

wenbingzhang avatar wenbingzhang commented on June 24, 2024

image

Is that right?

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

That's it. Thanks.
Looks like I have to learn more about vt100.

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

@wenbingzhang If just remove these code, What will it show?

trzsz.js/src/filter.ts

Lines 130 to 139 in 7f43fe4

if (this.uploadFilesList) {
const out = stripServerOutput(output);
if (out === "trz" || out === "trz -d") {
this.writeToTerminal("\r\n");
return;
}
if (out === "" || out === '"') {
return;
}
}

from trzsz.js.

wenbingzhang avatar wenbingzhang commented on June 24, 2024

image

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

It looks not bad.

Type some garbage into the command line without a carriage return, what will it show after dragging files to upload?

And If move the cursor to the middle of the garbage, what will it show after dragging files to upload?

from trzsz.js.

wenbingzhang avatar wenbingzhang commented on June 24, 2024

image

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

All right. I want to keep the garbage unchanged.

Since it doesn't work in some environments ( e.g., yours ), I'm going to remove it.

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

Should be solved with v0.4.1.

from trzsz.js.

wenbingzhang avatar wenbingzhang commented on June 24, 2024

It has been updated and tested, and it works fine.

from trzsz.js.

lonnywong avatar lonnywong commented on June 24, 2024

@wenbingzhang

Thanks for your feedback.

from trzsz.js.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.