Homebrew RELEASE NSP Indexer

proconsule54

Well-Known Member
OP
Member
Joined
Nov 5, 2019
Messages
753
Trophies
1
Age
43
XP
2,661
Country
Italy
Hi all, i wrote a simple indexer for nsp (xci nsz xcz also)
It is a simple PHP that parse directory with nsp files and show it as a list retriving img from N cdn and info from tinfoil json

preview.jpg


hope you like it, post suggestion and bugs here or on github

here is the link

https://github.com/proconsule/nspindexer
 

blawar

Developer
Developer
Joined
Nov 21, 2016
Messages
1,708
Trophies
1
Age
40
XP
4,311
Country
United States
It's a personal preference, but you could display a more human readable form of the version string. In your example, monster hunter is 393216 which is 0x60000. bit shift it right 16 bits ( >> 16) or divide it by 65536 to get the patch number, which in this case is 6.
 

proconsule54

Well-Known Member
OP
Member
Joined
Nov 5, 2019
Messages
753
Trophies
1
Age
43
XP
2,661
Country
Italy
Sure nice suggestion, the update is currently only a regex of the filename. I'll do it in the next commit.
Tanks for the code hint :)
 

proconsule54

Well-Known Member
OP
Member
Joined
Nov 5, 2019
Messages
753
Trophies
1
Age
43
XP
2,661
Country
Italy
I am adding support for tinfoil and DBI remote install with $_GET parameters
if you add ?tinfoil=true or ?DBI=true the script generate json or directory listing so it can be used with this great switch homebrew

tinfoil json example:
0
url "http://10.34.0.2/switch/data/games/MONSTER HUNTER RISE[0100B04011742000][US][v0].nsp#MONSTER+HUNTER+RISE%5B0100B04011742000%5D%5BUS%5D%5Bv0%5D.nsp"
size 7051860928
1
url "http://10.34.0.2/switch/data/games/MONSTER HUNTER RISE[0100B04011742800][US][v393216].nsp#MONSTER+HUNTER+RISE%5B0100B04011742800%5D%5BUS%5D%5Bv393216%5D.nsp"
size 3491320256

If there is any suggestion or feature add let me know
Enjoy

PS I tested my script on Debian with apache, hope this works on other OS / webserver but is not tested
 
Last edited by proconsule54,

narukyuubito

Well-Known Member
Newcomer
Joined
Sep 29, 2015
Messages
81
Trophies
0
Age
37
XP
635
Country
  • Like
Reactions: proconsule54

proconsule54

Well-Known Member
OP
Member
Joined
Nov 5, 2019
Messages
753
Trophies
1
Age
43
XP
2,661
Country
Italy
Changelog:

Added tinfoil json generation using index.php?tinfoil=true (tested working on tinfoil 12.10)
Added update version tooltip (tanks @falcorr for the suggestion)
Added directory listing like generation for future use with DBI Installer (not working right now waiting for the author to support it) with index.php?DBI=true
preview2.jpg

Enjoy!
 

proconsule54

Well-Known Member
OP
Member
Joined
Nov 5, 2019
Messages
753
Trophies
1
Age
43
XP
2,661
Country
Italy
DBI works with apache directory listing. If you want it to work with your script make your script work as apache directory listing.
You are right, maybe a misunderstanding. I wrote (not working right now waiting for the author to support it) because there is an hard check for url ending with / in DBI so is impossible to write url with index.php?DBI=true that create a webpage like apache directory listing.
I really love DBI Installer and tanks for your hard work on it.

preview3.jpg
 
Last edited by proconsule54,

proconsule54

Well-Known Member
OP
Member
Joined
Nov 5, 2019
Messages
753
Trophies
1
Age
43
XP
2,661
Country
Italy
@duckbill007 tried with ending / but it doesn't show in DBI Home screen

Home server=ApacheHTTP|http://10.34.0.2/switch/?DBI=true/
end this way
Home server=ApacheHTTP|http://10.34.0.2/switch/index.php?DBI=true/

maybe the ? mess something in url check.

Since DBI is close source (legitimate choice) i can't figure out why isn't showing the home server in main menu of DBI

how is checked the URL? just a check on last char or with some c or c++ function?
how is retrived the html of directory listing? curl or some custom code?
 
Last edited by proconsule54,

duckbill007

