Discourse 画像フィルター

このプラグインは、Google Cloud Vision API を使用して、フォーラムへの露骨な画像のアップロードを制限します。アバターやロゴなど、アップロードされたすべての画像を対象とします。

画像アップロードが制限された理由を説明するメッセージは、アップロードエラーのポップアップに表示されます。

許容される閾値は、サイト設定から設定できます。


セットアップ

手順:

  1. Google Cloud でサービスアカウントを作成します https://cloud.google.com/iam/docs/creating-managing-service-accounts
    Google が JSON ファイルのダウンロードを開始します。その内容を安全に保管してください。

  2. app.yml の env セクションの末尾に、以下の行を貼り付けてください。

     GOOGLE_ACCOUNT_TYPE: 'service_account'
     GOOGLE_CLIENT_ID: 'client-id-from-json-file'
     GOOGLE_CLIENT_EMAIL: "service-account-email-address"
     GOOGLE_PRIVATE_KEY:  以下参照
    
  • GOOGLE_PRIVATE_KEY パラメータの設定方法

    • JSON ファイル内のキーをコードエディタに貼り付けます。
    • find and replace(検索と置換)を使用して、\\n\\\\n に置換します。
    • 結果をコピーし、単一引用符 ' ' で囲んで app.yml の GOOGLE_PRIVATE_KEY の前に貼り付けます。
  1. プラグインのインストール手順を通常通り実行してください。

プラグイン設定

if_adult_max_acceptable: カテゴリ adult の許容される最大レベル
if_spoof_max_acceptable: カテゴリ spoof の許容される最大レベル
if_medical_max_acceptable: カテゴリ medical の許容される最大レベル
if_violence_max_acceptable: カテゴリ violence の許容される最大レベル
if_racy_max_acceptable: カテゴリ racy の許容される最大レベル

これらの基準や API 自体の詳細については、こちらをご覧ください Detect explicit content (SafeSearch)  |  Cloud Vision API  |  Google Cloud Documentation

\u003ca href=“GitHub - paviliondev/discourse-image-filter: A plugin to restrict uploading explicit content based on set criteria · GitHub” target=“_blank”\u003e:page_facing_up: コードを取得\u003c/a\u003e

\u003ca href=“Pavilion” target=“_blank”\u003e:raising_hand_woman: 機能リクエスト\u003c/a\u003e

\u003ca href=“Pavilion” target=“_blank”\u003e:bug: バグ報告\u003c/a\u003e

開発に関するメモ

macOS の開発環境で使用する場合、.bash_profile ファイルに以下の行を追加してください。
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

行き詰まりましたか?

  • プラグインのインストール方法がわからない場合は、こちらの手順 を Follow してください。
    \u003cbr\u003e

プラグインのスポンサーを務めてくださった @Terrapop さんに感謝します。

「いいね!」 22

@riking

アップロード時にアバターやロゴのアップロードで Rails 側の例外が発生した場合、アップロードエラーポップアップが表示されないことに気づいたため、この PR を作成しました。FIX: erroneous condition which would cause an error if ever satisfied by fzngagan · Pull Request #10605 · discourse/discourse · GitHub

コンポーザーからのアップロードでは問題なく動作します。これを上流に統合するのは良い変更だと思いました。

「いいね!」 6

ピンしてくれてありがとう、GitHub の通知を見逃していました。

「いいね!」 5

マージしていただき、本当にありがとうございます。Discourse と私のプラグインの両方に役立ちました。

「いいね!」 4

素晴らしい、@fzngagan さんのご協力に感謝します。この実現を可能にしてくださり、一緒に働けたことを光栄に思います。

COPPA(児童向けオンラインプライバシー保護法)の要件を満たす必要があるコミュニティ、AdSense の観点から安全を確保したいコミュニティ、あるいはどこにもグロテスクな画像やヌード画像を一切表示したくないコミュニティにとって、このプラグインは必須です。

「いいね!」 7

@Razcle
これはあなたに興味深いかもしれません

Faizaan さん、ありがとうございます!言語理解に特化し、カスタマイズ可能なものを作ろうかと思っていたのですが、そのような経験はありますか?

R

「いいね!」 3

@jahan_gagan は NLP について何かおっしゃるかもしれません。

「いいね!」 2

私は stackoverflow datasettags prediction を試みました。その後、同じコードを discourse dataset で試しましたが、discourse のデータ量が不足しているため、ここではそのコードは機能しませんでした。

