Homebrew Homebrew app [Release] ftpsrv - A small ftp server

impeeza

¡Kabito!
Member
Joined
Apr 5, 2011
Messages
8,435
Trophies
4
Age
46
Location
At my chair.
XP
29,967
Country
Colombia
i am a little worried someone may accidentially destroy their save data. tools like jksv have a good ui and make it clear to the user that they're deleting their save, also they keep backups of save data. i cannot really do that with ftp. maybe i should have save be read only, but enable write mode in the config.ini?
Yes the end user must explicitly enabled after agreeing is responsible for the damages.
 

JK_

Well-Known Member
Member
Joined
Sep 4, 2015
Messages
763
Trophies
1
XP
2,703
Country
United States
btw, do you think its a good idea to allow the save data to be writable? i am a little worried someone may accidentially destroy their save data. tools like jksv have a good ui and make it clear to the user that they're deleting their save, also they keep backups of save data. i cannot really do that with ftp. maybe i should have save be read only, but enable write mode in the config.ini?
That's what I do with system saves and other stuff. It's turned off by default, but if you change one setting to on, JKSV will let you do whatever you want with system saves and NAND files.
 

TotalJustice

Well-Known Member
OP
Member
Joined
Jan 28, 2017
Messages
551
Trophies
2
Age
27
XP
3,326
Country
United Kingdom
That's what I do with system saves and other stuff. It's turned off by default, but if you change one setting to on, JKSV will let you do whatever you want with system saves and NAND files.
https://github.com/J-D-K/JKSV/blob/291d2fd82f52b329f9bd18079346f3f2686cc07a/src/data.cpp#L276
btw whilst you're here, i think this causes a leak of the fs reader as it isn't closed until the end of the loop, but using continue makes it jump back to the top of the loop. shouldn't this be a break?
 

JK_

Well-Known Member
Member
Joined
Sep 4, 2015
Messages
763
Trophies
1
XP
2,703
Country
United States
https://github.com/J-D-K/JKSV/blob/291d2fd82f52b329f9bd18079346f3f2686cc07a/src/data.cpp#L276
btw whilst you're here, i think this causes a leak of the fs reader as it isn't closed until the end of the loop, but using continue makes it jump back to the top of the loop. shouldn't this be a break?
I'm rewriting the thing for a reason dude. I go through that now and go, "what was I thinking?" constantly. It works for the most part, but it could be and will be better.
 

HoRy205

Active Member
Newcomer
Joined
Jan 9, 2024
Messages
39
Trophies
0
Age
21
XP
336
Country
Japan
Sorry, I'm translating and I don't understand much. Does this mean that you can directly get or overwrite the save data files of games on the Switch without having to extract the save data (like jksv) through ftpsrv? If so, that's great. However, there's a chance that the save data could be destroyed by mistake, so I think it would be better to be able to set the write mode on and off from config.ini.
 

TotalJustice

Well-Known Member
OP
Member
Joined
Jan 28, 2017
Messages
551
Trophies
2
Age
27
XP
3,326
Country
United Kingdom
Sorry, I'm translating and I don't understand much. Does this mean that you can directly get or overwrite the save data files of games on the Switch without having to extract the save data (like jksv) through ftpsrv? If so, that's great. However, there's a chance that the save data could be destroyed by mistake, so I think it would be better to be able to set the write mode on and off from config.ini.
yes that's correct. and i agree, write mode would be enabled in the config.ini
 

TomSwitch

Well-Known Member
Member
Joined
Jan 10, 2019
Messages
5,476
Trophies
4
Age
45
XP
17,965
Country
United States
thanks! i have save listing working now, the games will be listed like `Another Code: Recollection [0100CB9018F5A000]` and if the game is no longer installed (so i cant fetch the name), i will just show the id [01009B90006DC000]

btw i worked around that issue i mentioned before about not being able to get the game name. instead of using ns, i found the control nca using ncm, then get that nca path and then open it as a filesystem. when a nca is mounted, it is automatically decrypted by hos, so i can simply open it as a file and read the name :)

btw, do you think its a good idea to allow the save data to be writable? i am a little worried someone may accidentially destroy their save data. tools like jksv have a good ui and make it clear to the user that they're deleting their save, also they keep backups of save data. i cannot really do that with ftp. maybe i should have save be read only, but enable write mode in the config.ini?
People can wipe their sd accidentally and surely some will. Having it as a option in config like anon and if they want it they can set it the same time they did anon is not much of an inconvenience. Maybe a warning like you did the applet mode warning so people are reminded about this?