Well-Known Member
Member
Joined
May 5, 2011
Messages
676
Trophies
1
XP
2,432
Country
Russia
Code:
std::vector<std::string> parts;
dbi::utils::split(source, "|", parts);
if (parts.size() != 2)
{
continue;
}
if (parts[0] == "ApacheHTTP")
{
std::string url = parts[1];
dbi::utils::trim(url);
if (dbi::utils::endsWith(url, "/"))
{
addSeparator = true;
addMenuItem(std::make_unique<MenuItem>(name, false, [url]() {

--------------------- MERGED ---------------------------

Listing retrieved by curl

--------------------- MERGED ---------------------------

Make sure that you have
Code:
; Browse and install files from configured network sources
Network=true
in config

--------------------- MERGED ---------------------------

If Network=false then sockets are not initialized at all and network sources are not even parsed.
 
  • Like
Reactions: proconsule54

proconsule54

Well-Known Member
OP
Member
Joined
Nov 5, 2019
Messages
753
Trophies
1
Age
43
XP
2,661
Country
Italy
@duckbill007 Tanks for sharing code, sure Network is true in my config, i have another Home server pointing to apache directory listing for debugging
looking at code the menu item is added after checking the dbi::utils::endsWith function and the url is trimmed with dbi::utils::trim(url);
before this check.

if possible that "?" char can mess the trim function in some way leading to fail endswith check?

if you pass http://10.34.0.2/switch/index.php?DBI=true/ to the trim function it returns the same url?

Edit:
Or maybe the dbi::utils::split(source, "|", parts); split it in some unexpected way so parts count will fail?

Sorry to bother you but this make me crazy :)
 
Last edited by proconsule54,

proconsule54

Well-Known Member
OP
Member
Joined
Nov 5, 2019
Messages
753
Trophies
1
Age
43
XP
2,661
Country
Italy
Yes i tried and is the =
Without it is added to main menu.

Probably you don't care about it but since all $_GET parmaters in url are with = you can, when you have some free time, to check only the first = leaving url as it is

For my script is not a problem i can do without it but can be useful for others

Edit.
All ok, Home server shown in menu and nsp are correctly listed, but no download.
On Browser link are correctly and it download.

since href in html is only part of real url how DBI generate the download link to be used by downloader?
it uses home server url plus the href?
Tanks
 
Last edited by proconsule54,

proconsule54

Well-Known Member
OP
Member
Joined
Nov 5, 2019
Messages
753
Trophies
1
Age
43
XP
2,661
Country
Italy
Yes i suspected that, browser automagicaly remove index.php plus any GET arguments and so realtive path will work but DBI don't do this.
it is not a criticism to DBI it works on directory list as expected, but it can't be any workaround for that i can do.

Just to know since you have implemented it there is any type of directory listing that DBI actually support that have full path into href?

Tanks a lot for your time.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • A @ anotherthing:
    Online was free on the 3DS as well, and it worked well.
    +1
  • S @ salazarcosplay:
    I can't help but think nintendo switch online is the reason we did not get a gameboy/n64/gamecube
    mini classic edition
    +1
  • Xdqwerty @ Xdqwerty:
    @salazarcosplay, i think it would have been impossible to see anything in a gameboy mini
  • S @ salazarcosplay:
    well I meant that as a figure of speech
  • S @ salazarcosplay:
    they could just rerelease a modern gameboy
  • S @ salazarcosplay:
    like the pocket analogue
  • S @ salazarcosplay:
    but nintendo licensed
  • LeoTCK @ LeoTCK:
    dammit that thread got moved from offtopic to edge, well since that happened
  • Xdqwerty @ Xdqwerty:
    @LeoTCK, atleast it's still avaliable
  • LeoTCK @ LeoTCK:
    yes but it wasn't meant to be a comedy thread
  • LeoTCK @ LeoTCK:
    and edge of the forum is mostly comedy and games
  • LeoTCK @ LeoTCK:
    so I don't get why it got moved at all
  • Xdqwerty @ Xdqwerty:
    @LeoTCK, mods are probably hating you
  • LeoTCK @ LeoTCK:
    on most sites mods hated me, sooner or later, but usually over time I get either banned or the mods get used to me
  • LeoTCK @ LeoTCK:
    sometimes to the point of thanking me for my quick actions etc against spam and other stuff, but yea...its either they come to respect me or outright hate me
    +1
  • BigOnYa @ BigOnYa:
    If it's not game related, it will be moved to the Egde of the forum. Mods have moved a few of my threads also.
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, it was in the off topic chat forum
  • BigOnYa @ BigOnYa:
    Well atleast they didn't delete it completely.
  • LeoTCK @ LeoTCK:
    hmm
  • Xdqwerty @ Xdqwerty:
    uoiea
  • LeoTCK @ LeoTCK:
    huh?
  • Xdqwerty @ Xdqwerty:
    Aeiou backwards
    Xdqwerty @ Xdqwerty: Aeiou backwards