GithubHelp home page GithubHelp logo

Comments (17)

yellows8 avatar yellows8 commented on June 15, 2024

Use the whitelist string from the example. https://github.com/switchbrew/switch-examples/blob/master/applet/libapplets/web/source/main.c

Did you try to log anything from your server?

from libnx.

Slluxx avatar Slluxx commented on June 15, 2024

That whitelist doesn't have any effect either. Yeah, i am logging connections but i just don't get any. connecting from pc does show logs. Its as if i can not establish a connection to it whatsoever.

from libnx.

yellows8 avatar yellows8 commented on June 15, 2024

Tried using port 80?

from libnx.

Slluxx avatar Slluxx commented on June 15, 2024

no, 1234
but it should not matter, since i can specify a port in the url for the webapplet and thats working just fine. ill try anyway.

Edit: I cant bind port 80. (errno 13)
Edit2: I could provide a repository if that makes things easier.

from libnx.

yellows8 avatar yellows8 commented on June 15, 2024

Edit2: I could provide a repository if that makes things easier. sure

from libnx.

Slluxx avatar Slluxx commented on June 15, 2024

Edit2: I could provide a repository if that makes things easier. sure

https://github.com/Slluxx/serverxbrowser

For testing purposes, i changed the thread to open the webbrowser instead of running the webserver, due to printf's inside a thread are leading to crashes. the current solution is also not great because it should use locked_printf but right now it works.

from libnx.

yellows8 avatar yellows8 commented on June 15, 2024

FWIW you can use standard threads - you don't have to directly use libnx threads. Large buffers like char buffer[8192]; should really be moved to non-stack as well.

from libnx.

Slluxx avatar Slluxx commented on June 15, 2024

Ah, didnt know. i was just using the threads that were in all the switchbrew examples. is there any disadvantage by using those? And what does moved to non-stack as well. mean "in code"? I understand C/++ mostly by looking at code and people saying things like that usually just pops up a big questionmark above my head. Also, why is it benefitial to move it there?

from libnx.

yellows8 avatar yellows8 commented on June 15, 2024

Your process is likely not running while the applet is active. You need to use webSession (see web.h), or if pre-7.0.0 system-version support is really required, use appletSetFocusHandlingMode.

Normally you should use standard threads, unless you really want cooperative thread scheduling. static char buffer[...] would be good enough, would move it from stack to .data (large buffers doesn't really belong on stack). Using fsInitialize/fsExit isn't needed, that's used automatically by libnx for apps.

from libnx.

Slluxx avatar Slluxx commented on June 15, 2024

Your process is likely not running while the applet is active.

But why can i still access the webserver on my pc while the applet is active? Shouldn't that mean that the process is in fact running? To serve content, it has to run in a loop for polling, evaluating and responding - which it obviously does.
I will write file logs to confirm that. Pretty sure the issue lies somewhere else.

Using fsInitialize/fsExit isn't needed, that's used automatically by libnx for apps.

understood, will be removed.

static char buffer[...] would be good enough

thanks for the clarification!

Edit: Logs show that the current way of threading and opening the applet does not stop the main loop from executing.

from libnx.

yellows8 avatar yellows8 commented on June 15, 2024

What exactly is the use-case for this?

The applet opens but cant connect to the server on 127.0.0.1, localhost or {Switch IP addr}. ... with the error code "2800-1007". Likewise here without a server running.

localhost and 127.0.0.1 are explicitly blacklisted by the web-applet itself AFAICT.

from libnx.

Slluxx avatar Slluxx commented on June 15, 2024

What exactly is the use-case for this?

i am experimenting with different kind of servers and webpages to create html/css/js homebrew guis, instead of using sdl or something else.

localhost and 127.0.0.1 are explicitly blacklisted by the web-applet itself AFAICT.

due to this info, i tried accessing the server via atmospheres dns mitm service.
using my switches lan adress and a random domain name worked perfectly fine.
Its not really a solution i want to use but it works to experiment with things.

Is there a way to remove those adresses from the blacklist somehow?

from libnx.

yellows8 avatar yellows8 commented on June 15, 2024

You could use webOffline for that, with webSession if needed.

Is there a way to remove those adresses from the blacklist somehow? That requires patching the web-applet codebin.

from libnx.

Slluxx avatar Slluxx commented on June 15, 2024

i am trying to use weboffline as suggested but my switch just crashes with a 0x4a2 which doesnt help a lot.

            WebCommonConfig conf;
            WebCommonReply out;
            webOfflineCreate(&conf, WebDocumentKind_OfflineHtmlPage, 0 , "/");
            webConfigSetWhitelist(&conf, "^http*");
            webConfigShow(&conf, &out);

It crashes upon executing webConfigShow. I thought it may be that i have to use /index.html instead of a path?
i am also confused about where to put the index file. From the docs i am understanding romfs:/html-document/index.html but not quite sure if thats right.

from libnx.

yellows8 avatar yellows8 commented on June 15, 2024

Path is relative to SD /atmosphere/hbl_html/html-document/ - you should probably include your app-name or similar in the path.

from libnx.

Slluxx avatar Slluxx commented on June 15, 2024

and no way of having it in romfs of the homebrew?

from libnx.

yellows8 avatar yellows8 commented on June 15, 2024

AMS only loads user-specified-content for that romfs from that /atmosphere/hbl_html/ dir.

from libnx.

Related Issues (20)

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.