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

Enabling mobile CSS in Chromium-based browser #15

Open
NotKit opened this issue Jan 27, 2020 · 5 comments
Open

Enabling mobile CSS in Chromium-based browser #15

NotKit opened this issue Jan 27, 2020 · 5 comments

Comments

@NotKit
Copy link

NotKit commented Jan 27, 2020

Hello! I consider adapting this project to run on Ubuntu Touch/UBPorts. It was done by someone before (https://open-store.io/app/discord.tesla), but relied on a third-party server and I could not find the source code of it.

It's pretty straightforward to run the Go part natively, but opening proxied page on localhost yields no visible changes to Discord web app interface on a small screen. mobilediscord.js and mobilediscord.css are inserted and loaded fine.

I can see Windows-specific code in mobilediscord.js file which obviously will not run on other platforms, so I will be grateful if you could provide some information on implementation details and if non-Windows-specific mobile CSS tweaks can be enabled/shared between platforms.

@timothy003
Copy link
Owner

I'd be happy to help!

If the CSS is loaded, you should be able to scroll horizontally. Inspect .container-2lgZY8 and make sure it has overflow-x: auto. There is no platform-specific CSS. The Windows-specific code adds additional functionality like showing connection info in the status bar and closing modals when the back button is pressed. It also uses a WebView to get the Discord token from the official login page.

@NotKit
Copy link
Author

NotKit commented Jan 28, 2020

Thank you for your answer!

Yes, horizontal scrolling actually works and main chat area resizes to fit screen/window width. I expected it to be more like Android version with popup left/right sidebars, but this makes it already usable compared to official one.

Is there something special about login page? I read the issue about Discord blocking login from the wrong origin, but I was able to login through normal proxied page both on PC and phone, maybe because I was already logged in with this IP.

@timothy003
Copy link
Owner

What browser are you using? It's possible that it doesn't send the Origin header for POST requests.

@NotKit
Copy link
Author

NotKit commented Jan 28, 2020

Chromium 79 on desktop and QtWebEngine-based Morph on UBPorts. Chromium sent "origin: http://localhost:8081". I wonder if they have an exception for localhost in this case.

@timothy003
Copy link
Owner

It looks like 'localhost' and IP addresses like '192.168.1.4' are allowed, while hostnames like 'sandy' are not.

As for the sidebars, there's currently a bug in Chromium that prevents it from scrolling to chat when you tap a channel. Otherwise, the UX should be similar to the Android and iOS apps.

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

No branches or pull requests

2 participants