Would it be better to have a separate port setting for sysmodule like say "sys-port = " so user can choose to use the applet version when more performance is needed and don't have to turn off the sysmodule version in order to do it? ( ftpd would take over for some reason ftpsrv don't, and the sysmodule would continue to be the one if the port is the same )

cmake --build --preset switch can only be done once

second time this will happen
_deps/minini-build/CMakeFiles/minIni.dir/compiler_depend.make:4: *** multiple target patterns. Stop.
I just blank out the whole file after just doing line 4 didn't solve the problem

Is there any breaking bug in 0.2? I see there are four commits since I did the fork and the current master can only support passive mode with my ftp client, I notice HELP returns error, 0.2 works fine without setting to passive mode which is slower and it has two errors instead of three
1733444829092.png


Is it possible to have ftpsrv to serve up directory with time stamp?
 
Last edited by TomSwitch,
  • Wow
Reactions: impeeza

TotalJustice

Well-Known Member
OP
Member
Joined
Jan 28, 2017
Messages
551
Trophies
2
Age
27
XP
3,326
Country
United Kingdom
People can wipe their sd accidentally and surely some will. Having it as a option in config like anon and if they want it they can set it the same time they did anon is not much of an inconvenience. Maybe a warning like you did the applet mode warning so people are reminded about this?

Would it be better to have a separate port setting for sysmodule like say "sys-port = " so user can choose to use the applet version when more performance is needed and don't have to turn off the sysmodule version in order to do it? ( ftpd would take over for some reason ftpsrv don't, and the sysmodule would continue to be the one if the port is the same )

cmake --build --preset switch can only be done once

second time this will happen
_deps/minini-build/CMakeFiles/minIni.dir/compiler_depend.make:4: *** multiple target patterns. Stop.
I just blank out the whole file after just doing line 4 didn't solve the problem

Is there any breaking bug in 0.2? I see there is four commits since I did the fork and the current master can only support passive mode with my ftp client, I notice HELP returns error
what client are you using?
Also, good idea about the port, ive just pushed a commit for it.

EDIT: can you try this build with your client?
 

Attachments

  • switch_application.zip
    150 KB · Views: 7
Last edited by TotalJustice,

TomSwitch

Well-Known Member
Member
Joined
Jan 10, 2019
Messages
5,476
Trophies
4
Age
45
XP
17,965
Country
United States
what client are you using?
Also, good idea about the port, ive just pushed a commit for it.

EDIT: can you try this build with your client?
I am using the one that is build in in total commander.
Post automatically merged:

what client are you using?
Also, good idea about the port, ive just pushed a commit for it.

EDIT: can you try this build with your client?
1733445797472.png

Still need passive mode
Post automatically merged:

After I disconnect to old version, I reconnect with new version and it seems ok but it is actually not
Post automatically merged:

This needing passive mode thing has some network dependency. I remember needing it with some network for sys-ftpd-lite too
 

Attachments

  • 1733445477130.png
    1733445477130.png
    713.8 KB · Views: 9
Last edited by TomSwitch,
  • Like
Reactions: TotalJustice

TotalJustice

Well-Known Member
OP
Member
Joined
Jan 28, 2017
Messages
551
Trophies
2
Age
27
XP
3,326
Country
United Kingdom
I am using the one that is build in in total commander.
Post automatically merged:


View attachment 474460
Still need passive mode
Post automatically merged:

After I disconnect to old version, I reconnect with new version and it seems ok but it is actually not
Post automatically merged:

This needing passive mode thing has some network dependency. I remember needing it with some network for sys-ftpd-lite too
thanks, i have fixed the bug in the latest command. it was due to me not starting a connect on the data socket. can you try this build to ensure it works for you too? i have tested with total commander and filezilla.
 

Attachments

  • switch_application.zip
    150.1 KB · Views: 9
  • Love
Reactions: impeeza

TomSwitch

Well-Known Member
Member
Joined
Jan 10, 2019
Messages
5,476
Trophies
4
Age
45
XP
17,965
Country
United States
thanks, i have fixed the bug in the latest command. it was due to me not starting a connect on the data socket. can you try this build to ensure it works for you too? i have tested with total commander and filezilla.
Yes, it works without needing passive mode now.
Post automatically merged:

