Skip to content

Commit

Permalink
Merge pull request #1946 from pooza/4_1_1
Browse files Browse the repository at this point in the history
4.1.1
  • Loading branch information
pooza committed Feb 9, 2021
2 parents 59d5060 + 68733be commit 87a17bc
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 14 deletions.
5 changes: 4 additions & 1 deletion Gemfile.lock
Expand Up @@ -208,6 +208,8 @@ GEM
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
nokogiri (1.11.1-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.11.1-x86_64-linux)
racc (~> 1.4)
nokogumbo (2.0.4)
Expand Down Expand Up @@ -338,6 +340,7 @@ GEM
zeitwerk (2.4.2)

PLATFORMS
x86_64-darwin-20
x86_64-freebsd-12
x86_64-linux

Expand Down Expand Up @@ -376,4 +379,4 @@ RUBY VERSION
ruby 3.0.0p0

BUNDLED WITH
2.2.4
2.2.9
6 changes: 4 additions & 2 deletions app/lib/mulukhiya/controller/mastodon_controller.rb
Expand Up @@ -18,9 +18,11 @@ class MastodonController < Controller
return @renderer.to_s
end

post '/api/v2/media' do
post %r{/api/v([12])/media} do
Event.new(:pre_upload, {reporter: @reporter, sns: @sns}).dispatch(params)
@reporter.response = @sns.upload(params[:file][:tempfile].path, {version: 2})
@reporter.response = @sns.upload(params[:file][:tempfile].path, {
version: params[:captures].first.to_i,
})
Event.new(:post_upload, {reporter: @reporter, sns: @sns}).dispatch(params)
@renderer.message = JSON.parse(@reporter.response.body)
@renderer.status = @reporter.response.code
Expand Down
4 changes: 2 additions & 2 deletions app/lib/mulukhiya/model/meisskey/hash_tag.rb
Expand Up @@ -48,7 +48,7 @@ def self.[](id)

def self.get(key)
return nil if key[:tag].nil?
return nil unless tag = collection.find(tag: key[:tag]).first
return nil unless tag = collection.find(tag: key[:tag].downcase).first
return HashTag.new(tag['_id'])
end

Expand All @@ -67,7 +67,7 @@ def notes(params = {})
{'$sort' => {'createdAt' => -1}},
{'$lookup' => {from: 'users', localField: 'userId', foreignField: '_id', as: 'user'}},
{'$match' => {
'tags' => name,
'tags' => name.downcase,
'visibility' => 'public',
'user._id' => {'$ne' => test_account._id},
}},
Expand Down
4 changes: 2 additions & 2 deletions app/lib/mulukhiya/model/misskey/hash_tag.rb
Expand Up @@ -21,8 +21,8 @@ def to_h
end

def self.get(key)
return HashTag.first(name: key[:tag]) if key.key?(:tag)
return HashTag.first(key)
return HashTag.first(name: key[:tag].downcase) if key.key?(:tag)
return HashTag.first(key.downcase)
end
end
end
Expand Down
1 change: 1 addition & 0 deletions app/query/mastodon/media_catalog.sql.erb
Expand Up @@ -18,6 +18,7 @@ FROM
WHERE (toots.local = true)
AND (toots.reblog_of_id IS null)
AND (toots.visibility < 2)
AND (toots.deleted_at IS null)
AND ((accounts.actor_type = 'Person') OR (accounts.actor_type IS null))
AND (accounts.silenced_at IS null)
AND (accounts.suspended_at IS null)
Expand Down
1 change: 1 addition & 0 deletions app/query/mastodon/recent_toot.sql.erb
Expand Up @@ -6,6 +6,7 @@ FROM
INNER JOIN accounts ON accounts.id = toots.account_id
INNER JOIN users ON users.account_id = accounts.id
WHERE (toots.visibility = 0)
AND (toots.deleted_at IS null)
AND (accounts.domain IS null)
AND (accounts.silenced_at IS null)
AND (accounts.suspended_at IS null)
Expand Down
1 change: 1 addition & 0 deletions app/query/mastodon/tag_timeline.sql.erb
Expand Up @@ -14,6 +14,7 @@ FROM
WHERE (statuses_tags.tag_id = '<%= params[:tag_id] %>')
AND (toots.reblog_of_id IS null)
AND (toots.visibility = 0)
AND (toots.deleted_at IS null)
<% if params[:local] %>
AND (toots.local = true)
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/query/misskey/tag_timeline.sql.erb
Expand Up @@ -10,7 +10,7 @@ SELECT
FROM
note
INNER JOIN "user" ON note."userId" = "user".id
WHERE ('<%= params[:tag] %>' = any(note.tags))
WHERE ('<%= params[:tag].downcase %>' = any(note.tags))
AND (note.visibility = 'public')
<% if params[:local] %>
AND ("user".host IS null)
Expand Down
4 changes: 1 addition & 3 deletions config/application.yaml
@@ -1,5 +1,5 @@
package:
version: 4.1.0
version: 4.1.1
url: https://github.com/pooza/mulukhiya-toot-proxy
description: 投稿内容の更新等を行うプロキシ。通称「モロヘイヤ」。
authors:
Expand Down Expand Up @@ -136,8 +136,6 @@ mastodon:
filter: true
annict: true
futured_tag: true
media_api:
version: null
dbms: postgres
parser: toot
handlers:
Expand Down
7 changes: 7 additions & 0 deletions config/schema/base.yaml
Expand Up @@ -88,6 +88,13 @@ properties:
items:
type: string
format: uri
mail:
type: object
required:
- to
properties:
to:
type: string
postgres:
type: object
required:
Expand Down
5 changes: 3 additions & 2 deletions views/config.slim
Expand Up @@ -20,8 +20,9 @@ html lang='ja'
textarea placeholder='タグ化する文字列を改行区切りで' v-model.trim='form.tags'
.inline-field-container
input class='short' placeholder='期限(分)' v-model.number='form.program.minutes'
.field-container
v-select :options='options.program' @input='onChangeTags' v-model='form.program.tags'
- if controller.livecure?
.field-container
v-select :options='options.program' @input='onChangeTags' v-model='form.program.tags'
.field-update-button-container
button @click='updateTags' 更新
section class='config' v-if='account.username && layout.sections.livecure'
Expand Down
2 changes: 1 addition & 1 deletion views/default.sass
Expand Up @@ -361,7 +361,7 @@ ul.medias
li.param
display: inline-block
margin:
right: 0.1em
right: 0.3em

nav.media
text:
Expand Down

0 comments on commit 87a17bc

Please sign in to comment.