Coder Social home page Coder Social logo

mastomods's Introduction

MastoMods

This repo contains CSS tweaks and modifications for Mastodon, a libre micro-blogging social server whose default web frontend is similar to Tweetdeck. These mods can be used to create custom themes by admins for their Mastodon instances, or imported into userstyle extensions by users.

Table of contents:

Prior work Preview
This work is heavily based on (and an extension of) my earlier work on Mastodon Flat CSS, and its child theme Linernotes Mastodon Themes. I grew tired of having to maintain what was essentially the same code in multiple different places, so this repo was created to be a more modular way of managing code snippets after I learned enough about how importing works. mfc preview
linernotes_dark is an admin-installable theme that was commissioned for linernotes.club. Because the base MFC theme is adaptable, it is not too difficult to build your own theme on top of it. See the source code for comments and documentation. linernotes preview

Instructions for admins

Download this repo and copy the files into your Mastodon deployment. If I can figure out the git commands to fetch the files without messing up your existing Mastodon deployment, I'll add them here. For now, I recommend cloning this repo and copying over the files that you want/need, and pulling in updates as necessary.

To use a pre-made theme:

Let's use the Linernotes Dark theme as an example. Per these olds docs, to enable a new theme, you need to do the following:

  1. Fetch the files. Add your desired custom CSS/SCSS to app/javascript/styles. You can copy/merge the entire app folder from the root of this repo into the root of your Mastodon deployment.
app/
  javascript/
    styles/
      contrast/
        ...
      fonts/
        ...
      linernotes_dark/                            | **new**
        overrides.scss                            | **new**
        palette.scss                              | **new**
      mastodon-light/
        ...
      mastodon/
        ...
      mfc/                                        | **new**
        mastodonFlat.css                          | **new**
        variables.scss                            | **new**
      mods/                                       | **new**
        avatars_circle.css                        | **new**
        columns_gettingstarted.css                | **new**
        ...                                       | **new**
        misc_elefriend.css                        | **new**
      application.scss
      contrast.scss
      linernotes_dark.scss                        | **new**
      mailer.scss
      mastodon-light.scss
  1. Add your theme to the config. This is what the default themes.yml looks like in Mastodon. To make your custom theme visible in settings, you need to add a new line in the form themeName: path/to/theme.scss. For example, the linernotes_dark theme would require adding linernotes_dark: styles/linernotes_dark.scss as a new line.
default: styles/application.scss
contrast: styles/contrast.scss
mastodon-light: styles/mastodon-light.scss
linernotes_dark: styles/linernotes_dark.scss      | **new**
  1. Add a human-friendly name for the theme (optional). You can edit each desired language's locale file in config/locales/[lang].yml to add a localized string name for your theme's themeName as added in the previous step. For example, the default config/locales/en.yml contains localizations for the three default themes that ship with Mastodon, into the english language. You need to do this for every language you expect your users to use, or else they will see the unlocalized themeName directly.
  themes:
    contrast: Mastodon (High contrast)
    default: Mastodon (Dark)
    mastodon-light: Mastodon (Light)
    linernotes_dark: Linernotes Dark              | **new**
  1. Compile theme assets and restart. Run RAILS_ENV=production bundle exec rails assets:precompile and restart your Mastodon instance for the changes to take effect.

