Giter VIP home page Giter VIP logo

neuromatchacademy / mastodon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from glitch-soc/mastodon

4.0 1.0 2.0 247.14 MB

A glitchy but lovable microblogging server

Home Page: https://glitch-soc.github.io/docs/

License: GNU Affero General Public License v3.0

Shell 0.03% JavaScript 38.09% Ruby 47.41% CSS 0.01% HTML 0.13% Dockerfile 0.16% Haml 3.35% SCSS 7.73% Procfile 0.01% TypeScript 3.08% Assembly 0.01%

mastodon's Issues

The Filter Duplicate Boosts from local TL feature is filtering non-duplicate boosts as well

Steps to reproduce the problem

  1. I boosted this post: https://scholar.social/@researchfairy/111840719521713968
  2. It appeared on the local TL and then disappeared on refreshing even though there are no other boosts of the same post.
  3. The boost appears on my profile though.
  4. Similar case with this post: https://mastodon.social/@koen_hufkens/111840494469557835 that El had boosted.
  5. I saw the same thing happen earlier with a post from mastodon engg account. We tested this with @sneakers-the-rat and it appeared on the local TL only after Jonny boosted it, I unboosted the post and reboosted.
    ...

Expected behaviour

Only duplicate boosts should be filtered

Actual behaviour

Non-duplicate boosts are being filtered

Detailed description

What's happening is that for some instances, even the first boost is being filtered out.

Relevant feature: https://wiki.neuromatch.social/Filter_Duplicate_Boosts
I'm no query expert but something in the query is filtering non-duplicate boosts for certain posts (not all) from the local TL.

Mastodon instance

neuromatch.social

Mastodon version

v4.3.0-alpha.0+glitch

Technical details

If this is happening on your own Mastodon server, please fill out those:

  • Ruby version: ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-linux]
  • Node.js version: v16.20.2

Fetch all replies

Pitch

When expanding a post, the instance should fetch all replies from the host server.

This issue is to move more general conversation out of #8 because i think that's the wrong approach

Previous context:

Motivation

Two reasons:

  • It's an important discovery mechanism - people should be able to see the conversation around a post (within normal privacy settings, ie. we should not be trying to get followers-only posts, etc.)
  • The "a thousand of the same replies" problem is notorious on fedi and part of what makes it somewhat exhausting, and can quickly feel like brigading if a post becomes even moderately popular.

Approach

  • When a post is expanded, a call is made to the context endpoint
  • If that status is on a different server AND the request is coming from a logged in user on our instance, make a call to the FetchRepliesService before yielding from the db
  • Remove limitation on URIs matching the host server and the limit of 5 replies in the filtered_replies method and fetch_collection.
  • Instead, to mitigate amplification/DoS, replace with a single numerical limit that first filters out URLs that the instance already has (to avoid duplicated requests). This should be tied to the pagination of the context endpoint - first fetch 40 posts, then as one scrolls the server should fetch the next 40, and so on.

Concerns

Privacy has been discussed elsewhere - we will only be getting posts that wouldn't be filtered out by normal post visibility settings. ie. the user would be able to get them on their own by just running a bunch of manual searches.

  • Perf & API Consistency: Having a potentially long-running service call in the context endpoint is undesirable. We should run the service as async. This will mean that later calls will yield different results (ie. as the posts are imported by the async worker). That's really only a problem for programmatic API usage, and just requires a note on the endpoint documentation. In normal web UI usage, it should look like the posts loading into the interface as they are received. The context endpoint would behave as expected on the first call, and just have extra replies in future calls. We could add an additional option that defaults false to make the reply fetching service synchronous.

MathML support

Hello! mathstodon.xyz and types.pl run a patch to not strip MathML tags from posts when displaying: mastodon@0546835

Would you be interested in merging it into neuromatch.social as well? Now that Chrome added back in MathML support, it's possible it'll become more widespread. But getting support at least on Mastodon is a bit of a social problem: PRs on mastodon and glitch-soc have languished, and clients can't support native viewing until instances stop stripping it.

(also: it was a little difficult to find the source code for this instance. would you mind linking to it in version.rb?)

Thanks :-D

MathJaX renders anything between `$$`

Steps to reproduce the problem

See: https://neuromatch.social/@[email protected]/111502628902459771

Screen Shot 2023-11-30 at 8 40 06 PM

Expected behaviour

Only typeset between \( and \)

Actual behaviour

See above (this issue template sucks)

Detailed description

The instance should be configured like this:

  var nonce = document.querySelector('meta[name="style-nonce"]').getAttribute('content');
  window.MathJax = {
    chtml: {nonce: nonce},
    tex: {
      processEnvironments: false,
      processRefs: false,
      inlineMath: [['\\(', '\\)']],
      displayMath: [['\\[', '\\]']]
      }
    };

:javascript
var nonce = document.querySelector('meta[name="style-nonce"]').getAttribute('content');
window.MathJax = {
chtml: {nonce: nonce},
tex: {
processEnvironments: false,
processRefs: false,
inlineMath: [['\\(', '\\)']],
displayMath: [['\\[', '\\]']]
}
};
%script{ src: '/MathJax/es5/tex-chtml.js' }

which overrides the displayMath delimiters which are $$ by default: https://docs.mathjax.org/en/latest/options/input/tex.html

This is apparently ignored because of the site's content security settings which disallow inline scripts.

So we need to use the nonce that comes from here

%meta{ name: 'style-nonce', content: request.content_security_policy_nonce }

in the script tag, and also allow nonce'd inline scripts in our CSP.

See:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#unsafe_inline_script

and

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#sources

Mastodon instance

neuromatch.social

Mastodon version

garegarg sthsrtjytj

Browser name and version

Firefox

Operating system

macOS

Technical details

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.