On the save side it is missing saves. A lot of saves not showing up.
 
  • Love
Reactions: impeeza

TotalJustice

Well-Known Member
OP
Member
Joined
Jan 28, 2017
Messages
551
Trophies
2
Age
27
XP
3,326
Country
United Kingdom
Yes, it works without needing passive mode now.
Post automatically merged:

On the save side it is missing saves. A lot of saves not showing up.
A lot of them? That's strange. I search the saves with FsSaveDataSpaceId_User, maybe that's the issue? I do apply a filter so only games that have saves for that user are shown. For me, every game is listed.

What are some of them games that aren't show? Is it bcat or account?
 
  • Like
Reactions: impeeza

TomSwitch

Well-Known Member
Member
Joined
Jan 10, 2019
Messages
5,476
Trophies
4
Age
45
XP
17,965
Country
United States
The title names may have characters not supported by our file systems
1733457178258.png

For example ':', there are plenty more and I do have game save with those title names but right now it is not showing up with ftpsrv.
2. Some game, perhaps due to developer mistake has this:
1733457476226.png

One solution to this problem is to put the save in zip as JK pointed out earlier when we first encountered this
Post automatically merged:

A lot of them? That's strange. I search the saves with FsSaveDataSpaceId_User, maybe that's the issue? I do apply a filter so only games that have saves for that user are shown. For me, every game is listed.

What are some of them games that aren't show? Is it bcat or account?
I have two user profiles on my switch, both shows up as directory
1733458297359.png

thomas directory has nothing inside

1733458630953.png

1733458659551.png

The Japanese characters make the title name disappear?

I suppose title names will be a problem with batch restore. Maybe have option to turn it off in config.ini?
Will not existing save be created if a write is made to "save:"?
 
Last edited by TomSwitch,
  • Love
Reactions: impeeza

impeeza

¡Kabito!
Member
Joined
Apr 5, 2011
Messages
8,435
Trophies
4
Age
46
Location
At my chair.
XP
29,967
Country
Colombia
The title names may have characters not supported by our file systems
View attachment 474493
For example ':', there are plenty more and I do have game save with those title names but right now it is not showing up with ftpsrv.
2. Some game, perhaps due to developer mistake has this:
View attachment 474494
One solution to this problem is to put the save in zip as JK pointed out earlier when we first encountered this
Post automatically merged:


I have two user profiles on my switch, both shows up as directory
View attachment 474500
thomas directory has nothing inside

View attachment 474501
View attachment 474503
The Japanese characters make the title name disappear?

I suppose title names will be a problem with batch restore. Maybe have option to turn it off in config.ini?
Will not existing save be created if a write is made to "save:"?
Also there is a «edge» scenary where a game have the savegame files inside a folder without name! the game is «Nuclear Blaze» and the problem was addressed on the issue https://github.com/J-D-K/JKSV/issues/217 also on JKSV WebDav implementation was a lot of trouble with invalid characters on the game titles.
 

TotalJustice

Well-Known Member
OP
Member
Joined
Jan 28, 2017
Messages
551
Trophies
2
Age
27
XP
3,326
Country
United Kingdom
The title names may have characters not supported by our file systems
View attachment 474493
For example ':', there are plenty more and I do have game save with those title names but right now it is not showing up with ftpsrv.
2. Some game, perhaps due to developer mistake has this:
View attachment 474494
One solution to this problem is to put the save in zip as JK pointed out earlier when we first encountered this
Post automatically merged:


I have two user profiles on my switch, both shows up as directory
View attachment 474500
thomas directory has nothing inside

View attachment 474501
View attachment 474503
The Japanese characters make the title name disappear?

I suppose title names will be a problem with batch restore. Maybe have option to turn it off in config.ini?
Will not existing save be created if a write is made to "save:"?
the title name not showing is due to my name parsing code assuming that the game is english, so it reads the first entry of the nacp lang struct, ill fix this tomorrow.

i am not sure what the bug is with "2.", i don't understand the zip part either. is this due to the file name being the same? are you able to download those files or does ftpsrv throw an error? i'd image it works, you just wouldnt be able to copy them to the sd card as its case insensitive, savefiles are not.

so the thomas user has saves, and theyre listed with dbi but not ftpsrv? i really can't reproduce this, i have tried the past hour creating users, loading them with saves and ftpsrv lists them just fine :/
Post automatically merged:

