Post A5jFexrEuBx4mAlROS by mwt@mathstodon.xyz
 (DIR) More posts by mwt@mathstodon.xyz
 (DIR) Post #A5jFevrsIrGubZ2v6e by christianp@mathstodon.xyz
       2021-03-18T13:39:01Z
       
       0 likes, 0 repeats
       
       I came across this nice integerological fact:Define \(\operatorname{ord}_p(n)\) to be the power of \(p\) in the prime factorisation of \(n\).Then\[ \sum_{k=1}^n\gcd(n,k) = \prod_{p|n} \left(1+\left(1-\frac{1}{p}\right) \cdot \operatorname{ord}_p(n)\right) \]I don't know why you'd want to do this, and all the references I've found to it talk about it as a special case of some more general identities, but for some reason it appealed to me.
       
 (DIR) Post #A5jFewHkkdyJtp9aRV by 11011110@mathstodon.xyz
       2021-03-18T19:17:25Z
       
       0 likes, 0 repeats
       
       @christianp This is what your post looks like on Chrome for me. Console message "Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' 'nonce-8y+JBue0utk/qEmjcn+/CA=='". Note that 'unsafe-inline' is ignored if either a hash or nonce value is present in the source list." Math has been rendered like this for months, and the last time I said anything the only response was more or less "works for me". Any idea how to fix?
       
 (DIR) Post #A5jFewih8TWTFNl6R6 by jix@mathstodon.xyz
       2021-03-19T13:20:28Z
       
       0 likes, 0 repeats
       
       @11011110 @christianp AFAICT from a quick search, the only way to fix this without requiring major changes to MathJax would be to stop the HTTP server from sending the "style-src 'nonce-*'" policy in the "content-security-policy" response header, while keeping the "style-src 'unsafe-inline'" policy.That would disable a mitigation against CSS injection, incompatible with MathJax on non Firefox browsers. On Firefox MathJax doesn't need inline CSS for rendering it seems.
       
 (DIR) Post #A5jFex7rcteiVRXCfQ by jix@mathstodon.xyz
       2021-03-19T13:25:51Z
       
       0 likes, 0 repeats
       
       @11011110 @christianp I'm not sure whether Mastodon relies on that mitigation. I would certainly consider it bad practice to do so, but it does provide an extra layer of defense in case of bugs in the Mastodon code base, so disabling it might not be desirable either.In theory the 'nonce-*' policy would allow passing the nonce to MathJax, allowing it to tag the inline CSS as permitted, but in general that does not work for style attributes, only for style tags, and MathJax uses attributes.
       
 (DIR) Post #A5jFexUuFE5TeuJbaC by christianp@mathstodon.xyz
       2021-03-20T05:59:09Z
       
       0 likes, 0 repeats
       
       Sorry, @11011110, I completely forgot about this! Thanks for that info,@jix. It looks like I need to do some serious mathjax plumbing.
       
 (DIR) Post #A5jFexrEuBx4mAlROS by mwt@mathstodon.xyz
       2021-03-20T06:30:00Z
       
       0 likes, 0 repeats
       
       @christianp @11011110 @jix maybe you could just add the styles in a regular stylesheet.
       
 (DIR) Post #A5jFeyDvXq6FuXNYky by christianp@mathstodon.xyz
       2021-03-20T14:52:19Z
       
       0 likes, 0 repeats
       
       @mwt @11011110 @jix mathjax 3 does this weird thing where it makes up the styles for each bit of maths it typesets. I'm not sure what the optimisation is, but I think it's integral to how mathjax 3 works. I'll check, though
       
 (DIR) Post #A5jFeyS6h7RUcW0srI by 11011110@mathstodon.xyz
       2021-03-18T20:01:37Z
       
       0 likes, 0 repeats
       
       @christianp Found the previous thread, from three months ago: https://mathstodon.xyz/@11011110/105385687022835489
       
 (DIR) Post #A5jFeyervfePG5z4ka by christianp@mathstodon.xyz
       2021-03-30T07:37:21Z
       
       0 likes, 0 repeats
       
       @mwt @11011110 @jix I'm looking at this today. I think I have a plan: I need to get MathJax to add the nonce value to the <style> tags it generates. Wish me luck!(As a British person, I _really_ don't like writing the word 'nonce')
       
 (DIR) Post #A5jFez9M6K2MmeFQGm by jix@mathstodon.xyz
       2021-03-30T07:41:41Z
       
       0 likes, 1 repeats
       
       @christianp @mwt @11011110 I think you would also need to modify it to put all inline styles in <style> tags and not use any <other-element style="..."> attributes which don't support nonce values AFAICT. That's why I said passing the nonce value to MathJax would work only in theory... I assumed it would require too many changes to be practical.