「いいね!」 2

サービスアカウントに必要なスコープは何ですか。「認証スコープが不十分です」というエラーが表示されます。

これでお手伝いできるでしょうか?完全にクライアント側で実行されます

テキスト毒性モデル

このプラグインはテキストではなく、画像に関するものです。

テキストについては、Jigsaw エンジンに基づく Google Perspective プラグインが利用可能です。

「いいね!」 2

こんにちは :waving_hand: このプラグインはまだ動作しますか? 最後のコミットは約4年前だったのですが。 よろしくお願いいたします :slightly_smiling_face:

「いいね!」 1

テストインスタンスにインストールしようとしましたが、gemの問題があるようです。再構築に失敗しました。修正可能であることを願っています。:crossed_fingers: これらのgemは廃止されただけかもしれません…

rake aborted!

Gem::LoadError: can't activate google-protobuf-3.13.0-x86_64-linux, already activated google-protobuf-4.27.3-x86_64-linux (Gem::LoadError)

/var/www/discourse/lib/plugin_gem.rb:25:in `load'

/var/www/discourse/lib/plugin/instance.rb:835:in `gem'

/var/www/discourse/plugins/discourse-image-filter/plugin.rb:12:in `activate!'

/var/www/discourse/lib/plugin/instance.rb:778:in `instance_eval'

/var/www/discourse/lib/plugin/instance.rb:778:in `activate!'

/var/www/discourse/lib/discourse.rb:348:in `block in activate_plugins!'

/var/www/discourse/lib/discourse.rb:345:in `each'

/var/www/discourse/lib/discourse.rb:345:in `activate_plugins!'

/var/www/discourse/config/application.rb:231:in `block in <class:Application>'

/var/www/discourse/lib/plugin.rb:6:in `initialization_guard'

/var/www/discourse/config/application.rb:231:in `<class:Application>'

/var/www/discourse/config/application.rb:75:in `<module:Discourse>'

/var/www/discourse/config/application.rb:74:in `<top (required)>'

/var/www/discourse/Rakefile:7:in `<top (required)>'

/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'

/usr/local/bin/bundle:25:in `load'

/usr/local/bin/bundle:25:in `<main>'

(See full trace by running task with --trace)

I, [2024-08-02T16:48:02.872895 #1] INFO -- : gem install os -v 1.1.1 -i /var/www/discourse/plugins/discourse-image-filter/gems/3.3.3 --no-document --ignore-dependencies --no-user-install

Successfully installed os-1.1.1

1 gem installed

gem install google-protobuf -v 3.13.0 -i /var/www/discourse/plugins/discourse-image-filter/gems/3.3.3 --no-document --ignore-dependencies --no-user-install

Successfully installed google-protobuf-3.13.0-x86_64-linux

1 gem installed

I, [2024-08-02T16:48:02.886926 #1] INFO -- : Terminating async processes

I, [2024-08-02T16:48:02.888160 #1] INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 36

I, [2024-08-02T16:48:02.888588 #1] INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 98

2024-08-02 16:48:02.888 UTC [36] LOG: received fast shutdown request

98:signal-handler (1722617282) Received SIGTERM scheduling shutdown...

2024-08-02 16:48:02.892 UTC [36] LOG: aborting any active transactions

98:M 02 Aug 2024 16:48:02.896 # User requested shutdown...

98:M 02 Aug 2024 16:48:02.897 * Saving the final RDB snapshot before exiting.

2024-08-02 16:48:02.906 UTC [36] LOG: background worker "logical replication launcher" (PID 51) exited with exit code 1

2024-08-02 16:48:02.909 UTC [46] LOG: shutting down

98:M 02 Aug 2024 16:48:02.939 * DB saved on disk

98:M 02 Aug 2024 16:48:02.939 # Redis is now ready to exit, bye bye...

2024-08-02 16:48:02.949 UTC [36] LOG: database system is shut down

FAILED

--------------------

Pups::ExecError: cd /var/www/discourse &amp;&amp; su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 571 exit 1>

Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'

exec failed with the params {"cd"=>"$home", "tag"=>"migrate", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}

bootstrap failed with exit code 1

** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.

./discourse-doctor may help diagnose the problem.

9213a43b80e800c6f2b1d0adc0663ec82a483b860f0302b8ebabc8a3b2bb0619

これを#brokenとしてタグ付けしました。

「いいね!」 2