mirror of
https://github.com/mastodon/mastodon.git
synced 2025-07-13 15:58:13 +00:00
Compare commits
3 Commits
80cd001e0a
...
521b433933
Author | SHA1 | Date | |
---|---|---|---|
![]() |
521b433933 | ||
![]() |
496c10542b | ||
![]() |
82be5d033f |
|
@ -1,20 +1,17 @@
|
||||||
# For details, see https://github.com/devcontainers/images/tree/main/src/ruby
|
# For details, see https://github.com/devcontainers/images/tree/main/src/ruby
|
||||||
FROM mcr.microsoft.com/devcontainers/ruby:1-3.3-bookworm
|
FROM mcr.microsoft.com/devcontainers/ruby:1-3.3-bookworm
|
||||||
|
|
||||||
# Install Rails
|
# Update existing node version, keep in sync with .nvmrc
|
||||||
# RUN gem install rails webdrivers
|
|
||||||
|
|
||||||
ARG NODE_VERSION="20"
|
ARG NODE_VERSION="20"
|
||||||
RUN . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1
|
RUN . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1
|
||||||
|
|
||||||
# [Optional] Uncomment this section to install additional OS packages.
|
# Install additional OS packages
|
||||||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
RUN apt-get update && \
|
||||||
&& apt-get -y install --no-install-recommends libicu-dev libidn11-dev ffmpeg imagemagick libvips42 libpam-dev
|
export DEBIAN_FRONTEND=noninteractive && \
|
||||||
|
apt-get -y install --no-install-recommends libicu-dev libidn11-dev ffmpeg imagemagick libvips42 libpam-dev
|
||||||
|
|
||||||
# [Optional] Uncomment this line to install additional gems.
|
# Install global node packages
|
||||||
RUN gem install foreman
|
|
||||||
|
|
||||||
# [Optional] Uncomment this line to install global node packages.
|
|
||||||
RUN . /usr/local/share/nvm/nvm.sh && corepack enable 2>&1
|
RUN . /usr/local/share/nvm/nvm.sh && corepack enable 2>&1
|
||||||
|
|
||||||
|
# Move welcome message to where VS Code expects it
|
||||||
COPY welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt
|
COPY welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Mastodon on GitHub Codespaces",
|
"name": "Mastodon on GitHub Codespaces",
|
||||||
"dockerComposeFile": "../docker-compose.yml",
|
"dockerComposeFile": "../compose.yaml",
|
||||||
"service": "app",
|
"service": "app",
|
||||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Mastodon on local machine",
|
"name": "Mastodon on local machine",
|
||||||
"dockerComposeFile": "docker-compose.yml",
|
"dockerComposeFile": "compose.yaml",
|
||||||
"service": "app",
|
"service": "app",
|
||||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
||||||
|
|
||||||
|
|
43
README.md
43
README.md
|
@ -102,26 +102,35 @@ To set up **MacOS** for native development, complete the following steps:
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
For production hosting and deployment with **Docker**, use the `Dockerfile` and
|
For production hosting and deployment with **Docker**, use the `Dockerfile` and
|
||||||
`docker-compose.yml` in the project root directory. To create a local
|
`docker-compose.yml` in the project root directory.
|
||||||
development environment with **Docker**, complete the following steps:
|
|
||||||
|
|
||||||
- Install Docker Desktop
|
For local development, install and launch [Docker], and run:
|
||||||
- Run `docker compose -f .devcontainer/docker-compose.yml up -d`
|
|
||||||
- Run `docker compose -f .devcontainer/docker-compose.yml exec app bin/setup`
|
|
||||||
- Finally, run `docker compose -f .devcontainer/docker-compose.yml exec app bin/dev`
|
|
||||||
|
|
||||||
If you are using an IDE with [support for the Development Container specification](https://containers.dev/supporting), it will run the above `docker compose` commands automatically. For **Visual Studio Code** this requires the [Dev Container extension](https://containers.dev/supporting#dev-containers).
|
```shell
|
||||||
|
docker compose -f .devcontainer/compose.yaml up -d
|
||||||
|
docker compose -f .devcontainer/compose.yaml exec app bin/setup
|
||||||
|
docker compose -f .devcontainer/compose.yaml exec app bin/dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dev Containers
|
||||||
|
|
||||||
|
Within IDEs that support the [Development Containers] specification, start the
|
||||||
|
"Mastodon on local machine" container from the editor. The necessary `docker
|
||||||
|
compose` commands to build and setup the container should run automatically. For
|
||||||
|
**Visual Studio Code** this requires installing the [Dev Container extension].
|
||||||
|
|
||||||
### GitHub Codespaces
|
### GitHub Codespaces
|
||||||
|
|
||||||
To get you coding in just a few minutes, GitHub Codespaces provides a web-based version of Visual Studio Code and a cloud-hosted development environment fully configured with the software needed for this project..
|
[GitHub Codespaces] provides a web-based version of VS Code and a cloud hosted
|
||||||
|
development environment configured with the software needed for this project.
|
||||||
|
|
||||||
- Click this button to create a new codespace:<br>
|
[][codespace]
|
||||||
[](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=52281283&devcontainer_path=.devcontainer%2Fcodespaces%2Fdevcontainer.json)
|
|
||||||
- Wait for the environment to build. This will take a few minutes.
|
- Click the button to create a new codespace, and confirm the options
|
||||||
- When the editor is ready, run `bin/dev` in the terminal.
|
- Wait for the environment to build (takes a few minutes)
|
||||||
- After a few seconds, a popup will appear with a button labeled _Open in Browser_. This will open Mastodon.
|
- When the editor is ready, run `bin/dev` in the terminal
|
||||||
- On the _Ports_ tab, right click on the “stream” row and select _Port visibility_ → _Public_.
|
- Wait for an _Open in Browser_ prompt. This will open Mastodon
|
||||||
|
- On the _Ports_ tab "stream" setting change _Port visibility_ → _Public_
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
@ -140,3 +149,9 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
[codespace]: https://codespaces.new/mastodon/mastodon?quickstart=1&devcontainer_path=.devcontainer%2Fcodespaces%2Fdevcontainer.json
|
||||||
|
[Dev Container extension]: https://containers.dev/supporting#dev-containers
|
||||||
|
[Development Containers]: https://containers.dev/supporting
|
||||||
|
[Docker]: https://docs.docker.com
|
||||||
|
[GitHub Codespaces]: https://docs.github.com/en/codespaces
|
||||||
|
|
|
@ -41,8 +41,8 @@ class VideoMetadataExtractor
|
||||||
@colorspace = video_stream[:pix_fmt]
|
@colorspace = video_stream[:pix_fmt]
|
||||||
@width = video_stream[:width]
|
@width = video_stream[:width]
|
||||||
@height = video_stream[:height]
|
@height = video_stream[:height]
|
||||||
@frame_rate = video_stream[:avg_frame_rate] == '0/0' ? nil : Rational(video_stream[:avg_frame_rate])
|
@frame_rate = parse_framerate(video_stream[:avg_frame_rate])
|
||||||
@r_frame_rate = video_stream[:r_frame_rate] == '0/0' ? nil : Rational(video_stream[:r_frame_rate])
|
@r_frame_rate = parse_framerate(video_stream[:r_frame_rate])
|
||||||
# For some video streams the frame_rate reported by `ffprobe` will be 0/0, but for these streams we
|
# For some video streams the frame_rate reported by `ffprobe` will be 0/0, but for these streams we
|
||||||
# should use `r_frame_rate` instead. Video screencast generated by Gnome Screencast have this issue.
|
# should use `r_frame_rate` instead. Video screencast generated by Gnome Screencast have this issue.
|
||||||
@frame_rate ||= @r_frame_rate
|
@frame_rate ||= @r_frame_rate
|
||||||
|
@ -55,4 +55,10 @@ class VideoMetadataExtractor
|
||||||
|
|
||||||
@invalid = true if @metadata.key?(:error)
|
@invalid = true if @metadata.key?(:error)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def parse_framerate(raw)
|
||||||
|
Rational(raw)
|
||||||
|
rescue ZeroDivisionError
|
||||||
|
nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,6 +12,8 @@ module Paperclip
|
||||||
attachment.instance.blurhash = Blurhash.encode(width, height, data, **(options[:blurhash] || {}))
|
attachment.instance.blurhash = Blurhash.encode(width, height, data, **(options[:blurhash] || {}))
|
||||||
|
|
||||||
@file
|
@file
|
||||||
|
rescue Vips::Error => e
|
||||||
|
raise Paperclip::Error, "Error while generating blurhash for #{@basename}: #{e}"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -69,6 +69,8 @@ module Paperclip
|
||||||
attachment.instance.file.instance_write(:meta, (attachment.instance.file.instance_read(:meta) || {}).merge(meta))
|
attachment.instance.file.instance_write(:meta, (attachment.instance.file.instance_read(:meta) || {}).merge(meta))
|
||||||
|
|
||||||
@file
|
@file
|
||||||
|
rescue Vips::Error => e
|
||||||
|
raise Paperclip::Error, "Error while extracting colors for #{@basename}: #{e}"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -68,7 +68,7 @@ module Paperclip
|
||||||
end
|
end
|
||||||
|
|
||||||
dst
|
dst
|
||||||
rescue Terrapin::ExitStatusError => e
|
rescue Vips::Error, Terrapin::ExitStatusError => e
|
||||||
raise Paperclip::Error, "Error while optimizing #{@basename}: #{e}"
|
raise Paperclip::Error, "Error while optimizing #{@basename}: #{e}"
|
||||||
rescue Terrapin::CommandNotFoundError
|
rescue Terrapin::CommandNotFoundError
|
||||||
raise Paperclip::Errors::CommandNotFoundError, 'Could not run the `ffmpeg` command. Please install ffmpeg.'
|
raise Paperclip::Errors::CommandNotFoundError, 'Could not run the `ffmpeg` command. Please install ffmpeg.'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user