-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows support #22
Comments
Hi! Since I personally don't use or have much experience with Windows I am not planning to do this myself, but I will happily accept a PR that adds Windows support! That being said, I suspect it should be relatively straight forward to make the necessary adjustments and they shouldn't be too many. My guess is that what doesn't work with Windows right now is
everything else should already be pretty platform-independent, but like I said, I unfortunately can't test it myself. So if you're interested, go for implementing it! I'll help as much as I can if you have any questions :) |
I'm also interested... |
Hello! Happy to hear that you are interested in Vivify! :) Like I said, I won't add windows support myself since I don't have any windows machine and it would be impossible for me to maintain it. However, if someone wants to implement it and is ready to maintain it as well, I would happily accept a PR and also provide as much help and support as I can :) So if this sounds like something for you, let me know! |
@jannis-baum So I'm having an initial look into the Windows thing (good reason to look a little more deeply into the code base while working on that architecture.md job for you). Seems possible, there is a bit of work invovled. First hurdle is the way we set the environment variables for dev mode. For now I've just stripped them out under a new script called win-dev, but we'll need Windows native equivalents. The mime-type issue you mention above has moved but still exists. There are node packages that will detect mime types, I assume they are cross platform compatible? Will need to look into that. And there is a whole bunch of weirdness going on with paths, eg: Here is your mime-type error, as expected, for completeness... But you can navigate around, look Windowsy stuff! Then perhaps the biggest issue is as you say the viv app. As a bash script, that would probably just be a rewrite of a separate Windows version would you say? Good news is there is not much going on there, so should be fairly easy? |
Hey @Tweekism awesome, thanks a lot! That's great, would you be up for being in charge of Windows development & maintenance?
Interesting! Are you running this on "Windows Windows" or on WSL? I have very little idea what I'm talking about here but I have heard of WSL, maybe that's an option to just develop from there? Or do Windows users usually work directly from PowerShell or something Windows-y?
This definitely sounds good. If there is a good Node package it's probably better than running a subprocess from Node for that anyways, even on POSIX.
Yes, this was expected ^^ What did you do to make that first screenshot work though? It seems like you have a POSIX path there? And also the last screenshots where you navigate around, why does that work and what does the URL say?
Yes, full |
Potentially, but I promise nothing yet! Until I can fully scope out how much there is to do 😅
This is on Windows native, I had no idea people are using NeoVim on Windows, so I couldn't tell you what the "average Windows vim" user is doing. I'll @ the users in this post separately and ask them.
If you type in manually a POSIX path it works, but all the links generated by the directory renderer are messed up.
I've have a cursory glance. I'll definitely take up your offer to explain it a bit when I get to that part. |
@malarahfelipe @pidgeon777 Hey guys, are you guys able to describe your setup a little bit? Using Vim/NeoVim I assume? on Windows natively? Or WSL2? or something else? |
@jannis-baum Ok i quickly hit the limit of my typescripting ability lol. This works in my simple test project (just normal node.js using yarn init, yarn add mime-types etc. But when i go to add that in Vivify | ../path.ts I get this I guess I'm missing some typescript magic? Is it simple or do I need to go do a bunch of reading 😅 |
Ah, yes, quick TypeScript lesson I guess haha: On npmjs.com we get information about the typing of the package next to the title. There are three scenarios
In this case we are in scenario 2: So you can run |
Oh ok, well in that case there might be better packages out there for typescript, of the three I tried this one worked the easiest for me, ok let me go try some stuff and I'll be back :) |
Having types in a separate package is totally fine, that happens a lot. Nothing to worry about. I would put your subjective assessment of the interface and overall popularity above the criteria of not having native types. If it wasn't typed at all it would be a different story but this one is fine if you like it! Also seems very popular. |
it is one of the popular ones. |
No worries, I'm happy to help :) Let me know what it is in case you can't figure out that new error |
Ok so here is the list of minimum changes to get server working:-
So far everything I've done are just hacks for exploratory purposes and so comes with the following limitations:-
There is a package called Most the work here will be around wrangling paths. Like how do we want to implement drive letters on Windows? It would be fairly likely that someone has files on an external Go here to see the changes on my branch: Tweekism/vivify@main...windows-support |
Nice this looks good!
I can take over for this part and do it as a separate issue/PR :) I guess the package you are referring to is this one? https://www.npmjs.com/package/file-type
Hm, there are multiple options here that come to mind. But before I have a couple of questions from looking at the code and your screencast:
The best option I can come up with right now would probably be to "virtualize" the drives as a root directory so that we can browse through them with Vivify (i.e. when you get down to |
Hold on that, I tested it and it doesn't work. I tried a WHOLE bunch of different npm packages and they essentially fall into 2 categories:
Option 1 is a noticable downgrade from what we currently have and option 2 won't work on Windows which obviously is the whole point. I have some thoughts on this I'll go into details later, this is just a quick reply for the moment.
This is Firefox converting them back, on Edge (chormium) I get %5C
I can't test at the moment but essentially you get something like 'File not found: C:\C:\path\to\some\file'
That Is the usual case I see on windows. something like .../c/Users/jason/blah... Like I say, I'll come back to this a bit later when I have some time, but I just didn't want to leave you thinking that file-type package was the way forward, because I don't think it is, at least not on its own and even then, it's no better than any of the other packages out there. It seems to me that we might end up with a hybrid solution, something like use |
Hm, but shouldn't looking at the file header be all we need? If you look at the following https://github.com/jannis-baum/Vivify/blob/main/src/routes/viewer.ts#L48-L51 we switch between plain text vs. binary and only really need the mime type for binary files, which the packages that look at the file header should be able to figure out. If it's plain text we handle it later in the parser anyways. So I think this package we were talking about should do it, shouldn't it? I'm pretty sure
Ah, interesting!
That's weird, what's the |
In practice it turns out no. Some files like png, jpeg, pdf etc. will explicitly say what they are in the first few bytes of the file. For example, take this beautiful .png my friend made me for my steam avitar: When you open it in a text editor you'll notice its very up front about being a .png like it's proud of it or something... However this isn't always the the case for plain text, often its just a stream of ASCII (or utf-8) bytes. Ditto with binary files, they can just be what ever. Which is why the The practical implication is that every one of the "category 1" npm libraries I tryed failed to return any mime type at all on our LICENSE file or the viv and vivify-server executables, as they all have no file extenstions. And some would also fail on my test png if i removed the extension, while others would recognise it by the header Note that some plain text files do Identify themselves, like this one: That is some kind of unicode specifier, I don't remember the exact details, I'd have to look it up (this one is UTF-8 obviously, you'll see UTF-16 a bit in MS land or I suppose UCS2 kinda sorter 'cus history etc. but its obvious to spot with all the zeros '00')
They should, but they don't. And to be fair they'd have to be slightly more sophisticated and do some heuristic analysis on the file as a whole and not just look at the header to be able to tell plain text from binary.
Turns out it is a little dark magic (who knew right?) and it is not always correct, in fact on Linux it identifies our .md files an text/plain instead of text/markdown, but that could just be because it's old. Actually I noticed that
Indeed, the sly fox...
Ummmm.... I'll test soon and let you know. |
And having said all that there are some pretty easy work arounds, so I'm not all that worried about this bit anymore, but I'm expecting visitors and fam is starting dinner without me so I'll be back :) |
But, in practice, aren't these binary files that announce their file type in the header exactly the only ones that we need to know the mime type of? The main reason we need to know mime types at all is so that we can send them as files on the
The part that does seem significant is being able to recognize that a file is not binary, this is something we definitely have to be able to do so that we can run our rendering endpoint on it. And, another topic in case you haven't considered that: There are some plain-text files that have to be sent as files, e.g. SVG images. So this is also something that needs to have its mime type recognized.
I'm curious! By the way I just saw there is also |
Ok, lets do this! I tested it, it works and then the implementation is identical everywhere. PS, I have rewritten this post about 6 times. Thousands of words, none of it very useful. Maybe I should start keeping a diary instead... |
Great! So then even the child process call it the exact same? That's very cool.
Haha no worries, I do this as well and I also like reading along and seeing how it's going for others ^^ Just not sure about the people who have requested this, if they're still subscribed they always get emails from our conversation. If you want you could already open a draft PR and we keep talking there |
I would like to extend my gratitude to everyone involved in the efforts to make Vivify compatible with Windows. If needed, I am available to offer my assistance as a tester. |
Hey @pidgeon777 I'll take you up on that offer once the time comes :) I've not worked on this in the last couple days but will be back on to it starting tomorrow. |
@jannis-baum Since this could be a fairly long running draft PR and with external testers (@pidgeon777 and hopefully others), do you want me to push the development branch here, or to my fork? |
Here is good! :) |
Hello, there's any plan for windows support on this?
Thanks
The text was updated successfully, but these errors were encountered: