Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 2 additions & 6 deletions src/kolibri_app/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import ctypes
else:
from kolibri_app.server_manager_posix import PosixServerManager as ServerManager
from kolibri.plugins.app.utils import interface
from kolibri.core.device.utils import app_initialize_url

STATE_FILE = "app_state.json"

Expand Down Expand Up @@ -73,9 +73,7 @@ def OnInit(self):
# Create a hidden window to receive messages
self.create_hidden_window()

enable_plugin("kolibri.plugins.app")
enable_plugin("kolibri_app")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We still need to enable the plugin from this repository! Just not the kolibri one.


self.windows = []
self.kolibri_origin = None
self.kolibri_url = None
Expand Down Expand Up @@ -262,9 +260,7 @@ def load_kolibri(self, listen_port, root_url=None):
final_url = f"{root_url}?next={next_url}" if next_url else root_url
else:
# On other platforms, we construct the URL ourselves
final_url = self.kolibri_origin + interface.get_initialize_url(
next_url=next_url
)
final_url = self.kolibri_origin + app_initialize_url(next_url=next_url)
self.kolibri_url = final_url
logging.info(f"Loading Kolibri at: {final_url}")

Expand Down
17 changes: 17 additions & 0 deletions src/kolibri_app/kolibri_plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
import getpass

from kolibri.core.device.hooks import GetOSUserHook
from kolibri.plugins import KolibriPluginBase
from kolibri.plugins.hooks import register_hook


class KolibriApp(KolibriPluginBase):
kolibri_option_defaults = "options_defaults"


@register_hook
class KolibriAppGetOSUserHook(GetOSUserHook):
def get_os_user(self, auth_token):
try:
username = getpass.getuser()
except Exception:
username = None

if username:
return (username, True)
return (None, False)
6 changes: 0 additions & 6 deletions src/kolibri_app/server_manager_posix.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
from threading import Thread

from kolibri.main import initialize
from kolibri.plugins.app.utils import interface
from kolibri.plugins.app.utils import SHARE_FILE
from kolibri.utils.conf import OPTIONS
from kolibri.utils.server import KolibriProcessBus
from magicbus.plugins import SimplePlugin

from kolibri_app.logger import logging

share_file = None


class AppPlugin(SimplePlugin):
def __init__(self, bus, callback):
Expand Down Expand Up @@ -45,8 +41,6 @@ def start(self):
def _run_kolibri_server(self):
initialize()

if callable(share_file):
interface.register_capabilities(**{SHARE_FILE: share_file})
self.kolibri_server = KolibriProcessBus(
port=OPTIONS["Deployment"]["HTTP_PORT"],
zip_port=OPTIONS["Deployment"]["ZIP_CONTENT_PORT"],
Expand Down
15 changes: 3 additions & 12 deletions src/kolibri_app/server_process_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,12 @@
sys.path.insert(0, os.path.join(sys._MEIPASS, "kolibrisrc"))
sys.path.insert(0, os.path.join(sys._MEIPASS, "kolibrisrc", "kolibri", "dist"))

from kolibri.main import initialize, enable_plugin
from kolibri.plugins.app.utils import interface, SHARE_FILE
from kolibri.main import initialize
from kolibri.core.device.utils import app_initialize_url
from kolibri.utils.conf import OPTIONS
from kolibri.utils.server import KolibriProcessBus
from kolibri_app.logger import logging

# File sharing disabled to mirror original implementation
share_file = None

# Named pipe for IPC between UI process and server subprocess
# Uses Windows named pipe format: \\.<hostname>\pipe\<pipename>
PIPE_NAME = r"\\.\pipe\KolibriAppServerIPC"
Expand Down Expand Up @@ -88,7 +85,7 @@ def _construct_server_urls(self, port):
Construct the server URLs based on the port.
"""
kolibri_origin = f"http://localhost:{port}"
root_url = kolibri_origin + interface.get_initialize_url()
root_url = kolibri_origin + app_initialize_url()
return kolibri_origin, root_url

def on_server_start(self, port):
Expand Down Expand Up @@ -288,14 +285,8 @@ def _initialize_kolibri(self):
Initialize Kolibri with required plugins and configuration.
"""
logging.info("Server process: Initializing Kolibri...")
enable_plugin("kolibri.plugins.app")
initialize()

# File sharing integration - intentionally disabled to mirror original implementation
# This check will always be False since share_file is None
if callable(share_file):
interface.register_capabilities(**{SHARE_FILE: share_file})

def _create_kolibri_server(self):
"""
Create and configure the Kolibri server instance.
Expand Down
Loading