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

Feature/fullscreen #31

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions socks5.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import ipaddress
import logging
import socket
import ui
import struct
import threading

from lib.socks5_server import AsyncSocks5Handler
Expand Down Expand Up @@ -248,6 +250,15 @@ def do_GET(s):
return server


# Handler for full screen button to render a full screen window.
# Use a two-finger "slide down" gesture to close.
def full_screen_handler(sender):
fs_view = ui.View()
fs_view.name = "Full screen"
fs_view.background_color = "black"
fs_view.present(style="popover", hide_title_bar=True, orientations=["landscape"])


def run_wpad_server(server):
try:
server.serve_forever()
Expand Down Expand Up @@ -299,6 +310,19 @@ async def main():

await stats.render_forever()

# Create side panel UI component to enter full screen
view = ui.View()
view.name = "SOCKS"
view.background_color = "black"
view.flex = "WH"
# Add simple button to show full screen popover
fs_button = ui.Button(title="Enter full screen")
fs_button.action = full_screen_handler

# Render main UI and full screen button
view.add_subview(fs_button)
view.present(style="panel", hide_title_bar=True)

try:
asyncio.run(main())
except KeyboardInterrupt:
Expand Down