To make your own theme:

  1. Fetch the base files. You will need, at minimum, the contents of the .../mfc/ folder. It is also recommended to fetch the .../mods/ folder, as it contains many useful additions to any theme.

  2. Define your chosen palette.scss. See .../linernotes_dark/palette.scss for commented instructions on how to choose and define your palette's colors. I recommend putting this in a subfolder with your themeName for organizational purposes (e.g. .../themeName/palette.scss), but you can also define this in Step 3 if you don't want multiple palette files and theme folders to be littered all over.

  3. Create a themeName.scss file. You can copy `linernotes_dark.scss as a starting point, as it follows the general structure of a theme file. In general, you need to import in the following order:

  • application: this contains the base styling of the mastodon webapp, before any modifications.
  • themeName/palette: this contains the Sass variables that need to be defined before the MFC rules can be applied. You can also copy the entirety of palette.scss from Step 2 and insert it at this position if you want less of a mess in file creation, at the expense of a messier themeName.scss.
  • mfc/mastodonFlat: this contains the MFC recolorings for foreground, background, and highlight elements.
  • mfc/variables: this uses the Sass variables you defined earlier and converts them to CSS variables so that mastodonFlat can be applied.
  • themeName/overrides (optional): if you have any custom overrides you'd like to make, such as custom backgrounds or replacing assets, it's a good idea to load them via this file.
  • mods/* (optional but recommended): import your desired mods. Refer to the .../mods/ folder for a list of available mods.

Instructions for users

If your admin has installed a theme:

  1. Go to your instance's Settings/Preferences.
  2. Scroll down to the "Web" section.
  3. Click the "Site theme" dropdown and select your desired theme.
  4. Save changes, and start using the Mastodon webapp with your newly selected theme!

If your admin has not installed a theme:

Copy and paste desired CSS tweaks into your user-style manager. If you don't have one, use Stylus:

stylus icon firefox opera chrome source code

Another way to get some of these tweaks... Help
A distribution of Mastodon Flat CSS is available at https://userstyles.org/styles/153362 and contains many of these tweaks through the "Customize settings" menu. image

The base MFC userstyle can be found at app/javascript/styles/mfc/mastodonFlat.css. You can load a theme into Stylus like so:

  1. Navigate to your Mastodon instance.
  2. Click the Stylus extension's icon in your browser and find the section that says "Write style for:"
  3. Hover over the website's domain name (e.g. mastodon.social) and click just that part, in order to write a new style that will be applied to the entire website.
  4. Copy and paste the contents of mastodonFlat.css into your new userstyle.
  5. Copy and paste any desired mods into your new userstyle.
  6. Name your userstyle, then click "Save" and close the popup window.

Support

mastodon Contact/follow me: mastodon.social/@trwnh

email Email/XMPP: [email protected] xmpp online status

paypal Tip me: paypal.me/trwnh

liberapay Recurring patronage: liberapay.com/trwnh

mastomods's People

Contributors

trwnh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mastomods's Issues

Feature Branch to Mastodon Fork?

If the themes were created as tagged feature branches of a mastodon fork this would:

  • allow people to add them to their installs
  • allow people to collaborate with you on them

thanks

linernotes_dark theme - footer links not clickable

Hello, I didn't see this issue raised before, and thought I'd throw it out there as I wasn't able to find a fix for it just yet. We love your mods, but this small issue was brought up and verified on our instance (as well as a friend's instance also using his own theme, which is just a modded linernotes_dark).

Any idea why this might be occurring or if there is a workaround or solution?

TIA for any assistance. It's greatly appreciated.

Multiple unthemed features

Some of features still missing themes:

List adder

image

(You can ignore the subscribe button. It's not in vanilla version of mastodon.)
DId you intentionally leave the color unchanged? Well I think it's fine.

Log entries

In the admin section.

image

Dashboard counters

In the admin section.

image

Accouncement

In the admin section.

image

layout_mobile_bottombar no longer working

The .tab_bar is hidden on a mobile device. (For example, on a linernotes_dark theme).
Users can no longer see the tab bar.
Did you intentionally hide them, or it's because of conflict with upstream changes?

Increased toot limit and ran 'service docker restart' but it's not reflecting on my site. Is that the correct way to do it? Anything I have missed out?

Using the tutorial in this link https://github.com/trwnh/mastomods/blob/main/tutorials/limits.md, I updated the following files.

  • /public_html/live/app/validators/status_length_validator.rb
  • app/javascript/mastodon/features/compose/components/compose_form.js

I then ran docker-compose restart.

Output:

Restarting live_streaming_1 ... done
Restarting live_web_1       ... done
Restarting live_sidekiq_1   ... done
Restarting live_redis_1     ... done
Restarting live_db_1        ... done

However, the changes are are not being reflected on my site. What else do I need to do? Anything I'm missing?
I'm on the latest version.

Upstream update on boost icon

Upstream has changed their boost icon. If you are planning to match upstream updates the following information might be helpful:

  1. Boost icon for private toots that cannot be boosted
    tootsuite#14373
  2. Boost icon for private toots that can be boosted (which means you are the author and you can boost to your audiences)
    tootsuite#14380
    tootsuite#14386

[touchscreen] Favourite button keeps active after unfav a status

I am trying to fix the code so that it can keep up with changes from Mastodon upstream.
However, there are some difficult problems that I don't know how to resolve.
This is one of the weird bugs.

Steps to reproduce

Click the star button to favourite. Then click it again to deactive. It will remain as "active", until the user click anywhere in the column area.

Reproducible on Firefox and Chrome

precompile failure

I followed the instructions in the readme.

/home/mastodon/live$ grep linernotes config/locales/en.yml 
    linernotes_dark: Liner Notes (Dark)

/home/mastodon/live$ cat config/themes.yml 
default: styles/application.scss
contrast: styles/contrast.scss
mastodon-light: styles/mastodon-light.scss
linernotes_dark: styles/linernotes_dark.scss

/home/mastodon/live$ ls -R app/javascript/styles/
app/javascript/styles/:
application.scss  fonts                 mailer.scss     mastodon-light.scss
contrast          linernotes_dark       mastodon        mfc
contrast.scss     linernotes_dark.scss  mastodon-light  mods

app/javascript/styles/contrast:
diff.scss  variables.scss

app/javascript/styles/fonts:
montserrat.scss  roboto-mono.scss  roboto.scss

app/javascript/styles/linernotes_dark:
overrides.scss  palette.scss

app/javascript/styles/mastodon:
_mixins.scss        boost.scss           footer.scss        reset.scss
about.scss          compact_header.scss  forms.scss         rtl.scss
accessibility.scss  components.scss      introduction.scss  stream_entries.scss
accounts.scss       containers.scss      lists.scss         tables.scss
admin.scss          dashboard.scss       modal.scss         variables.scss
basics.scss         emoji_picker.scss    polls.scss         widgets.scss

app/javascript/styles/mastodon-light:
diff.scss  variables.scss

app/javascript/styles/mfc:
0-palette.css     2-background.css  4-fixes.css     6-actions.css      variables.scss
1-foreground.css  3-highlights.css  5-material.css  mastodonFlat.scss

app/javascript/styles/mods:
deprecated                         display_transparentmedia.css
display_breakname.css              layout_1600px.css
display_browserfont.css            layout_elefriend.css
display_circleavatar.css           layout_gettingstartedheight.css
display_collapsedinteractions.css  layout_hidedisabled.css
display_emojizoom.css              layout_hidefiltered.css
display_fadedinteractions.css      layout_mobile_bottombar.css
display_fullmedia.css              layout_singlecolumn.css
display_fullname.css               layout_widercolumns.css
display_hidereplycounts.css        test_colorizedlogo.css
display_starstohearts.css

app/javascript/styles/mods/deprecated:
display_bettersearch.css

/home/mastodon/live$ RAILS_ENV=production bundle exec rails assets:precompile --verbose
yarn install v1.19.0
[1/6] Validating package.json...
[2/6] Resolving packages...
success Already up-to-date.
Done in 3.65s.
Compiling…
^C# terminated with exception (report_on_exception is true):
Traceback (most recent call last):
        1: from /home/mastodon/.rbenv/versions/2.6.1/lib/ruby/2.6.0/open3.rb:287:in `block (2 levels) in capture3'
