Compare commits
78 Commits
ba185802ac
...
08f1fe29ff
Author | SHA1 | Date |
---|---|---|
|
08f1fe29ff | 9 months ago |
|
76aac746c4 | 9 months ago |
|
8d995f5806 | 9 months ago |
|
ff98d23ff8 | 9 months ago |
|
b7019ff600 | 9 months ago |
|
bfdb08af43 | 9 months ago |
|
98df72434d | 9 months ago |
|
296ab34942 | 9 months ago |
|
87a5125445 | 9 months ago |
|
9bc1ac5d1e | 9 months ago |
|
74b2e5bb8b | 9 months ago |
|
92d6e84d24 | 9 months ago |
|
0532b24e46 | 9 months ago |
|
bb7fd8a4f9 | 9 months ago |
|
23b2120378 | 9 months ago |
|
60c440843d | 9 months ago |
|
dfab6c8385 | 9 months ago |
|
c4f9a2c655 | 9 months ago |
|
367095d3e5 | 9 months ago |
|
ca17753927 | 9 months ago |
|
4e7bd71e0a | 9 months ago |
|
22644ac25f | 9 months ago |
|
5860a0b29e | 9 months ago |
|
f170023a21 | 9 months ago |
|
0aca2306c7 | 9 months ago |
|
f4e11f3530 | 9 months ago |
|
92c36b22f1 | 9 months ago |
|
9914df902f | 9 months ago |
![]() |
47f7c6ac74 | 9 months ago |
![]() |
a8958a77ea | 9 months ago |
![]() |
51e4d70862 | 9 months ago |
|
d68b0c3126 | 9 months ago |
|
b0d6c90d82 | 9 months ago |
|
b44e5e0dfc | 9 months ago |
|
e5caab3d95 | 9 months ago |
![]() |
44fc9c14cf | 9 months ago |
![]() |
7a50b1cf27 | 9 months ago |
|
4a24214fb7 | 9 months ago |
|
e10f055f03 | 9 months ago |
|
35eeddd0e0 | 9 months ago |
|
ae8db317a4 | 9 months ago |
|
df54c7eedf | 9 months ago |
|
98b6a31494 | 9 months ago |
|
7cc0242ae9 | 9 months ago |
|
e6a432fa71 | 9 months ago |
|
9ef5a2ebc2 | 9 months ago |
|
c55149ea3a | 9 months ago |
|
da61b24003 | 9 months ago |
|
40cbb1d529 | 9 months ago |
|
160fd09a45 | 9 months ago |
|
f81bcea990 | 9 months ago |
|
97d4222a6b | 9 months ago |
|
6ca618477f | 9 months ago |
|
f0942b8c6f | 9 months ago |
|
b4ece1c7da | 9 months ago |
|
c2bd3b92d3 | 9 months ago |
|
e3bdb944d5 | 9 months ago |
|
61657b935e | 9 months ago |
|
730e12eda3 | 9 months ago |
|
b9099b3e6e | 9 months ago |
|
8d18ef9120 | 9 months ago |
|
5e6f4f72c4 | 9 months ago |
|
d154b83a99 | 9 months ago |
|
b58d32cfe2 | 9 months ago |
![]() |
3f9b28ce26 | 9 months ago |
![]() |
70931fd687 | 9 months ago |
![]() |
8f06e2b4e7 | 9 months ago |
![]() |
34ea929f40 | 9 months ago |
![]() |
d314954093 | 9 months ago |
![]() |
1071e10ca4 | 9 months ago |
![]() |
0f43404d9e | 9 months ago |
![]() |
4d9e1fd255 | 9 months ago |
![]() |
2dac5ae167 | 9 months ago |
![]() |
8a786e02f8 | 9 months ago |
![]() |
db54a1d56d | 9 months ago |
![]() |
b6f7ea1fd3 | 9 months ago |
![]() |
6f76ca59a9 | 9 months ago |
![]() |
be00267084 | 9 months ago |
@ -1,22 +0,0 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which |
||||
# package ecosystems to update and where the package manifests are located. |
||||
# Please see the documentation for all configuration options: |
||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates |
||||
|
||||
version: 2 |
||||
updates: |
||||
- package-ecosystem: npm |
||||
directory: "/" |
||||
schedule: |
||||
interval: weekly |
||||
open-pull-requests-limit: 99 |
||||
allow: |
||||
- dependency-type: direct |
||||
|
||||
- package-ecosystem: bundler |
||||
directory: "/" |
||||
schedule: |
||||
interval: weekly |
||||
open-pull-requests-limit: 99 |
||||
allow: |
||||
- dependency-type: direct |
@ -0,0 +1,23 @@
|
||||
name: Build and Push Dev Image to Docker Hub |
||||
|
||||
on: |
||||
push: |
||||
branches: |
||||
- dev |
||||
|
||||
jobs: |
||||
docker-build: |
||||
runs-on: ubuntu-latest |
||||
|
||||
steps: |
||||
- name: 🔍 Checkout code |
||||
uses: actions/checkout@v2 |
||||
|
||||
- name: ⚓ Build and push Docker images |
||||
uses: docker/build-push-action@v1 |
||||
with: |
||||
username: ${{ secrets.DOCKER_USERNAME }} |
||||
password: ${{ secrets.DOCKER_PASSWORD }} |
||||
repository: mashirozx/mastodon |
||||
tag_with_ref: true |
||||
tag_with_sha: true |
@ -1,10 +1,29 @@
|
||||
# frozen_string_literal: true |
||||
|
||||
class Api::V1::CustomEmojisController < Api::BaseController |
||||
skip_before_action :set_cache_headers |
||||
|
||||
before_action :set_tags |
||||
|
||||
def index |
||||
expires_in 3.minutes, public: true |
||||
render_with_cache(each_serializer: REST::CustomEmojiSerializer) { CustomEmoji.listed.includes(:category) } |
||||
@tags = set_tags |
||||
# must cache in Nginx side, or should use original render_with_cache method |
||||
render json: @tags, each_serializer: REST::CustomEmojiSerializer |
||||
end |
||||
|
||||
private |
||||
|
||||
def custom_emojis_params |
||||
params.slice(:range).permit(:range) |
||||
end |
||||
|
||||
def set_tags |
||||
@range = custom_emojis_params[:range] |
||||
case @range |
||||
when 'all' |
||||
CustomEmoji.fullist.includes(:category) |
||||
when 'unlisted' |
||||
CustomEmoji.unlisted.includes(:category) |
||||
else |
||||
CustomEmoji.listed.includes(:category) |
||||
end |
||||
end |
||||
end |
||||
|
@ -0,0 +1,52 @@
|
||||
# frozen_string_literal: true |
||||
|
||||
class TranslateController < ApplicationController |
||||
before_action :authenticate_user! |
||||
|
||||
def create |
||||
|
||||
if !user_signed_in? |
||||
render json: { |
||||
'text' => I18n.t('errors.login_to_translate'), |
||||
} |
||||
return |
||||
end |
||||
|
||||
if !ENV['TRANSLATION_SERVER_HOST'] |
||||
render json: { |
||||
'text' => 'TRANSLATION_SERVER_HOST not found in ENV', |
||||
} |
||||
return |
||||
end |
||||
|
||||
endpoint = ENV['TRANSLATION_SERVER_HOST'] |
||||
|
||||
text = params[:data][:text] |
||||
to = params[:data][:to] |
||||
|
||||
if ENV['TRANSLATION_SERVER_TYPE'] == 'rsshub' |
||||
|
||||
to = 'zh-CN' if to == 'zh-cn' |
||||
to = 'zh-TW' if to == 'zh-tw' |
||||
sha = Digest::SHA1.hexdigest(text) |
||||
route = "/google/translate/#{to}/#{sha}/1/auto/#{ENV['TRANSLATION_SERVER_GOOGLE_DOMAIN'] || 'com.hk'}/.json" |
||||
text = URI::encode(text) |
||||
|
||||
resp = Faraday.get("#{endpoint}#{route}", { :text => text }) |
||||
res = ActiveSupport::JSON.decode(resp.body) |
||||
|
||||
respond = { |
||||
'text' => res['items'][0]['description'], |
||||
} |
||||
|
||||
render json: respond |
||||
|
||||
else |
||||
|
||||
resp = Faraday.post(endpoint, text: text, to: to) |
||||
render json: ActiveSupport::JSON.decode(resp.body) |
||||
|
||||
end |
||||
|
||||
end |
||||
end |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |