Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Vthttpd 3DS: Difference between revisions

From GameBrew
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 18: Line 18:
|image=3ds.png
|image=3ds.png
|image_alt=vthttpd
|image_alt=vthttpd
}}
}}{{lowercase title}}
vthttpd is a small homebrew HTTP server designed for 3DS consoles. It's a fork of [[3DS httpd]] by dimaguy and is meant to run as a dedicated server.
vthttpd is a small homebrew HTTP server for 3DS consoles forked from [[3DS httpd]] by dimaguy.


== Key Features ==
This homebrew is meant to run as a dedicated HTTP daemon via autoboot. As such, if you're launching it via the Homebrew Launcher, the only way to return to the HOME menu is to reboot your console.
* '''Autoboot-Friendly''': This homebrew is best used as an HTTP daemon that autoboots. If you're launching it through the Homebrew Launcher, keep in mind you'll need to reboot your console to return to the HOME menu.
* '''Power-Saving Mode''': When running, vthttpd will shut down both screens to save power. Logs are saved to <code>sdmc:/vthttpd</code>.
* '''&quot;noservices&quot; Version''': This version tries to disable certain 3DS firmware services to save even more power and resources. It’s only been tested on old 3DS models and will likely crash on new 3DS (n3DS) or new 2DS (n2DS) systems.


== What's New? ==
When running, vthttpd will shut down both screens to save power. Logs are saved to <code>sdmc:/vthttpd</code>.


This fork introduces tons of changes compared to the original 3ds-httpd. Some updates are showcased in the included example HTML page. You can also check out the changelog for full details. One cool feature is that it can log activity directly on the console (though the public release sticks to the power-saving screen-off behavior).
The "noservices" release will attempt to kill some services provided by the 3DS' firmware to potentially save power and free extra resources. This has only been tested on old 3DS consoles and will very likely result in a crash on a n3DS/n2DS.


== Why Was It Made? ==
This fork includes many changes compared to 3ds-httpd (a good bunch of which are shown in action with the included example HTML page), check the changelog for more information.
The creator initially built this as a fun project to host a personal portfolio on a water-damaged 2DS board that was partially functional. It was a mix of creative repurposing and experimenting for fun. Sadly, the project was cut short when the board stopped working entirely, but the homebrew still exists as a quirky, niche tool for anyone who might find it useful.


==Screenshots==
==Screenshots==
https://dlhb.gamebrew.org/3dshomebrews/images/vthttpd3DS-02.png
https://dlhb.gamebrew.org/3dshomebrews/images/vthttpd3DS-02.png
== Important Notes ==
* '''No Support or Updates''': The creator is releasing this as-is, with no plans to update or provide support. It’s just something cool that was lying around and happened to gain some interest on the Fediverse.
* '''Niche Use''': This is definitely not for everyone, but if you’re into messing with 3DS homebrew or hosting lightweight HTTP servers for fun, you might enjoy it.
Hope you find it interesting—or at least entertaining!


==Changelog==  
==Changelog==  
''' 19/11/2024 '''
''' 2024/11/19 '''
* Initial public release
* Initial public release.


''' 26/06/2023 '''
''' 2023/06/26 '''
* The server will now return a fatal error in case it gets disconnected from Wi*Fi
* The server will now return a fatal error in case it gets disconnected from Wi*Fi.
** Once again, this also automatically reboots the system with my CFW fork, which means the error will be logged and then vftpd will get restarted on boot
** Once again, this also automatically reboots the system with my CFW fork, which means the error will be logged and then vftpd will get restarted on boot.
* The server will also periodically turn off the backlight
* The server will also periodically turn off the backlight.
** This was done as there is a rather rare occurrence in which the backlight will get turned on agan on their own
** This was done as there is a rather rare occurrence in which the backlight will get turned on agan on their own.


''' 19/06/2023 '''
''' 2023/06/19 '''
* The server will now initialize and connect to Wi*Fi manually instead of relying on the 3DS's OS to do so
* The server will now initialize and connect to Wi*Fi manually instead of relying on the 3DS's OS to do so.
** This gives us several added bonuses:
** This gives us several added bonuses:
*** The connection should now be more reliable in general, as letting the OS configure it on its own at an early boot stage with several disabled components might be unreliable
*** The connection should now be more reliable in general, as letting the OS configure it on its own at an early boot stage with several disabled components might be unreliable.
*** The Wi*Fi AP config currently gets retrieved from system settings (1st connection slot) but it's now technically possible to add code to allow loading AP config from the SD card
*** The Wi*Fi AP config currently gets retrieved from system settings (1st connection slot) but it's now technically possible to add code to allow loading AP config from the SD card.
** failExit now writes fatal errors to the logfile correctly
** failExit now writes fatal errors to the logfile correctly.
* Added code to turn off both screens' backlight as soon as the server starts
* Added code to turn off both screens' backlight as soon as the server starts.
** In my specific case, this was handled by my own CFW fork before. However, after rebasing my CFW fork on the latest version of Luma3DS, I've decided it'd be more appropriate to let the application handle this instead
** In my specific case, this was handled by my own CFW fork before. However, after rebasing my CFW fork on the latest version of Luma3DS, I've decided it'd be more appropriate to let the application handle this instead.


