Compare commits

...

15 Commits

Author SHA1 Message Date
fox 5e89609016 treehouse Vagrantfile init
ci/woodpecker/pr/woodpecker Pipeline failed Details
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-12-18 17:37:01 -06:00
kouhai dev f25edd6dcf consistent dividers
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-12-17 19:14:19 -08:00
Rin f196b4b9d6 force psych <4 in Gemfile 2022-12-17 19:14:19 -08:00
kouhai dev 36cc31f924 add deps rake tasks 2022-12-17 19:14:19 -08:00
kouhai dev 0604b7a3f8 update default repository/source metadata 2022-12-17 19:14:19 -08:00
kouhai dev e6544ce4b0 use yarn 3 2022-12-17 19:14:19 -08:00
kouhai dev 4ea85c685e update browserslist 2022-12-17 19:14:19 -08:00
kouhai dev 99158a0af2 update dockerignore 2022-12-17 19:14:19 -08:00
kouhai dev f8f1966e79 temporarily remove "Get the app" link" 2022-12-17 19:14:19 -08:00
kouhai dev 19cd42360d quick status hover hack 2022-12-17 19:14:19 -08:00
fox 772ba5aac3 update documentation
ci/woodpecker/push/woodpecker Pipeline was successful Details
Reviewed-on: #30
Co-authored-by: fox <fox@neko.business>
Co-committed-by: fox <fox@neko.business>
2022-12-18 03:13:45 +00:00
Rin aa24b2d072
make glitch style consistent
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-12-08 18:26:32 +11:00
Rin 0cd76aa22a
make default masto style consistent 2022-12-08 18:24:41 +11:00
Rin 06a2259577
fix default masto style too 2022-12-08 16:58:48 +11:00
Rin 7bf26a1094
fix missing link style in admin.scss - actually this time
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/pr/woodpecker Pipeline was successful Details
2022-12-08 16:31:42 +11:00
15 changed files with 16425 additions and 12408 deletions

View File

@ -1,6 +1,5 @@
[production] [production]
defaults defaults
not IE 11
not dead not dead
[development] [development]

View File

@ -19,3 +19,4 @@ postgres14
redis redis
elasticsearch elasticsearch
chart chart
data

View File

@ -3,6 +3,9 @@
source 'https://rubygems.org' source 'https://rubygems.org'
ruby '>= 2.6.0', '< 3.1.0' ruby '>= 2.6.0', '< 3.1.0'
gem 'psych', '< 4'
gem 'pkg-config', '~> 1.4' gem 'pkg-config', '~> 1.4'
gem 'rexml', '~> 3.2' gem 'rexml', '~> 3.2'

View File

@ -478,6 +478,7 @@ GEM
pry (>= 0.13, < 0.15) pry (>= 0.13, < 0.15)
pry-rails (0.3.9) pry-rails (0.3.9)
pry (>= 0.10.4) pry (>= 0.10.4)
psych (3.3.4)
public_suffix (5.0.0) public_suffix (5.0.0)
puma (5.6.5) puma (5.6.5)
nio4r (~> 2.0) nio4r (~> 2.0)
@ -813,6 +814,7 @@ DEPENDENCIES
private_address_check (~> 0.5) private_address_check (~> 0.5)
pry-byebug (~> 3.10) pry-byebug (~> 3.10)
pry-rails (~> 0.3) pry-rails (~> 0.3)
psych (< 4)
puma (~> 5.6) puma (~> 5.6)
pundit (~> 2.2) pundit (~> 2.2)
rack (~> 2.2.4) rack (~> 2.2.4)
@ -858,3 +860,9 @@ DEPENDENCIES
webpacker (~> 5.4) webpacker (~> 5.4)
webpush! webpush!
xorcist (~> 1.1) xorcist (~> 1.1)
RUBY VERSION
ruby 3.0.4p208
BUNDLED WITH
2.3.26

View File

