Skip to content
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

host and port are ignored for the desktop builds #410

Closed
chicoxyzzy opened this issue May 7, 2023 · 13 comments
Closed

host and port are ignored for the desktop builds #410

chicoxyzzy opened this issue May 7, 2023 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@chicoxyzzy
Copy link
Member

We only pass these two values when run on iOS or Android, but they should work for desktop builds as well

@chicoxyzzy chicoxyzzy added the bug Something isn't working label May 7, 2023
@m4gicpotato
Copy link

Hello there. I'm looking to run Nuxt.JS local web server with hot reloading for development purposes and then automatically make a static build when I build the app. I think this issue should get more attention since this is critical for development environments and a total blocker for my working environment for example.

Somehow this piece of code is not properly working:

if (_port > 0) {

@davidmyersdev

This comment was marked as off-topic.

@chicoxyzzy

This comment was marked as off-topic.

@davidmyersdev

This comment was marked as off-topic.

@chicoxyzzy

This comment was marked as off-topic.

@lamiazar
Copy link
Member

lamiazar commented Sep 7, 2023

Moved to in progress will close it after the new release.

@chicoxyzzy
Copy link
Member Author

@lamiazar let's keep it in TODO until someone will pick it

@nnnnathann
Copy link
Contributor

Hi!

After some experimentation with the project, I was able to get the dev server URL working on mac desktop with a few changes to cli.cc and main.cc:

diff --git a/src/cli/cli.cc b/src/cli/cli.cc
index 88fce1d5..30ed1ebd 100644
--- a/src/cli/cli.cc
+++ b/src/cli/cli.cc
@@ -2150,7 +2150,7 @@ int main (const int argc, const char* argv[]) {
     settings.insert(std::make_pair("host", devHost));
 
     String devPort = "0";
-    if (optionsWithValue.count("port") > 0) {
+    if (optionsWithValue.count("--port") > 0) {
       devPort = optionsWithValue["--port"];
     }
     settings.insert(std::make_pair("port", devPort));
diff --git a/src/desktop/main.cc b/src/desktop/main.cc
index 1a46db82..b4b25491 100644
--- a/src/desktop/main.cc
+++ b/src/desktop/main.cc
@@ -67,7 +67,7 @@ MAIN {
   static App* app_ptr = &app;
 
   app.setWindowManager(&windowManager);
-  constexpr auto _port = PORT;
+  const auto _port = getDevPort();
 
   const SSC::String OK_STATE = "0";
   const SSC::String ERROR_STATE = "1";

Apologies for not submitting a full PR, I feel a little worried about the impact of the changes (didn't fully examine the impact).

Happy to help wherever I can,
nathan

@jwerle
Copy link
Member

jwerle commented Sep 9, 2023

Hi!

After some experimentation with the project, I was able to get the dev server URL working on mac desktop with a few changes to cli.cc and main.cc:

diff --git a/src/cli/cli.cc b/src/cli/cli.cc
index 88fce1d5..30ed1ebd 100644
--- a/src/cli/cli.cc
+++ b/src/cli/cli.cc
@@ -2150,7 +2150,7 @@ int main (const int argc, const char* argv[]) {
     settings.insert(std::make_pair("host", devHost));
 
     String devPort = "0";
-    if (optionsWithValue.count("port") > 0) {
+    if (optionsWithValue.count("--port") > 0) {
       devPort = optionsWithValue["--port"];
     }
     settings.insert(std::make_pair("port", devPort));
diff --git a/src/desktop/main.cc b/src/desktop/main.cc
index 1a46db82..b4b25491 100644
--- a/src/desktop/main.cc
+++ b/src/desktop/main.cc
@@ -67,7 +67,7 @@ MAIN {
   static App* app_ptr = &app;
 
   app.setWindowManager(&windowManager);
-  constexpr auto _port = PORT;
+  const auto _port = getDevPort();
 
   const SSC::String OK_STATE = "0";
   const SSC::String ERROR_STATE = "1";

Apologies for not submitting a full PR, I feel a little worried about the impact of the changes (didn't fully examine the impact).

Happy to help wherever I can,
nathan

Hi @nnnnathann,

We'd happily review a PR if you could make one

nnnnathann added a commit to nnnnathann/socket that referenced this issue Sep 10, 2023
@nnnnathann
Copy link
Contributor

Sure, no problem. Created one over here: #565

@lamiazar
Copy link
Member

Fixed by #565

@chicoxyzzy
Copy link
Member Author

@davidmyersdev paths like /path/to/asset.css should work in v0.4.0 that we just published. Please try it and create a new issue if you need any help!

@davidmyersdev
Copy link

I finally had a chance to test this again, and I can confirm it works as expected now! Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants