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

Exiles on 1.1 #160

Open
wants to merge 36 commits into
base: upcoming/v1.1
Choose a base branch
from
Open

Exiles on 1.1 #160

wants to merge 36 commits into from

Conversation

anselor
Copy link

@anselor anselor commented May 23, 2024

Aggregation of many PRs

Integrates the following PRs

#123
#136
#138
#145
#148
#150
#155

#157

Supersedes #139

mtoner23 and others added 20 commits May 23, 2024 11:00
Added ability to use wss for ssl deployments (eg traefik/nginx proxy manager).
This change allows to monitor and send MQTT messages from/to the
AnkerMake M5C on the command line as well as observe the printer status
via the Web GUI.
It is also possible to send print jobs from your slicer to the printer
without using AnkerMake Slicer or Studio (see README.md).
Due to the M5's additional hardware (camera, light) still being expected
to exist, the Web GUI will continuously wait for a camera connection.
This should be fixed in the future.
Now the PPPP badge just shows the status of the PPPP connection, and
this also works for the AnkerMake M5C. The new VIDEO badge now has the
same behavior as the original PPPP badge in that it shows the status of
the video stream.
Implemented new command 'config login', which also supports
captcha queries, should they happen.
If there is already a valid ankerctl configuration and the user
just wants to re-login via 'config login' then the printer IP
addresses are restored to their original value if the server did
not provide those IP addresses (for me it never does).
Also, moved around some code parts.
This new form also supports captcha requests.
Also fixed is the behavior that loading/importing a new configuration
led to the printer IP addresses being cleared.
This affects both the CLI 'config show' as well as the 'Setup' tab of
the web interface.
For this the flag '--store' was added to 'pppp lan-search'.
…rs. Added helper shell script for docker.

Changed docker import to accept a login.json in the currect directory if available.
Added stand-alone dockerfile for building runtime container.
Instead of copying the whole gcode file data and then splitting it into
32 KB chunks (2nd copy), use a generator function which emits the chunks
along with the current offset to be used in the AABB request.
Added pyinstaller packaging for windows users.
Updated requirements needed to run transwarp.
badge: "#badge-ctrl",
});

sockets.pppp_state = new AutoWebSocket({
name: "PPPP socket",
url: `ws://${location.host}/ws/pppp-state`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found an error in the pppp_state that would prevent PPPP connection over https:

Suggested change
url: `ws://${location.host}/ws/pppp-state`,
url: `${location.protocol.replace('http','ws')}${location.host}/ws/pppp-state`,

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@treitmayr This was from your changes in this PR:
1089b49

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My changes were done in a consistent way in the existing code base at the time of the commit. However, the merge of d6c727b introduced wss support, again on the code base from back then. This is the explanation for the current state.
However, I agree with @sondregronas to change the affected line in the proposed way.

@sondregronas
Copy link

Just commenting here to say that I've opened a PR to this PR with some more changes - let me know if you want me to switch targets to the main repo. PR: anselor#4

Changes within that PR to this one

  • updating pycryptodomex, flask, flask-sock to the latest version + adding python-dotenv to dependencies
  • addresses the change mentioned above in ankersrv.js
  • restart the pppp api worker (by calling worker_start(), which restarts the api state) on pppp failure (see notes below)
  • start the videoqueue service on /video if it isn't running, allowing webrtc access via go2rtc (see Add rudimentary WebRTC support via go2rtc #162)
  • bugfix: allow webserver access with missing credentials (webserver couldn't start without any camera present in cfg)
  • /api/ankerctl/status endpoint, displays a JSON of every services state and the app_api_version dict

Note regarding pppp:

With this version, pppp should not crash (at least not as often). I've noticed before it would stop working after 2-3 hours of uptime, (but that could also be my really old xeon failing). Instead of crashing it will "flicker" for lack of better words, where sending gcode will sometimes work, and the videostream will have corrupted B/P-frames that only get worse over time. Reloading services are to no avail. Restarting the entire application every 2 hours does circumvent this as far as I can tell.

I tried getting the webserver to run with a different WSGI server, but had no luck. I only tested gevent or eventlet. I wanted to try gunicorn but from my understanding it would require some refactoring to how the cfg is loaded so I stopped trying.

All of these prs combined should resolve (at least to my limited understanding):

#163, #161, #158, partially #156 (PPPP will work but stops being reliable), #154, #151, #147, #127 (might be unrelated?), #112

Might be missing a few issues as well that I haven't encountered myself.

Seems to not work well to have them separated.

This does now work, but it raises a lot more exceptions than just AnkerCriticalError (KeyboardInterrupt & TypeError) - probably from separate threads
Restarting pppp will initiate new connection attempts. Will monitor this for a bit, a lot more graceful than a force shutdown
Removed these by mistake
Will leave this running for a while
Felt fitting to add this here - though I can change target to the main repo
Hopefully the last commit - has survived 3 lost connections so far. (The previous method had the service always running, which was stable but not realistic)
Haven't had a single error message since updating requirements!
Without this, logging in was never an option (would crash on start)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants