M .devcontainer/Dockerfile => .devcontainer/Dockerfile +0 -4
@@ 4,10 4,6 @@ FROM mcr.microsoft.com/devcontainers/ruby:1-3.2-bullseye
# Install Rails
# RUN gem install rails webdrivers
-# Default value to allow debug server to serve content over GitHub Codespace's port forwarding service
-# The value is a comma-separated list of allowed domains
-ENV RAILS_DEVELOPMENT_HOSTS=".githubpreview.dev,.preview.app.github.dev,.app.github.dev"
-
ARG NODE_VERSION="16"
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"
A .devcontainer/codespaces/devcontainer.json => .devcontainer/codespaces/devcontainer.json +49 -0
@@ 0,0 1,49 @@
+{
+ "name": "Mastodon on GitHub Codespaces",
+ "dockerComposeFile": "../docker-compose.yml",
+ "service": "app",
+ "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
+
+ "features": {
+ "ghcr.io/devcontainers/features/sshd:1": {}
+ },
+
+ "runServices": ["app", "db", "redis"],
+
+ "forwardPorts": [3000, 4000],
+
+ "portsAttributes": {
+ "3000": {
+ "label": "web",
+ "onAutoForward": "notify"
+ },
+ "4000": {
+ "label": "stream",
+ "onAutoForward": "silent"
+ }
+ },
+
+ "otherPortsAttributes": {
+ "onAutoForward": "silent"
+ },
+
+ "remoteEnv": {
+ "LOCAL_DOMAIN": "${localEnv:CODESPACE_NAME}-3000.app.github.dev",
+ "LOCAL_HTTPS": "true",
+ "STREAMING_API_BASE_URL": "https://${localEnv:CODESPACE_NAME}-4000.app.github.dev",
+ "DISABLE_FORGERY_REQUEST_PROTECTION": "true",
+ "ES_ENABLED": "",
+ "LIBRE_TRANSLATE_ENDPOINT": ""
+ },
+
+ "onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
+ "postCreateCommand": ".devcontainer/post-create.sh",
+ "waitFor": "postCreateCommand",
+
+ "customizations": {
+ "vscode": {
+ "settings": {},
+ "extensions": ["EditorConfig.EditorConfig", "webben.browserslist"]
+ }
+ }
+}
M .devcontainer/devcontainer.json => .devcontainer/devcontainer.json +16 -6
@@ 1,5 1,5 @@
{
- "name": "Mastodon",
+ "name": "Mastodon on local machine",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
@@ 8,13 8,23 @@
"ghcr.io/devcontainers/features/sshd:1": {}
},
- "runServices": ["app", "db", "redis"],
-
"forwardPorts": [3000, 4000],
- "containerEnv": {
- "ES_ENABLED": "",
- "LIBRE_TRANSLATE_ENDPOINT": ""
+ "portsAttributes": {
+ "3000": {
+ "label": "web",
+ "onAutoForward": "notify",
+ "requireLocalPort": true
+ },
+ "4000": {
+ "label": "stream",
+ "onAutoForward": "silent",
+ "requireLocalPort": true
+ }
+ },
+
+ "otherPortsAttributes": {
+ "onAutoForward": "silent"
},
"onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
M .devcontainer/docker-compose.yml => .devcontainer/docker-compose.yml +1 -0
@@ 25,6 25,7 @@ services:
command: sleep infinity
ports:
- '127.0.0.1:3000:3000'
+ - '127.0.0.1:3035:3035'
- '127.0.0.1:4000:4000'
networks:
- external_network
M Gemfile.lock => Gemfile.lock +4 -4
@@ 124,8 124,8 @@ GEM
attr_required (1.0.1)
awrence (1.2.1)
aws-eventstream (1.2.0)
- aws-partitions (1.793.0)
- aws-sdk-core (3.180.3)
+ aws-partitions (1.809.0)
+ aws-sdk-core (3.181.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
@@ 133,8 133,8 @@ GEM
aws-sdk-kms (1.71.0)
aws-sdk-core (~> 3, >= 3.177.0)
aws-sigv4 (~> 1.1)
- aws-sdk-s3 (1.132.1)
- aws-sdk-core (~> 3, >= 3.179.0)
+ aws-sdk-s3 (1.133.0)
+ aws-sdk-core (~> 3, >= 3.181.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.6)
aws-sigv4 (1.6.0)
M Procfile.dev => Procfile.dev +1 -1
@@ 1,4 1,4 @@
web: env PORT=3000 RAILS_ENV=development bundle exec puma -C config/puma.rb
sidekiq: env PORT=3000 RAILS_ENV=development bundle exec sidekiq
stream: env PORT=4000 yarn run start
-webpack: ./bin/webpack-dev-server --listen-host 0.0.0.0
+webpack: bin/webpack-dev-server
M app/controllers/concerns/signature_verification.rb => app/controllers/concerns/signature_verification.rb +2 -0
@@ 119,6 119,8 @@ module SignatureVerification
private
def fail_with!(message, **options)
+ Rails.logger.warn { "Signature verification failed: #{message}" }
+
@signature_verification_failure_reason = { error: message }.merge(options)
@signed_request_actor = nil
end
M config/environments/development.rb => config/environments/development.rb +2 -0
@@ 35,6 35,8 @@ Rails.application.configure do
config.cache_store = :null_store
end
+ config.action_controller.forgery_protection_origin_check = ENV['DISABLE_FORGERY_REQUEST_PROTECTION'].nil?
+
ActiveSupport::Logger.new(STDOUT).tap do |logger|
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
M config/webpacker.yml => config/webpacker.yml +1 -1
@@ 59,7 59,7 @@ development:
# Reference: https://webpack.js.org/configuration/dev-server/
dev_server:
https: false
- host: localhost
+ host: 0.0.0.0
port: 3035
public: localhost:3035
hmr: false
M yarn.lock => yarn.lock +3 -3
@@ 3349,9 3349,9 @@ axe-core@^4.6.2:
integrity sha512-zIURGIS1E1Q4pcrMjp+nnEh+16G56eG/MUllJH8yEvw7asDo7Ac9uhC9KIH5jzpITueEZolfYglnCGIuSBz39g==
axios@^1.4.0:
- version "1.4.0"
- resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f"
- integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/axios/-/axios-1.5.0.tgz#f02e4af823e2e46a9768cfc74691fdd0517ea267"
+ integrity sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"