diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 01941a9d30..b98f6a21e0 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -15,6 +15,12 @@ "webben.browserslist" ], + "features": { + "ghcr.io/devcontainers/features/sshd:1": { + "version": "latest" + } + }, + // Use 'forwardPorts' to make a list of ports inside the container available locally. // This can be used to network with other containers or the host. "forwardPorts": [3000, 4000], diff --git a/.github/workflows/lint-json.yml b/.github/workflows/lint-json.yml new file mode 100644 index 0000000000..5bf4349b3d --- /dev/null +++ b/.github/workflows/lint-json.yml @@ -0,0 +1,38 @@ +name: JSON Linting +on: + push: + branches-ignore: + - 'dependabot/**' + paths: + - 'package.json' + - 'yarn.lock' + - '.prettier*' + - '**/*.json' + - '.github/workflows/lint-json.yml' + + pull_request: + paths: + - 'package.json' + - 'yarn.lock' + - '.prettier*' + - '**/*.json' + - '.github/workflows/lint-json.yml' + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + cache: yarn + + - name: Install all yarn packages + run: yarn --frozen-lockfile + + - name: Prettier + run: yarn prettier --check "**/*.json" diff --git a/.github/workflows/lint-yml.yml b/.github/workflows/lint-yml.yml new file mode 100644 index 0000000000..b939ec8ce2 --- /dev/null +++ b/.github/workflows/lint-yml.yml @@ -0,0 +1,40 @@ +name: YML Linting +on: + push: + branches-ignore: + - 'dependabot/**' + paths: + - 'package.json' + - 'yarn.lock' + - '.prettier*' + - '**/*.yaml' + - '**/*.yml' + - '.github/workflows/lint-yml.yml' + + pull_request: + paths: + - 'package.json' + - 'yarn.lock' + - '.prettier*' + - '**/*.yaml' + - '**/*.yml' + - '.github/workflows/lint-yml.yml' + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + cache: yarn + + - name: Install all yarn packages + run: yarn --frozen-lockfile + + - name: Prettier + run: yarn prettier --check "**/*.{yml,yaml}" diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 319152e93d..b6438d6659 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -57,8 +57,6 @@ jobs: cache: yarn - name: Install dependencies run: yarn install --frozen-lockfile - - name: Check prettier formatting - run: yarn format-check - name: Set-up RuboCop Problem Mathcher uses: r7kamura/rubocop-problem-matchers-action@v1 - name: Set-up Stylelint Problem Matcher diff --git a/.prettierignore b/.prettierignore index f72354a42f..dc8c536933 100644 --- a/.prettierignore +++ b/.prettierignore @@ -70,3 +70,10 @@ docker-compose.override.yml # Ignore locale files /app/javascript/mastodon/locales /config/locales + +# Ignore glitch-soc locale files +/app/javascript/flavours/glitch/locales +/config/locales-glitch + +# Ignore glitch-soc emoji map file +/app/javascript/flavours/glitch/features/emoji/emoji_map.json diff --git a/Gemfile b/Gemfile index 708bd564e9..930ff6c4a6 100644 --- a/Gemfile +++ b/Gemfile @@ -122,7 +122,6 @@ group :test do gem 'climate_control', '~> 0.2' gem 'faker', '~> 3.1' gem 'json-schema', '~> 3.0' - gem 'microformats', '~> 4.4' gem 'rack-test', '~> 2.0' gem 'rails-controller-testing', '~> 1.0' gem 'rspec_junit_formatter', '~> 0.6' diff --git a/Gemfile.lock b/Gemfile.lock index 1ede07699a..80c46f07cb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -130,7 +130,7 @@ GEM concurrent-ruby (~> 1.0, >= 1.0.5) redis (>= 1.0, < 6) builder (3.2.4) - bullet (7.0.4) + bullet (7.0.7) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) bundler-audit (0.9.1) @@ -330,9 +330,9 @@ GEM idn-ruby (0.1.5) ipaddress (0.8.3) jmespath (1.6.2) - json (2.6.2) + json (2.6.3) json-canonicalization (0.3.0) - json-jwt (1.13.0) + json-jwt (1.14.0) activesupport (>= 4.2) aes_key_wrap bindata @@ -349,7 +349,7 @@ GEM json-schema (3.0.0) addressable (>= 2.8) jsonapi-renderer (0.2.2) - jwt (2.4.1) + jwt (2.5.0) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -399,15 +399,12 @@ GEM matrix (0.4.2) memory_profiler (1.0.1) method_source (1.0.0) - microformats (4.4.1) - json (~> 2.2) - nokogiri (~> 1.10) mime-types (3.4.1) mime-types-data (~> 3.2015) mime-types-data (3.2022.0105) mini_mime (1.1.2) mini_portile2 (2.8.0) - minitest (5.16.3) + minitest (5.17.0) msgpack (1.6.0) multi_json (1.15.0) multipart-post (2.1.1) @@ -456,9 +453,9 @@ GEM openssl-signature_algorithm (1.2.1) openssl (> 2.0, < 3.1) orm_adapter (0.5.0) - ox (2.14.11) + ox (2.14.12) parallel (1.22.1) - parser (3.1.2.1) + parser (3.1.3.0) ast (~> 2.4.1) parslet (2.0.0) pastel (0.8.0) @@ -554,7 +551,7 @@ GEM redis (>= 4) redlock (1.3.2) redis (>= 3.0.0, < 6.0) - regexp_parser (2.6.0) + regexp_parser (2.6.1) request_store (1.5.1) rack (>= 1.4) responders (3.0.1) @@ -589,26 +586,26 @@ GEM rspec-support (3.11.1) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.39.0) + rubocop (1.42.0) json (~> 2.3) parallel (~> 1.10) parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.23.0, < 2.0) + rubocop-ast (>= 1.24.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.23.0) + rubocop-ast (1.24.1) parser (>= 3.1.1.0) - rubocop-performance (1.15.1) + rubocop-performance (1.15.2) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.17.2) + rubocop-rails (2.17.4) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.15.0) + rubocop-rspec (2.16.0) rubocop (~> 1.33) ruby-progressbar (1.11.0) ruby-saml (1.13.0) @@ -812,7 +809,6 @@ DEPENDENCIES makara (~> 0.5) mario-redis-lock (~> 1.2) memory_profiler - microformats (~> 4.4) mime-types (~> 3.4.1) net-ldap (~> 0.17) nokogiri (~> 1.13) @@ -880,9 +876,3 @@ DEPENDENCIES webpacker (~> 5.4) webpush! xorcist (~> 1.1) - -RUBY VERSION - ruby 3.0.4p208 - -BUNDLED WITH - 2.2.33 diff --git a/app/controllers/admin/instances_controller.rb b/app/controllers/admin/instances_controller.rb index 7c44e88b7b..5194057263 100644 --- a/app/controllers/admin/instances_controller.rb +++ b/app/controllers/admin/instances_controller.rb @@ -49,7 +49,7 @@ module Admin private def set_instance - @instance = Instance.find(params[:id]) + @instance = Instance.find(TagManager.instance.normalize_domain(params[:id]&.strip)) end def set_instances diff --git a/app/controllers/concerns/web_app_controller_concern.rb b/app/controllers/concerns/web_app_controller_concern.rb index b6050c9138..23c008803b 100644 --- a/app/controllers/concerns/web_app_controller_concern.rb +++ b/app/controllers/concerns/web_app_controller_concern.rb @@ -4,8 +4,8 @@ module WebAppControllerConcern extend ActiveSupport::Concern included do + prepend_before_action :redirect_unauthenticated_to_permalinks! before_action :set_pack - before_action :redirect_unauthenticated_to_permalinks! before_action :set_app_body_class before_action :set_referrer_policy_header end @@ -19,7 +19,7 @@ module WebAppControllerConcern end def redirect_unauthenticated_to_permalinks! - return if user_signed_in? + return if user_signed_in? # NOTE: Different from upstream because we allow moved users to log in redirect_path = PermalinkRedirector.new(request.path).redirect_path diff --git a/app/javascript/core/admin.js b/app/javascript/core/admin.js index 3175ff5607..ac1b2f95fb 100644 --- a/app/javascript/core/admin.js +++ b/app/javascript/core/admin.js @@ -194,7 +194,7 @@ ready(() => { } document.querySelector('a#add-instance-button')?.addEventListener('click', (e) => { - const domain = document.getElementById('by_domain')?.value; + const domain = document.querySelector('input[type="text"]#by_domain')?.value; if (domain) { const url = new URL(event.target.href); diff --git a/app/javascript/flavours/glitch/components/icon_button.js b/app/javascript/flavours/glitch/components/icon_button.js index 41a95e92f7..2485f0f480 100644 --- a/app/javascript/flavours/glitch/components/icon_button.js +++ b/app/javascript/flavours/glitch/components/icon_button.js @@ -30,6 +30,7 @@ export default class IconButton extends React.PureComponent { counter: PropTypes.number, obfuscateCount: PropTypes.bool, href: PropTypes.string, + ariaHidden: PropTypes.bool, }; static defaultProps = { @@ -39,6 +40,7 @@ export default class IconButton extends React.PureComponent { animate: false, overlay: false, tabIndex: '0', + ariaHidden: false, }; state = { @@ -115,6 +117,7 @@ export default class IconButton extends React.PureComponent { counter, obfuscateCount, href, + ariaHidden, } = this.props; const { @@ -155,6 +158,7 @@ export default class IconButton extends React.PureComponent { ); } else if (visible) { - spoilerButton = ; + spoilerButton = ; } else { spoilerButton = (