@ -17,31 +17,29 @@ Mastodon development requires the following:
### macOS ### macOS
First, make sure you have Homebrew installed. Follow the instructions at First, make sure you have Homebrew installed. Follow the instructions at [brew.sh](https://brew.sh).
[brew.sh](https://brew.sh).
Run the following to install all necessary packages: Run the following to install all necessary packages:
``` ```
brew install ruby@3.0 foreman node yarn postgresql redis brew install ruby@3.0 foreman node yarn postgresql redis
``` ```
Ruby 3.0 is **keg-only** by default. Follow the instructions in the **Caveat** Ruby 3.0 is **keg-only** by default. Follow the instructions in the **Caveat** to add it to your path.
to add it to your path.
### Linux ### Linux
We will assume that you know how to locate the correct packages for your distro. We will assume that you know how to locate the correct packages for your distro. That said, some distros package `bundler` and `irb` separately. Make sure that you also install these.
That said, some distros package `bundler` and `irb` separately. Make sure that
you also install these.
On Arch, you will need: On Arch, you will need:
- `ruby` - `ruby`
- `ruby-bundler` - `ruby-bundler`
- `ruby-irb` - `ruby-irb`
- `ruby-foreman` - `ruby-foreman`
- `redis` - `redis`
- `postgresql` - `postgresql`
- `yarn`
- `gmp`
- `libidn`
### Windows ### Windows
@ -80,7 +78,7 @@ mkdir -p data/redis
redis-server ./redis-dev.conf redis-server ./redis-dev.conf
# [Optional] Stop Redis # [Optional] Stop Redis
kill "$(cat ./data/redis/redis-dev.pid)" # kill "$(cat ./data/redis/redis-dev.pid)"
``` ```
## Ruby ## Ruby
@ -111,11 +109,10 @@ bundle exec rake db:setup
## Running Mastodon ## Running Mastodon
1. Run `export RAILS_ENV=development NODE_ENV=development`. 1. Run `export RAILS_ENV=development NODE_ENV=development`.
a. Put these in your shell's .rc, or a script you can source if you want to skip this step in the future. - Put these in your shell's .rc, or a script you can source if you want to skip this step in the future.
2. Run `bundle exec rake assets:precompile`. 2. Run `bundle exec rake assets:precompile`.
a. If this explodes, complaining about `Hash`, you'll need to `export NODE_OPTIONS=--openssl-legacy-provider`. - If this explodes, complaining about `Hash`, you'll need to `export NODE_OPTIONS=--openssl-legacy-provider`.
b. After doing this, you will need to run `bundle exec rake assets:clobber` and then re-run - After doing this, you will need to run `bundle exec rake assets:clobber` and then re-run `bundle exec rake assets:precompile`.
`bundle exec rake assets:precompile`.
3. Run `foreman start` 3. Run `foreman start`
# Updates/Troubleshooting # Updates/Troubleshooting
@ -123,21 +120,24 @@ bundle exec rake db:setup
## RubyVM/DebugInspector Issues ## RubyVM/DebugInspector Issues
Still unable to fix. Circumvent by removing `better_errors` and `binding_of_caller` from Gemfile. Still unable to fix. Circumvent by removing `better_errors` and `binding_of_caller` from Gemfile.
Happy to troubleshoot with someone better with Ruby than us >_<'/. Happy to troubleshoot with someone better with Ruby than us >_<'/.
## Webpack Issues ## Webpack Issues
If Webpack compalins about being unable to find some assets or locales:
Try:
If Webpack compalins about being unable to find some assets or locales:
Try:
1. `rm -rf node_modules` 1. `rm -rf node_modules`
2. `yarn install` 2. `yarn install`
If this doesn't help, try: If this doesn't help, try:
1. `yarn add webpack` 1. `yarn add webpack`
2. `git restore package.json yarn.lock` 2. `git restore package.json yarn.lock`
3. `yarn install` 3. `yarn install`
Then re-run `foreman`. No. We have no idea why this worked. Then re-run `foreman start`. No. We have no idea why this worked.
# Need Help?
If the above instructions don't work, please contact @Rin here, or @tammy@social.treehouse.systems. If the above instructions don't work, please contact @Rin here, or @tammy@social.treehouse.systems.

179
Vagrantfile vendored
View File

@ -1,137 +1,100 @@
# -*- mode: ruby -*- # -*- mode: ruby -*-
# vi: set ft=ruby : # vi: set ft=ruby :
ENV["PORT"] ||= "3000" REQUIRED_PLUGINS = %w(vagrant-libvirt)
exit unless REQUIRED_PLUGINS.all? do |plugin|
Vagrant.has_plugin?(plugin) || (
puts "The #{plugin} plugin is required. Please install it with:"
puts "$ vagrant plugin install #{plugin}"
false
)
end
$provision = <<SCRIPT $provision = <<SCRIPT
# see SETUP.md for details
cd /vagrant # This is where the host folder/repo is mounted export RAILS_ENV=development
export NODE_ENV=development
export NODE_OPTIONS=--openssl-legacy-provider
# Add the yarn repo + yarn repo keys echo '[treehouse-vagrant] install packages'
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - sudo pacman -Syu --noconfirm base-devel git libidn
sudo apt-add-repository 'deb https://dl.yarnpkg.com/debian/ stable main' sudo pacman -Syu --noconfirm ruby ruby-bundler ruby-irb redis postgresql yarn
git clone https://aur.archlinux.org/ruby-foreman.git
cd ruby-foreman
yes | sudo -u vagrant makepkg -si
# Add repo for NodeJS # treehouse mastodon files are synced here
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - cd /vagrant
# Add firewall rule to redirect 80 to PORT and save echo '[treehouse-vagrant] init database'
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port #{ENV["PORT"]} if [ -d "data/" ]; then rm -rf data/; fi
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections mkdir -p data/
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections pg_ctl -D data/postgres initdb -o '-U mastodon --auth-host=trust'
sudo apt-get install iptables-persistent -y echo 'unix_socket_directories = .' >> data/postgres/postgresql.conf
pg_ctl -D data/postgres start --silent
# Add packages to build and run Mastodon echo '[treehouse-vagrant] start redis'
sudo apt-get install \ mkdir -p data/redis
git-core \ redis-server ./redis-dev.conf
g++ \
libpq-dev \
libxml2-dev \
libxslt1-dev \
imagemagick \
nodejs \
redis-server \
redis-tools \
postgresql \
postgresql-contrib \
yarn \
libicu-dev \
libidn11-dev \
libreadline-dev \
libpam0g-dev \
-y
# Install rvm echo '[treehouse-vagrant] bundle install'
read RUBY_VERSION < .ruby-version if [ -d "vendor/bundle/" ]; then rm -rf vendor/bundle/; fi
bundle config set --local path 'vendor/bundle/'
curl -sSL https://rvm.io/mpapis.asc | gpg --import
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import
curl -sSL https://raw.githubusercontent.com/rvm/rvm/stable/binscripts/rvm-installer | bash -s stable --ruby=$RUBY_VERSION
source /home/vagrant/.rvm/scripts/rvm
# Install Ruby
rvm reinstall ruby-$RUBY_VERSION --disable-binary
# Configure database
sudo -u postgres createuser -U postgres vagrant -s
sudo -u postgres createdb -U postgres mastodon_development
# Install gems and node modules
gem install bundler foreman
bundle install bundle install
echo '[treehouse-vagrant] yarn install'
yarn add webpack
git restore package.json yarn.lock
yarn install yarn install
# Build Mastodon echo '[treehouse-vagrant] bundle db'
export RAILS_ENV=development bundle exec rake db:setup || exit
export $(cat ".env.vagrant" | xargs)
bundle exec rails db:setup
# Configure automatic loading of environment variable echo '[treehouse-vagrant] bundle assets'
echo 'export RAILS_ENV=development' >> ~/.bash_profile bundle exec rake assets:precompile || exit
echo 'export $(cat "/vagrant/.env.vagrant" | xargs)' >> ~/.bash_profile
echo '[treehouse-vagrant] foreman start'
foreman start
SCRIPT SCRIPT
$start = <<SCRIPT # TODO: allow `vagrant up`
# this requires persistent storage
# i.e., not saving data, assets, etc to /vagrant
#$start = <<SCRIPT
#
#export NODE_ENV=development
#export RAILS_ENV=development
#cd /vagrant
#pg_ctl -D data/postgres start --silent
#redis-server ./redis-dev.conf
#foreman start
#
#SCRIPT
echo 'To start server' Vagrant.configure("2") do |config|
echo ' $ vagrant ssh -c "cd /vagrant && foreman start"'
SCRIPT config.vagrant.plugins = "vagrant-libvirt"
VAGRANTFILE_API_VERSION = "2" config.vm.box = "archlinux/archlinux"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.provider :virtualbox do |vb|
vb.name = "mastodon"
vb.customize ["modifyvm", :id, "--memory", "4096"]
# Increase the number of CPUs. Uncomment and adjust to
# increase performance
# vb.customize ["modifyvm", :id, "--cpus", "3"]
# Disable VirtualBox DNS proxy to skip long-delay IPv6 resolutions.
# https://github.com/mitchellh/vagrant/issues/1172
vb.customize ["modifyvm", :id, "--natdnsproxy1", "off"]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "off"]
# Use "virtio" network interfaces for better performance.
vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
vb.customize ["modifyvm", :id, "--nictype2", "virtio"]
end
# This uses the vagrant-hostsupdater plugin, and lets you
# access the development site at http://mastodon.local.
# If you change it, also change it in .env.vagrant before provisioning
# the vagrant server to update the development build.
#
# To install:
# $ vagrant plugin install vagrant-hostsupdater
config.vm.hostname = "mastodon.local" config.vm.hostname = "mastodon.local"
if defined?(VagrantPlugins::HostsUpdater) # vagrant ssh -- -L 3000:localhost:3000 (:
config.vm.network :private_network, ip: "192.168.42.42", nictype: "virtio" #config.vm.network :forwarded_port, guest: 3000, host: 3000
config.hostsupdater.remove_on_suspend = false
end
if config.vm.networks.any? { |type, options| type == :private_network } config.vm.synced_folder ".", "/vagrant",
config.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options: ['rw', 'vers=3', 'tcp', 'actimeo=1'] type: "rsync",
else rsync__args: ["--verbose", "--archive", "--delete", "-z"],
config.vm.synced_folder ".", "/vagrant" rsync__exclide: ".git/"
end
# Otherwise, you can access the site at http://localhost:3000 and http://localhost:4000 , http://localhost:8080
config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.network :forwarded_port, guest: 4000, host: 4000
config.vm.network :forwarded_port, guest: 8080, host: 8080
# Full provisioning script, only runs on first 'vagrant up' or with 'vagrant provision'
config.vm.provision :shell, inline: $provision, privileged: false config.vm.provision :shell, inline: $provision, privileged: false
#config.vm.provision :shell, inline: $start, run: 'always', privileged: false
# Start up script, runs on every 'vagrant up' config.vm.provider :libvirt do |libvirt|
config.vm.provision :shell, inline: $start, run: 'always', privileged: false libvirt.driver = "kvm"
libvirt.memory = 4096
libvirt.cpus = 4
end
end end

View File

@ -10,17 +10,6 @@ $content-width: 840px;
width: 100%; width: 100%;
min-height: 100vh; min-height: 100vh;
a {
color: $highlight-text-color;
&:hover,
&:active,
&:focus {
text-decoration: none;
}
}
.sidebar-wrapper { .sidebar-wrapper {
min-height: 100vh; min-height: 100vh;
overflow: hidden; overflow: hidden;
@ -1692,6 +1681,15 @@ a.sparkline {
box-sizing: border-box; box-sizing: border-box;
min-height: 100%; min-height: 100%;
a {
color: $highlight-text-color;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
p { p {
margin-bottom: 20px; margin-bottom: 20px;
unicode-bidi: plaintext; unicode-bidi: plaintext;

View File

@ -285,23 +285,28 @@
} }
} }
@mixin focusable {
outline: 0;
background: lighten($ui-base-color, 4%);
&.status.status-direct {
background: lighten($ui-base-color, 12%);
&.muted {
background: transparent;
}
}
.detailed-status,
.detailed-status__action-bar {
background: lighten($ui-base-color, 8%);
}
}
.focusable { .focusable {
&:focus { &:focus,
outline: 0; &:hover {
background: lighten($ui-base-color, 4%); @include focusable;
&.status.status-direct {
background: lighten($ui-base-color, 12%);
&.muted {
background: transparent;
}
}
.detailed-status,
.detailed-status__action-bar {
background: lighten($ui-base-color, 8%);
}
} }
} }

View File

@ -79,8 +79,6 @@ class LinkFooter extends React.PureComponent {
{' '} {' '}
<a href='https://joinmastodon.org' target='_blank'><FormattedMessage id='footer.about' defaultMessage='About' /></a> <a href='https://joinmastodon.org' target='_blank'><FormattedMessage id='footer.about' defaultMessage='About' /></a>
{' · '} {' · '}
<a href='https://joinmastodon.org/apps' target='_blank'><FormattedMessage id='footer.get_app' defaultMessage='Get the app' /></a>
{' · '}
<Link to='/keyboard-shortcuts'><FormattedMessage id='footer.keyboard_shortcuts' defaultMessage='Keyboard shortcuts' /></Link> <Link to='/keyboard-shortcuts'><FormattedMessage id='footer.keyboard_shortcuts' defaultMessage='Keyboard shortcuts' /></Link>
{' · '} {' · '}
<a href={source_url} rel='noopener noreferrer' target='_blank'><FormattedMessage id='footer.source_code' defaultMessage='View source code' /></a> <a href={source_url} rel='noopener noreferrer' target='_blank'><FormattedMessage id='footer.source_code' defaultMessage='View source code' /></a>

View File

@ -1681,6 +1681,15 @@ a.sparkline {
box-sizing: border-box; box-sizing: border-box;
min-height: 100%; min-height: 100%;
a {
color: $highlight-text-color;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
p { p {
margin-bottom: 20px; margin-bottom: 20px;
unicode-bidi: plaintext; unicode-bidi: plaintext;

View File

@ -33,11 +33,11 @@ module Mastodon
end end
def repository def repository
ENV.fetch('GITHUB_REPOSITORY', 'glitch-soc/mastodon') ENV.fetch('GIT_REPOSITORY', false) || ENV.fetch('GITHUB_REPOSITORY', false) || 'treehouse/mastodon'
end end
def source_base_url def source_base_url
ENV.fetch('SOURCE_BASE_URL', "https://github.com/#{repository}") ENV.fetch('SOURCE_BASE_URL', "https://gitea.treehouse.systems/#{repository}")
end end
# specify git tag or commit hash here # specify git tag or commit hash here
@ -46,8 +46,13 @@ module Mastodon
end end
def source_url def source_url
if source_tag if source_tag && source_base_url =~ /gitea/
"#{source_base_url}/tree/#{source_tag}" suffix = if !str[/\H/]
"commit/#{source_tag}"
else
"branch/#{source_tag}"
end
"#{source_base_url}/#{suffix}"
else else
source_base_url source_base_url
end end

109
lib/tasks/deps.rake Normal file
View File

@ -0,0 +1,109 @@
# frozen_string_literal: true
require 'pathname'
DATA_DIR = Pathname.new('data')
POSTGRES_DIR = DATA_DIR / 'postgres'
POSTGRES_CONF_FILE = POSTGRES_DIR / 'postgresql.conf'
POSTGRES_SOCKET_FILE = POSTGRES_DIR / '.s.PGSQL.5432'
POSTGRES_PID_FILE = POSTGRES_DIR / 'postmaster.pid'
REDIS_DIR = DATA_DIR / 'redis'
REDIS_PID_FILE = REDIS_DIR / 'redis-dev.pid'
def divider
puts '=========='
end
def get_pid(pid_file)
return false unless File.file?(pid_file)
pid = File.read(pid_file).to_i
Process.kill(0, pid)
pid
rescue Errno::ESRCH
nil
end
def postgres_running?
get_pid POSTGRES_PID_FILE
end
directory REDIS_DIR.to_s
namespace :deps do
task start: ['postgres:start', 'redis:start']
task stop: ['postgres:stop', 'redis:stop']
namespace :postgres do
namespace :setup do
task all: [POSTGRES_DIR.to_s]
file POSTGRES_DIR.to_s do
if POSTGRES_CONF_FILE.exist?
puts 'Postgres conf exists, skipping initdb'
next
end
sh %(printf '%s\\n' pg_ctl -D data/postgres initdb -o '-U mastodon --auth-host=trust')
end
task configure: [POSTGRES_DIR.to_s] do
next if File.foreach(POSTGRES_CONF_FILE).detect? { |line| line == /^unix_socket_directories = \.\s*$/ }
POSTGRES_CONF_FILE.open('at') do |f|
f.write("\n", PG_SOCKET_DIRECTORIES_LINE, "\n")
end
end
end
task start: ['setup:all'] do
if (pid = get_pid POSTGRES_PID_FILE)
puts "Postgres is running (pid #{pid})!"
next
end
puts 'Starting postgres...'
divider
sh %(pg_ctl -D ./data/postgres start)
divider
end
task :stop do
unless (pid = get_pid POSTGRES_PID_FILE)
puts "Postgres isn't running!"
next
end
puts "Stopping Postgres (pid #{pid})..."
sh %(pg_ctl -D ./data/postgres stop)
divider
end
end
namespace :redis do
task init: [REDIS_DIR.to_s] do
end
task start: [:init] do
if (pid = get_pid REDIS_PID_FILE)
puts "Redis is running (pid #{pid})!"
next
end
puts 'Starting redis...'
divider
sh %(redis-server redis-dev.conf)
divider
end
task :stop do
unless (pid = get_pid REDIS_PID_FILE)
puts "Redis isn't running!"
next
end
puts "Stopping Redis (pid #{pid})..."
divider
Process.kill(:TERM, pid)
end
end
end

View File

@ -36,12 +36,13 @@
"@rails/ujs": "^6.1.7", "@rails/ujs": "^6.1.7",
"abortcontroller-polyfill": "^1.7.5", "abortcontroller-polyfill": "^1.7.5",
"array-includes": "^3.1.5", "array-includes": "^3.1.5",
"atrament": "0.2.4",
"arrow-key-navigation": "^1.2.0", "arrow-key-navigation": "^1.2.0",
"atrament": "0.2.4",
"autoprefixer": "^9.8.8", "autoprefixer": "^9.8.8",
"axios": "^1.1.3", "axios": "^1.1.3",
"babel-loader": "^8.2.5", "babel-loader": "^8.2.5",
"babel-plugin-lodash": "^3.3.4", "babel-plugin-lodash": "^3.3.4",
"babel-plugin-macros": "^3.1.0",
"babel-plugin-preval": "^5.1.0", "babel-plugin-preval": "^5.1.0",
"babel-plugin-react-intl": "^6.2.0", "babel-plugin-react-intl": "^6.2.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24", "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
@ -173,5 +174,6 @@
"optionalDependencies": { "optionalDependencies": {
"bufferutil": "^4.0.7", "bufferutil": "^4.0.7",
"utf-8-validate": "^5.0.10" "utf-8-validate": "^5.0.10"
} },
"packageManager": "yarn@3.3.0"
} }

View File

@ -87,8 +87,8 @@ describe InstancePresenter do
end end
describe '#source_url' do describe '#source_url' do
it 'returns "https://github.com/glitch-soc/mastodon"' do it 'returns the default URL' do
expect(instance_presenter.source_url).to eq('https://github.com/glitch-soc/mastodon') expect(instance_presenter.source_url).to eq('https://gitea.treehouse.systems/treehouse/mastodon')
end end
end end

28407
yarn.lock

File diff suppressed because it is too large Load Diff