pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)
Res facta quae tamen fingi potuit ([personal profile] pauamma) wrote in [site community profile] dw_dev2023-06-07 01:00 am
Entry tags:

Question thread #122

It's time for another question thread!

The rules:

- You may ask any dev-related question you have in a comment. (It doesn't even need to be about Dreamwidth, although if it involves a language/library/framework/database Dreamwidth doesn't use, you will probably get answers pointing that out and suggesting a better place to ask.)
- You may also answer any question, using the guidelines given in To Answer, Or Not To Answer and in this comment thread.
sunlit_skycat: A gray and white cat in a meadow (Default)

Make a theme mobile friendly?

[personal profile] sunlit_skycat 2023-06-12 06:43 am (UTC)(link)
Hi, I'm a new Dreamwidth user, and I have a community here, at https://blueheronteanook.dreamwidth.org/. I am using the style Radiant Aqua for Venture, with a lot of recolors, set to 3 Columns (one sidebar on each side), one sidebar on each side. I want to be able to make this theme more mobile friendly by having one column only on mobile, essentially the 1 Column (modules at bottom; no sidebar) layout, while keeping the 3 column layout on desktop.

How difficult is this to do? My CSS knowledge is at the point where I can copy and paste it and mess around with variables, but I do not feel confident in writing anything out from scratch.
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

Re: Make a theme mobile friendly?

[staff profile] denise 2023-06-13 10:52 am (UTC)(link)
You will probably get better answers in [community profile] style_system, honestly: not a lot of us are CSS wizards!
veryroundbird: (Default)

Re: Make a theme mobile friendly?

[personal profile] veryroundbird 2023-06-13 04:38 pm (UTC)(link)
Hello! I have some suggestions. What you're going to be doing is adding a media query to change how the styles work at a certain display width breakpoint. I've written up a quick stylesheet here that you should just be able to copypaste into the custom CSS box and have work, but let me know if there's any issues with it!
sunlit_skycat: A gray and white cat in a meadow (Default)

Re: Make a theme mobile friendly?

[personal profile] sunlit_skycat 2023-06-14 01:05 am (UTC)(link)
I copied and pasted the code into the custom CSS box, and then went to check the site on mobile (Firefox on a Galaxy Note9, if that matters). I did not see any change from before.
veryroundbird: (Default)

Re: Make a theme mobile friendly?

[personal profile] veryroundbird 2023-06-14 01:45 am (UTC)(link)
Oh, hm—it seems like that layout doesn't have the meta tag that lets non-desktop devices render the page responsively. It should be this:

<meta name="viewport" content="width=device-width, initial-scale=1">

...and it should go in the <head> tag, but apparently user layers aren't allowed to add meta tags in the advanced layout customization. Which is why someone's writing a patch for it in the DW codebase like right now, I think, ahaha
sunlit_skycat: A gray and white cat in a meadow (Default)

Re: Make a theme mobile friendly?

[personal profile] sunlit_skycat 2023-06-14 03:37 am (UTC)(link)
To be clear, once this DW patch goes through, will I need to do anything to this site specifically to make it mobile responsive? Will the CSS provided still be necessary after that?
finalprogramme: (Default)

[personal profile] finalprogramme 2023-06-16 05:36 pm (UTC)(link)

Novice barely-knows-how-to-code question here.

I'm trying to scrape comments from a community with an HTTPS call, using the URL:

https://www.dreamwidth.org/export_comments?get=comment_body&startid=0&authas=COMMNAME

This works if I'm logged in to the browser, no problem. But what I'm struggling with is how to send that request as part of a script. So for example, I put together what I thought would be a simple Python script:

import requests

from requests.auth import HTTPBasicAuth

auth=HTTPBasicAuth('USERNAME', 'APIKEY')

r = requests.get('https://www.dreamwidth.org/export_comments?get=comment_body&startid=0&authas=COMMNAME', auth=auth) print(r.text)

What I get back is the Dreamwidth login page. I'm sure there's something extremely obvious that I'm missing here, but dammit Jim, I'm a docs writer, not a developer.

Edited 2023-06-16 17:36 (UTC)
veryroundbird: (Default)

Re: Make a theme mobile friendly?

[personal profile] veryroundbird 2023-06-21 06:39 am (UTC)(link)
update: as it turns out I am patching these directly into the theme in the same code push, so! you will not need it 👍
sunlit_skycat: A gray and white cat in a meadow (Default)

Re: Make a theme mobile friendly?

[personal profile] sunlit_skycat 2023-06-22 05:33 pm (UTC)(link)
Thanks for all the work you're putting in to this!
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2023-06-26 11:56 pm (UTC)(link)
I threw this in our developer channel to see if anyone had any advice for you, but if you don't get any useful replies, maybe try a top-level post to get more attention to it!
momijizukamori: Green icon with white text - 'I do believe in phosphorylation! I do!' with a string of DNA basepairs on the bottom (Default)

[personal profile] momijizukamori 2023-06-27 12:30 am (UTC)(link)
So the simplest way is going to just be to grab a logged in session browser cookie - I believe it's the ljuniq cookie, specifically. Then you can set that in the Requests object and it'll act as a logged in cookie session.

There's a way to auth through the old XML-RPC api but I would have to look it up - you have to pass an MD5-hashed version of your username and API key to a specific endpoint and you get an auth cookie back.