''' 18/06/2023 '''
''' 2023/06/18 '''
* Implemented a basic, rotating log system
* Implemented a basic, rotating log system.
** The logfile's paths are /vthttpd/latest.log and /vthttpd/prev.log
** The logfile's paths are /vthttpd/latest.log and /vthttpd/prev.log
* General code optimization
* General code optimization.


''' 17/06/2023 '''
''' 2023/06/17 '''
* Removed screen init and console*related functions (for my current project the software is meant to run headless on a dedicated 2DS console anyway, with the screen turned off)
* Removed screen init and console*related functions (for my current project the software is meant to run headless on a dedicated 2DS console anyway, with the screen turned off).
** The function printTop has been stubbed instead of being removed in preparation of a logging system, as it is primarily used to log events on the top screen
** The function printTop has been stubbed instead of being removed in preparation of a logging system, as it is primarily used to log events on the top screen.
** On the other hand, printBottom has been removed completely as it was only used for the eManual, so it already went unused when that feature got taken out
** On the other hand, printBottom has been removed completely as it was only used for the eManual, so it already went unused when that feature got taken out.
* Unnecessary background services will now be terminated before the server starts. This includes:
* Unnecessary background services will now be terminated before the server starts. This includes:
** mic (Microphone)
** mic (Microphone)
Line 89: Line 78:
** pdn (PDN register handler)
** pdn (PDN register handler)
** ro (.ro library loader)
** ro (.ro library loader)
*** Some of these services are essential for regular 3DS usage. If you do not mean to use vthttpd on a dedicated console as an HTTP server like I do, you might not want to terminate them
*** Some of these services are essential for regular 3DS usage. If you do not mean to use vthttpd on a dedicated console as an HTTP server like I do, you might not want to terminate them.
* Moved the custom HTML error page template's path from /html/error.html to /vthttpd/error.html
* Moved the custom HTML error page template's path from /html/error.html to /vthttpd/error.html
** This was changed so that the template error page is not accessible to the end user
** This was changed so that the template error page is not accessible to the end user.


''' 14/06/2023 '''
''' 2023/06/14 '''
* sysinfo handler refactor (it now returns a single json file with all the data when accessing /sysinfo/ instead of several different endpoint)
* sysinfo handler refactor (it now returns a single json file with all the data when accessing /sysinfo/ instead of several different endpoint).
** Therefore, sysinfo will now send a Content*Type of application/json instead of text/plain
** Therefore, sysinfo will now send a Content*Type of application/json instead of text/plain.
* Removed DEFAULT_PAGE in favor of errorPage
* Removed DEFAULT_PAGE in favor of errorPage.
** 3DS*HTTPD used DEFAULT_PAGE as a static, hardcoded error 501 page which got served to the client whenever no handlers were able to process the request
** 3DS*HTTPD used DEFAULT_PAGE as a static, hardcoded error 501 page which got served to the client whenever no handlers were able to process the request.
*** This has been replaced with a generic HTML page which displays the correct error code and description whenever an error occurs
*** This has been replaced with a generic HTML page which displays the correct error code and description whenever an error occurs.
** Additionally, a custom template error page can now be loaded from /html/error.html
** Additionally, a custom template error page can now be loaded from /html/error.html.
* Minor code optimization
* Minor code optimization.