/home/mastodon/.rbenv/versions/2.6.1/lib/ruby/2.6.0/open3.rb:287:in `read': stream closed in another thread (IOError)
# terminated with exception (report_on_exception is true):
Traceback (most recent call last):
        1: from /home/mastodon/.rbenv/versions/2.6.1/lib/ruby/2.6.0/open3.rb:288:in `block (2 levels) in capture3'
/home/mastodon/.rbenv/versions/2.6.1/lib/ruby/2.6.0/open3.rb:288:in `read': stream closed in another thread (IOError)
rails aborted!
Interrupt: 
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/webpacker-4.0.7/lib/webpacker/compiler.rb:61:in `run_webpack'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/webpacker-4.0.7/lib/webpacker/compiler.rb:21:in `compile'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/webpacker-4.0.7/lib/webpacker/commands.rb:18:in `compile'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/webpacker-4.0.7/lib/webpacker.rb:27:in `compile'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/webpacker-4.0.7/lib/tasks/webpacker/compile.rake:31:in `block (4 levels) in '
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/webpacker-4.0.7/lib/tasks/webpacker/compile.rake:6:in `ensure_log_goes_to_stdout'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/webpacker-4.0.7/lib/tasks/webpacker/compile.rake:30:in `block (3 levels) in '
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/webpacker-4.0.7/lib/webpacker.rb:20:in `with_node_env'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/webpacker-4.0.7/lib/tasks/webpacker/compile.rake:29:in `block (2 levels) in '
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/webpacker-4.0.7/lib/tasks/webpacker/compile.rake:22:in `block in enhance_assets_precompile'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:48:in `invoke'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/home/mastodon/live/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
bin/rails:4:in `'
Tasks: TOP => webpacker:compile
(See full trace by running task with --trace)

3.1 debugging

  • follows and followers
  • simple mode
  • .reply-indicator__content a.unhandled-link, .status__content a.unhandled-link needs color: accent
  • .drawer__inner, .drawer__inner__mastodon need background: bgPage
  • .getting-started__footer p need color: textPageMuted
  • .getting-started__footer a needs color: accent

need to find what was added/changed in 3.0 as well

  • new profile directory
  • new mute dialog
  • regression in settings page background
  • account migration / alias?
  • new dm conversation component
  • maybe refactor search sidebar a bit? it looks a bit dated and inconsistent...
  • unhandled links from non-mastodon users don't have correct accent color .reply-indicator__content a.unhandled-link, .status__content a.unhandled-link
  • modal menu that sometimes appears instead of popout (idk how to trigger it though?)

Status actions modal entirely broken on mobile devices

Screenshot

image

Steps to reproduce

This bug exists not only on midnight-blue, but also in many other themes, such as Linernotes Dark.

  1. Open Firefox/Chrome, switch to mobile view
  2. Force refresh the page, click the "..." button next to any status
  3. You will see the screenshot

Note that on desktop mode, clicking the "..." button will not trigger status action modal. A normal actions menu will be shown instead.

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.