Also there is a «edge» scenary where a game have the savegame files inside a folder without name! the game is «Nuclear Blaze» and the problem was addressed on the issue https://github.com/J-D-K/JKSV/issues/217 also on JKSV WebDav implementation was a lot of trouble with invalid characters on the game titles.
i just read the issue, thanks for linking it. i dont own that game, would you mind testing the build i linked above and see if it works?
 

AlM2023

Well-Known Member
Newcomer
Joined
Dec 17, 2023
Messages
54
Trophies
1
Age
37
XP
363
Country
Oman
the title name not showing is due to my name parsing code assuming that the game is english, so it reads the first entry of the nacp lang struct, ill fix this tomorrow.

i am not sure what the bug is with "2.", i don't understand the zip part either. is this due to the file name being the same? are you able to download those files or does ftpsrv throw an error? i'd image it works, you just wouldnt be able to copy them to the sd card as its case insensitive, savefiles are not.

so the thomas user has saves, and theyre listed with dbi but not ftpsrv? i really can't reproduce this, i have tried the past hour creating users, loading them with saves and ftpsrv lists them just fine :/
Post automatically merged:


i just read the issue, thanks for linking it. i dont own that game, would you mind testing the build i linked above and see if it works?
Thank you for your efforts! When can we expect the new version to be released with all your fixes?
 

TomSwitch

Well-Known Member
Member
Joined
Jan 10, 2019
Messages
5,476
Trophies
4
Age
45
XP
17,965
Country
United States
the title name not showing is due to my name parsing code assuming that the game is english, so it reads the first entry of the nacp lang struct, ill fix this tomorrow.

i am not sure what the bug is with "2.", i don't understand the zip part either. is this due to the file name being the same? are you able to download those files or does ftpsrv throw an error? i'd image it works, you just wouldnt be able to copy them to the sd card as its case insensitive, savefiles are not.

so the thomas user has saves, and theyre listed with dbi but not ftpsrv? i really can't reproduce this, i have tried the past hour creating users, loading them with saves and ftpsrv lists them just fine :/
Post automatically merged:


i just read the issue, thanks for linking it. i dont own that game, would you mind testing the build i linked above and see if it works?
The problem with case sensitivity is windows files system is case insensitive. So these four files will ended up with only two as the other two will be overwritten if the directory is copied.

1733464218497.png

The ':' character is replace by '_' perhaps by total commander but on the way back it will be a problem.

Maybe the reason why this line gives uid of 0,0 on my system maybe the reason why thomas save directory is empty
if (R_SUCCEEDED(accountTrySelectUserWithoutInteraction(&uid, false))) {
 
Last edited by TomSwitch,

impeeza

¡Kabito!
Member
Joined
Apr 5, 2011
Messages
8,435
Trophies
4
Age
46
Location
At my chair.
XP
29,967
Country
Colombia
The problem with case sensitivity is windows files system is case insensitive. So these four files will ended up with only two as the other two will be overwritten if the directory is copied.

View attachment 474514
The ':' character is replace by '_' perhaps by total commander but on the way back it will be a problem.
Remember what that mashup of case names was generated by a combination of bad coded software (no JKSV that is the one so we'll coded which allowed us to detect the problem) and the FAT(32) FS case insensitiveness.

The best solution is to handle the files on a "virtual" fs, by example, a zip file which indeed can handle correctly the case sensitive filenames and no name folders.
 

TomSwitch

Well-Known Member
Member
Joined
Jan 10, 2019
Messages
5,476
Trophies
4
Age
45
XP
17,965
Country
United States
Remember what that mashup of case names was generated by a combination of bad coded software (no JKSV that is the one so we'll coded which allowed us to detect the problem) and the FAT(32) FS case insensitiveness.

The best solution is to handle the files on a "virtual" fs, by example, a zip file which indeed can handle correctly the case sensitive filenames and no name folders.
I believe Mac is also case insensitive.
Everything on windows is.

I suppose by and large all users will have this problem
Post automatically merged:

@TotalJustice is it possible to support directory time stamp?
Post automatically merged:

One other thing, in my case all of link's save has directory listing but some of them are empty with ftpsrv but they are not empty
 
Last edited by TomSwitch,
  • Love
Reactions: impeeza

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Kirbydogs
    Yesterday was history, tomorrow is a mystery, and I love me a good pancake
  • Xdqwerty
    what are you looking at?
    Kirbydogs @ Kirbydogs: @Xdqwerty sleep well +1