''' 10/06/2023 '''
''' 2023/06/10 '''
* MIME type parser refactor (clearer code and fix for a pointer error)
* MIME type parser refactor (clearer code and fix for a pointer error).
* Added /sysinfo/batteryvoltage to the sysinfo handler (returns the battery's current *raw* voltage level, must be converted to volts in order to be humanly readable)
* Added /sysinfo/batteryvoltage to the sysinfo handler (returns the battery's current *raw* voltage level, must be converted to volts in order to be humanly readable).


''' 09/06/2023 '''
''' 2023/06/09 '''
* Removed the read, write, crypt and system handlers (you *do not* want to expose those to the world wide web for obvious reasons!)
* Removed the read, write, crypt and system handlers (you *do not* want to expose those to the world wide web for obvious reasons!).
* Default port changed from 8081 to 80
* Default port changed from 8081 to 80.
* The sdcard handler has been greatly refactored:
* The sdcard handler has been greatly refactored:
** It will now serve files from a subdirectory (/html/) instead of the SD card's root
** It will now serve files from a subdirectory (/html/) instead of the SD card's root.
** Added proper support for serving index.html and favicon.ico from the SD card instead of being hardcoded in the server's executable
** Added proper support for serving index.html and favicon.ico from the SD card instead of being hardcoded in the server's executable.
*** This effectively supersedes the default and favicon request handlers
*** This effectively supersedes the default and favicon request handlers.
** Added support for serving binary files instead of only plaintext files
** Added support for serving binary files instead of only plaintext files.
** Added support for the following MIME types:
** Added support for the following MIME types:
*** image/x*icon
*** image/x*icon
Line 127: Line 116:
*** application/xml
*** application/xml
*** application/octet*stream
*** application/octet*stream
** Please note: support for more MIME types is possible, but this list comprises the only ones currently implemented due to my specific use case. text/plain is currently only used by the sysinfo handler
** Please note: support for more MIME types is possible, but this list comprises the only ones currently implemented due to my specific use case. text/plain is currently only used by the sysinfo handler.
* Added the sysinfo handler. This is a handler that exposes some useful, non*sensitive information about the system, in particular:
* Added the sysinfo handler. This is a handler that exposes some useful, non*sensitive information about the system, in particular:
** /sysinfo/batterylevel returns the system's battery percentage
** /sysinfo/batterylevel returns the system's battery percentage.
** /sysinfo/chargestate returns whether the system's battery is currently charging or not charging (respectively 1/0)
** /sysinfo/chargestate returns whether the system's battery is currently charging or not charging (respectively 1/0).
* The server will now wait for the Wi*Fi connection to be up before starting
* The server will now wait for the Wi*Fi connection to be up before starting.
* When a critical error occurs, the application will now throw a fatal system error instead of quitting (done to aid with my use case, as my cfw fork is set to reboot the system automatically on fatal)
* When a critical error occurs, the application will now throw a fatal system error instead of quitting (done to aid with my use case, as my cfw fork is set to reboot the system automatically on fatal).
* Removed button inputs, software keboard and eManual (done to aid with my use case, as it's supposed to be a headless http server so no user input is needed)
* Removed button inputs, software keboard and eManual (done to aid with my use case, as it's supposed to be a headless http server so no user input is needed).


== External links ==
== External links ==
* Gbatemp - https://www.reddit.com/r/3dshacks/comments/1gv1qc0/vthttpd_very_tiny_httpd_for_nintendo_3ds_consoles/
* GitHub - https://github.com/RattletraPM/vthttpd
* Github - https://github.com/RattletraPM/vthttpd
* GBAtemp - https://www.reddit.com/r/3dshacks/comments/1gv1qc0/vthttpd_very_tiny_httpd_for_nintendo_3ds_consoles/

Latest revision as of 03:49, 24 November 2024

vthttpd
3ds.png
General
AuthorRattletraPM
TypeUtilities
Version1.0.0
LicenseMIT License
Last Updated2024/11/19
Links
Download
Website
Source

vthttpd is a small homebrew HTTP server for 3DS consoles forked from 3DS httpd by dimaguy.

This homebrew is meant to run as a dedicated HTTP daemon via autoboot. As such, if you're launching it via the Homebrew Launcher, the only way to return to the HOME menu is to reboot your console.

When running, vthttpd will shut down both screens to save power. Logs are saved to sdmc:/vthttpd.

The "noservices" release will attempt to kill some services provided by the 3DS' firmware to potentially save power and free extra resources. This has only been tested on old 3DS consoles and will very likely result in a crash on a n3DS/n2DS.

This fork includes many changes compared to 3ds-httpd (a good bunch of which are shown in action with the included example HTML page), check the changelog for more information.

Screenshots

vthttpd3DS-02.png

Changelog

2024/11/19

  • Initial public release.

2023/06/26

  • The server will now return a fatal error in case it gets disconnected from Wi*Fi.
    • Once again, this also automatically reboots the system with my CFW fork, which means the error will be logged and then vftpd will get restarted on boot.
  • The server will also periodically turn off the backlight.
    • This was done as there is a rather rare occurrence in which the backlight will get turned on agan on their own.

2023/06/19

  • The server will now initialize and connect to Wi*Fi manually instead of relying on the 3DS's OS to do so.
    • This gives us several added bonuses:
      • The connection should now be more reliable in general, as letting the OS configure it on its own at an early boot stage with several disabled components might be unreliable.
      • The Wi*Fi AP config currently gets retrieved from system settings (1st connection slot) but it's now technically possible to add code to allow loading AP config from the SD card.
    • failExit now writes fatal errors to the logfile correctly.
  • Added code to turn off both screens' backlight as soon as the server starts.
    • In my specific case, this was handled by my own CFW fork before. However, after rebasing my CFW fork on the latest version of Luma3DS, I've decided it'd be more appropriate to let the application handle this instead.

2023/06/18

  • Implemented a basic, rotating log system.
    • The logfile's paths are /vthttpd/latest.log and /vthttpd/prev.log
  • General code optimization.

2023/06/17

  • Removed screen init and console*related functions (for my current project the software is meant to run headless on a dedicated 2DS console anyway, with the screen turned off).
    • The function printTop has been stubbed instead of being removed in preparation of a logging system, as it is primarily used to log events on the top screen.
    • On the other hand, printBottom has been removed completely as it was only used for the eManual, so it already went unused when that feature got taken out.
  • Unnecessary background services will now be terminated before the server starts. This includes:
    • mic (Microphone)
    • ir (Infrared)
    • camera (Camera)
    • am (Application manager)
    • hid (Human Interface Device)
    • dlp (Download Play)
    • codec (Codec)
    • news (Notifications)
    • csnd (Sound channels)
    • dsp (Digital Signal Processor / Audio playback)
    • act (Nintendo Account)
    • nfc (Near Field Communications)
    • loader (Process loader)
    • mp (Local 3DS/DS multiplayer)
    • spi (SPI)
    • pdn (PDN register handler)
    • ro (.ro library loader)
      • Some of these services are essential for regular 3DS usage. If you do not mean to use vthttpd on a dedicated console as an HTTP server like I do, you might not want to terminate them.
  • Moved the custom HTML error page template's path from /html/error.html to /vthttpd/error.html
    • This was changed so that the template error page is not accessible to the end user.

2023/06/14

  • sysinfo handler refactor (it now returns a single json file with all the data when accessing /sysinfo/ instead of several different endpoint).
    • Therefore, sysinfo will now send a Content*Type of application/json instead of text/plain.
  • Removed DEFAULT_PAGE in favor of errorPage.
    • 3DS*HTTPD used DEFAULT_PAGE as a static, hardcoded error 501 page which got served to the client whenever no handlers were able to process the request.
      • This has been replaced with a generic HTML page which displays the correct error code and description whenever an error occurs.
    • Additionally, a custom template error page can now be loaded from /html/error.html.
  • Minor code optimization.

2023/06/10

  • MIME type parser refactor (clearer code and fix for a pointer error).
  • Added /sysinfo/batteryvoltage to the sysinfo handler (returns the battery's current *raw* voltage level, must be converted to volts in order to be humanly readable).

2023/06/09

  • Removed the read, write, crypt and system handlers (you *do not* want to expose those to the world wide web for obvious reasons!).
  • Default port changed from 8081 to 80.
  • The sdcard handler has been greatly refactored:
    • It will now serve files from a subdirectory (/html/) instead of the SD card's root.
    • Added proper support for serving index.html and favicon.ico from the SD card instead of being hardcoded in the server's executable.
      • This effectively supersedes the default and favicon request handlers.
    • Added support for serving binary files instead of only plaintext files.
    • Added support for the following MIME types:
      • image/x*icon
      • image/png
      • image/bmp
      • image/gif
      • image/webp
      • image/jpeg
      • text/css
      • text/csv
      • text/javascript
      • text/plain
      • application/xml
      • application/octet*stream
    • Please note: support for more MIME types is possible, but this list comprises the only ones currently implemented due to my specific use case. text/plain is currently only used by the sysinfo handler.
  • Added the sysinfo handler. This is a handler that exposes some useful, non*sensitive information about the system, in particular:
    • /sysinfo/batterylevel returns the system's battery percentage.
    • /sysinfo/chargestate returns whether the system's battery is currently charging or not charging (respectively 1/0).
  • The server will now wait for the Wi*Fi connection to be up before starting.
  • When a critical error occurs, the application will now throw a fatal system error instead of quitting (done to aid with my use case, as my cfw fork is set to reboot the system automatically on fatal).
  • Removed button inputs, software keboard and eManual (done to aid with my use case, as it's supposed to be a headless http server so no user input is needed).

External links

Advertising: