mirror of
https://github.com/iv-org/invidious.git
synced 2024-10-01 01:35:38 -04:00
Remove dependency on ImageMagick (replace with rsvg-convert)
This commit is contained in:
parent
039cc30c07
commit
0f3c477ff3
@ -79,7 +79,7 @@ $ docker-compose build
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Arch Linux
|
# Arch Linux
|
||||||
$ sudo pacman -S shards crystal imagemagick librsvg postgresql
|
$ sudo pacman -S shards crystal librsvg postgresql
|
||||||
|
|
||||||
# Ubuntu or Debian
|
# Ubuntu or Debian
|
||||||
# First you have to add the repository to your APT configuration. For easy setup just run in your command line:
|
# First you have to add the repository to your APT configuration. For easy setup just run in your command line:
|
||||||
@ -88,7 +88,7 @@ $ curl -sSL https://dist.crystal-lang.org/apt/setup.sh | sudo bash
|
|||||||
$ curl -sL "https://keybase.io/crystal/pgp_keys.asc" | sudo apt-key add -
|
$ curl -sL "https://keybase.io/crystal/pgp_keys.asc" | sudo apt-key add -
|
||||||
$ echo "deb https://dist.crystal-lang.org/apt crystal main" | sudo tee /etc/apt/sources.list.d/crystal.list
|
$ echo "deb https://dist.crystal-lang.org/apt crystal main" | sudo tee /etc/apt/sources.list.d/crystal.list
|
||||||
$ sudo apt-get update
|
$ sudo apt-get update
|
||||||
$ sudo apt install crystal libssl-dev libxml2-dev libyaml-dev libgmp-dev libreadline-dev librsvg2-dev postgresql imagemagick libsqlite3-dev
|
$ sudo apt install crystal libssl-dev libxml2-dev libyaml-dev libgmp-dev libreadline-dev postgresql librsvg2-bin libsqlite3-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Add invidious user and clone repository
|
#### Add invidious user and clone repository
|
||||||
@ -143,7 +143,7 @@ $ sudo systemctl start invidious.service
|
|||||||
```bash
|
```bash
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
$ brew update
|
$ brew update
|
||||||
$ brew install shards crystal-lang postgres imagemagick librsvg
|
$ brew install shards crystal postgres imagemagick librsvg
|
||||||
|
|
||||||
# Clone repository and setup postgres database
|
# Clone repository and setup postgres database
|
||||||
$ git clone https://github.com/omarroth/invidious
|
$ git clone https://github.com/omarroth/invidious
|
||||||
|
@ -15,7 +15,7 @@ RUN crystal build --static --release --warnings all --error-on-warnings \
|
|||||||
./src/invidious.cr
|
./src/invidious.cr
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
RUN apk add --no-cache imagemagick ttf-opensans
|
RUN apk add --no-cache librsvg ttf-opensans
|
||||||
WORKDIR /invidious
|
WORKDIR /invidious
|
||||||
RUN addgroup -g 1000 -S invidious && \
|
RUN addgroup -g 1000 -S invidious && \
|
||||||
adduser -u 1000 -S invidious -G invidious
|
adduser -u 1000 -S invidious -G invidious
|
||||||
|
@ -195,7 +195,7 @@ def generate_captcha(key, db)
|
|||||||
end
|
end
|
||||||
|
|
||||||
clock_svg = <<-END_SVG
|
clock_svg = <<-END_SVG
|
||||||
<svg viewBox="0 0 100 100" width="200px">
|
<svg viewBox="0 0 100 100" width="200px" height="200px">
|
||||||
<circle cx="50" cy="50" r="45" fill="#eee" stroke="black" stroke-width="2"></circle>
|
<circle cx="50" cy="50" r="45" fill="#eee" stroke="black" stroke-width="2"></circle>
|
||||||
|
|
||||||
<text x="69" y="20.091" text-anchor="middle" fill="black" font-family="Arial" font-size="10px"> 1</text>
|
<text x="69" y="20.091" text-anchor="middle" fill="black" font-family="Arial" font-size="10px"> 1</text>
|
||||||
@ -219,7 +219,7 @@ def generate_captcha(key, db)
|
|||||||
END_SVG
|
END_SVG
|
||||||
|
|
||||||
image = ""
|
image = ""
|
||||||
convert = Process.run(%(convert -density 1200 -resize 400x400 -background none svg:- png:-), shell: true,
|
convert = Process.run(%(rsvg-convert -w 400 -h 400 -b none -f png), shell: true,
|
||||||
input: IO::Memory.new(clock_svg), output: Process::Redirect::Pipe) do |proc|
|
input: IO::Memory.new(clock_svg), output: Process::Redirect::Pipe) do |proc|
|
||||||
image = proc.output.gets_to_end
|
image = proc.output.gets_to_end
|
||||||
image = Base64.strict_encode(image)
|
image = Base64.strict_encode(image)
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
<% case captcha_type when %>
|
<% case captcha_type when %>
|
||||||
<% when "image" %>
|
<% when "image" %>
|
||||||
<% captcha = captcha.not_nil! %>
|
<% captcha = captcha.not_nil! %>
|
||||||
<img style="width:100%" src='<%= captcha[:question] %>'/>
|
<img style="width:50%" src='<%= captcha[:question] %>'/>
|
||||||
<% captcha[:tokens].each_with_index do |token, i| %>
|
<% captcha[:tokens].each_with_index do |token, i| %>
|
||||||
<input type="hidden" name="token[<%= i %>]" value="<%= URI.encode_www_form(token) %>">
|
<input type="hidden" name="token[<%= i %>]" value="<%= URI.encode_www_form(token) %>">
|
||||||
<% end %>
|
<% end %>
|
||||||
|
Loading…
Reference in New Issue
Block a user