mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-16 09:18:46 +00:00
Compare commits
3 Commits
no-spin
...
feature/ex
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8375ed1cfd | ||
|
|
3d80ba01d7 | ||
|
|
f02150468b |
30
.env.nanobox
30
.env.nanobox
@@ -35,17 +35,6 @@ PAPERCLIP_SECRET=$PAPERCLIP_SECRET
|
|||||||
SECRET_KEY_BASE=$SECRET_KEY_BASE
|
SECRET_KEY_BASE=$SECRET_KEY_BASE
|
||||||
OTP_SECRET=$OTP_SECRET
|
OTP_SECRET=$OTP_SECRET
|
||||||
|
|
||||||
# VAPID keys (used for push notifications)
|
|
||||||
# You can generate the keys using the following command (first is the private key, second is the public one)
|
|
||||||
# You should only generate this once per instance. If you later decide to change it, all push subscription will
|
|
||||||
# be invalidated, requiring the users to access the website again to resubscribe.
|
|
||||||
#
|
|
||||||
# Generate with `rake mastodon:webpush:generate_vapid_key` task (`nanobox run bundle exec rake mastodon:webpush:generate_vapid_key`)
|
|
||||||
#
|
|
||||||
# For more information visit https://rossta.net/blog/using-the-web-push-api-with-vapid.html
|
|
||||||
VAPID_PRIVATE_KEY=$VAPID_PRIVATE_KEY
|
|
||||||
VAPID_PUBLIC_KEY=$VAPID_PUBLIC_KEY
|
|
||||||
|
|
||||||
# Registrations
|
# Registrations
|
||||||
# Single user mode will disable registrations and redirect frontpage to the first profile
|
# Single user mode will disable registrations and redirect frontpage to the first profile
|
||||||
# SINGLE_USER_MODE=true
|
# SINGLE_USER_MODE=true
|
||||||
@@ -73,7 +62,7 @@ SMTP_FROM_ADDRESS=notifications@${APP_NAME}.nanoapp.io
|
|||||||
#SMTP_CA_FILE=/etc/ssl/certs/ca-certificates.crt
|
#SMTP_CA_FILE=/etc/ssl/certs/ca-certificates.crt
|
||||||
#SMTP_OPENSSL_VERIFY_MODE=peer
|
#SMTP_OPENSSL_VERIFY_MODE=peer
|
||||||
#SMTP_ENABLE_STARTTLS_AUTO=true
|
#SMTP_ENABLE_STARTTLS_AUTO=true
|
||||||
#SMTP_TLS=true
|
|
||||||
|
|
||||||
# Optional user upload path and URL (images, avatars). Default is :rails_root/public/system. If you set this variable, you are responsible for making your HTTP server (eg. nginx) serve these files.
|
# Optional user upload path and URL (images, avatars). Default is :rails_root/public/system. If you set this variable, you are responsible for making your HTTP server (eg. nginx) serve these files.
|
||||||
# PAPERCLIP_ROOT_PATH=/var/lib/mastodon/public-system
|
# PAPERCLIP_ROOT_PATH=/var/lib/mastodon/public-system
|
||||||
@@ -102,23 +91,6 @@ SMTP_FROM_ADDRESS=notifications@${APP_NAME}.nanoapp.io
|
|||||||
# S3_ENDPOINT=
|
# S3_ENDPOINT=
|
||||||
# S3_SIGNATURE_VERSION=
|
# S3_SIGNATURE_VERSION=
|
||||||
|
|
||||||
# Swift (optional)
|
|
||||||
# SWIFT_ENABLED=true
|
|
||||||
# SWIFT_USERNAME=
|
|
||||||
# For Keystone V3, the value for SWIFT_TENANT should be the project name
|
|
||||||
# SWIFT_TENANT=
|
|
||||||
# SWIFT_PASSWORD=
|
|
||||||
# Keystone V2 and V3 URLs are supported. Use a V3 URL if possible to avoid
|
|
||||||
# issues with token rate-limiting during high load.
|
|
||||||
# SWIFT_AUTH_URL=
|
|
||||||
# SWIFT_CONTAINER=
|
|
||||||
# SWIFT_OBJECT_URL=
|
|
||||||
# SWIFT_REGION=
|
|
||||||
# Defaults to 'default'
|
|
||||||
# SWIFT_DOMAIN_NAME=
|
|
||||||
# Defaults to 60 seconds. Set to 0 to disable
|
|
||||||
# SWIFT_CACHE_TTL=
|
|
||||||
|
|
||||||
# Optional alias for S3 if you want to use Cloudfront or Cloudflare in front
|
# Optional alias for S3 if you want to use Cloudfront or Cloudflare in front
|
||||||
# S3_CLOUDFRONT_HOST=
|
# S3_CLOUDFRONT_HOST=
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
# Service dependencies
|
# Service dependencies
|
||||||
# You may set REDIS_URL instead for more advanced options
|
# You may set REDIS_URL instead for more advanced options
|
||||||
# You may also set REDIS_NAMESPACE to share Redis between multiple Mastodon servers
|
|
||||||
REDIS_HOST=redis
|
REDIS_HOST=redis
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
# You may set DATABASE_URL instead for more advanced options
|
# You may set DATABASE_URL instead for more advanced options
|
||||||
@@ -102,19 +101,11 @@ SMTP_FROM_ADDRESS=notifications@example.com
|
|||||||
# Swift (optional)
|
# Swift (optional)
|
||||||
# SWIFT_ENABLED=true
|
# SWIFT_ENABLED=true
|
||||||
# SWIFT_USERNAME=
|
# SWIFT_USERNAME=
|
||||||
# For Keystone V3, the value for SWIFT_TENANT should be the project name
|
|
||||||
# SWIFT_TENANT=
|
# SWIFT_TENANT=
|
||||||
# SWIFT_PASSWORD=
|
# SWIFT_PASSWORD=
|
||||||
# Keystone V2 and V3 URLs are supported. Use a V3 URL if possible to avoid
|
|
||||||
# issues with token rate-limiting during high load.
|
|
||||||
# SWIFT_AUTH_URL=
|
# SWIFT_AUTH_URL=
|
||||||
# SWIFT_CONTAINER=
|
# SWIFT_CONTAINER=
|
||||||
# SWIFT_OBJECT_URL=
|
# SWIFT_OBJECT_URL=
|
||||||
# SWIFT_REGION=
|
|
||||||
# Defaults to 'default'
|
|
||||||
# SWIFT_DOMAIN_NAME=
|
|
||||||
# Defaults to 60 seconds. Set to 0 to disable
|
|
||||||
# SWIFT_CACHE_TTL=
|
|
||||||
|
|
||||||
# Optional alias for S3 if you want to use Cloudfront or Cloudflare in front
|
# Optional alias for S3 if you want to use Cloudfront or Cloudflare in front
|
||||||
# S3_CLOUDFRONT_HOST=
|
# S3_CLOUDFRONT_HOST=
|
||||||
|
|||||||
@@ -5,14 +5,12 @@ env:
|
|||||||
browser: true
|
browser: true
|
||||||
node: true
|
node: true
|
||||||
es6: true
|
es6: true
|
||||||
jest: true
|
|
||||||
|
|
||||||
parser: babel-eslint
|
parser: babel-eslint
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
- react
|
- react
|
||||||
- jsx-a11y
|
- jsx-a11y
|
||||||
- import
|
|
||||||
|
|
||||||
parserOptions:
|
parserOptions:
|
||||||
sourceType: module
|
sourceType: module
|
||||||
@@ -23,19 +21,8 @@ parserOptions:
|
|||||||
modules: true
|
modules: true
|
||||||
spread: true
|
spread: true
|
||||||
|
|
||||||
settings:
|
|
||||||
import/extensions:
|
|
||||||
- .js
|
|
||||||
import/ignore:
|
|
||||||
- node_modules
|
|
||||||
- \\.(css|scss|json)$
|
|
||||||
import/resolver:
|
|
||||||
node:
|
|
||||||
moduleDirectory:
|
|
||||||
- node_modules
|
|
||||||
- app/javascript
|
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
|
|
||||||
brace-style: warn
|
brace-style: warn
|
||||||
comma-dangle:
|
comma-dangle:
|
||||||
- error
|
- error
|
||||||
@@ -138,17 +125,3 @@ rules:
|
|||||||
jsx-a11y/role-supports-aria-props: off
|
jsx-a11y/role-supports-aria-props: off
|
||||||
jsx-a11y/scope: warn
|
jsx-a11y/scope: warn
|
||||||
jsx-a11y/tabindex-no-positive: warn
|
jsx-a11y/tabindex-no-positive: warn
|
||||||
|
|
||||||
import/extensions:
|
|
||||||
- error
|
|
||||||
- always
|
|
||||||
- js: never
|
|
||||||
import/newline-after-import: error
|
|
||||||
import/no-extraneous-dependencies:
|
|
||||||
- error
|
|
||||||
- devDependencies:
|
|
||||||
- "config/webpack/**"
|
|
||||||
- "app/javascript/mastodon/test_setup.js"
|
|
||||||
- "app/javascript/**/__tests__/**"
|
|
||||||
import/no-unresolved: error
|
|
||||||
import/no-webpack-loader-syntax: error
|
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "app/javascript/themes/mastodon-go"]
|
|
||||||
path = app/javascript/themes/mastodon-go
|
|
||||||
url = https://github.com/marrus-sh/mastodon-go
|
|
||||||
@@ -1 +1 @@
|
|||||||
2.4.2
|
2.4.1
|
||||||
|
|||||||
@@ -26,16 +26,18 @@ addons:
|
|||||||
postgresql: 9.4
|
postgresql: 9.4
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
- trusty-media
|
- trusty-media
|
||||||
packages:
|
packages:
|
||||||
- ffmpeg
|
- ffmpeg
|
||||||
|
- g++-6
|
||||||
- libprotobuf-dev
|
- libprotobuf-dev
|
||||||
- protobuf-compiler
|
- protobuf-compiler
|
||||||
- libicu-dev
|
- libicu-dev
|
||||||
|
|
||||||
rvm:
|
rvm:
|
||||||
- 2.3.4
|
- 2.3.4
|
||||||
- 2.4.2
|
- 2.4.1
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- redis-server
|
- redis-server
|
||||||
@@ -53,5 +55,5 @@ before_script:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
- travis_retry bundle exec parallel_test spec/ --group-by filesize --type rspec
|
- travis_retry bundle exec parallel_test spec/ --group-by filesize --type rspec
|
||||||
- yarn test
|
- npm test
|
||||||
- bundle exec i18n-tasks check-normalized && bundle exec i18n-tasks unused
|
- bundle exec i18n-tasks unused
|
||||||
|
|||||||
46
.yarnclean
46
.yarnclean
@@ -1,46 +0,0 @@
|
|||||||
# test directories
|
|
||||||
__tests__
|
|
||||||
test
|
|
||||||
tests
|
|
||||||
powered-test
|
|
||||||
|
|
||||||
# asset directories
|
|
||||||
docs
|
|
||||||
doc
|
|
||||||
website
|
|
||||||
images
|
|
||||||
# assets
|
|
||||||
|
|
||||||
# examples
|
|
||||||
example
|
|
||||||
examples
|
|
||||||
|
|
||||||
# code coverage directories
|
|
||||||
coverage
|
|
||||||
.nyc_output
|
|
||||||
|
|
||||||
# build scripts
|
|
||||||
Makefile
|
|
||||||
Gulpfile.js
|
|
||||||
Gruntfile.js
|
|
||||||
|
|
||||||
# configs
|
|
||||||
.tern-project
|
|
||||||
.gitattributes
|
|
||||||
.editorconfig
|
|
||||||
.*ignore
|
|
||||||
.eslintrc
|
|
||||||
.jshintrc
|
|
||||||
.flowconfig
|
|
||||||
.documentup.json
|
|
||||||
.yarn-metadata.json
|
|
||||||
.*.yml
|
|
||||||
*.yml
|
|
||||||
|
|
||||||
# misc
|
|
||||||
*.gz
|
|
||||||
*.md
|
|
||||||
|
|
||||||
# for specific ignore
|
|
||||||
!.svgo.yml
|
|
||||||
|
|
||||||
1
Aptfile
1
Aptfile
@@ -1,5 +1,4 @@
|
|||||||
ffmpeg
|
ffmpeg
|
||||||
libicu[0-9][0-9]
|
|
||||||
libicu-dev
|
libicu-dev
|
||||||
libidn11
|
libidn11
|
||||||
libidn11-dev
|
libidn11-dev
|
||||||
|
|||||||
17
CODEOWNERS
17
CODEOWNERS
@@ -8,25 +8,8 @@
|
|||||||
# /config/locales/*.fr.yml @żelipapą
|
# /config/locales/*.fr.yml @żelipapą
|
||||||
# /config/locales/fr.yml @żelipapą
|
# /config/locales/fr.yml @żelipapą
|
||||||
|
|
||||||
# Polish
|
|
||||||
/app/javascript/mastodon/locales/pl.json @m4sk1n
|
/app/javascript/mastodon/locales/pl.json @m4sk1n
|
||||||
/app/views/user_mailer/*.pl.html.erb @m4sk1n
|
/app/views/user_mailer/*.pl.html.erb @m4sk1n
|
||||||
/app/views/user_mailer/*.pl.text.erb @m4sk1n
|
/app/views/user_mailer/*.pl.text.erb @m4sk1n
|
||||||
/config/locales/*.pl.yml @m4sk1n
|
/config/locales/*.pl.yml @m4sk1n
|
||||||
/config/locales/pl.yml @m4sk1n
|
/config/locales/pl.yml @m4sk1n
|
||||||
|
|
||||||
# French
|
|
||||||
/app/javascript/mastodon/locales/fr.json @aldarone
|
|
||||||
/app/javascript/mastodon/locales/whitelist_fr.json @aldarone
|
|
||||||
/app/views/user_mailer/*.fr.html.erb @aldarone
|
|
||||||
/app/views/user_mailer/*.fr.text.erb @aldarone
|
|
||||||
/config/locales/*.fr.yml @aldarone
|
|
||||||
/config/locales/fr.yml @aldarone
|
|
||||||
|
|
||||||
# Dutch
|
|
||||||
/app/javascript/mastodon/locales/nl.json @jeroenpraat
|
|
||||||
/app/javascript/mastodon/locales/whitelist_nl.json @jeroenpraat
|
|
||||||
/app/views/user_mailer/*.nl.html.erb @jeroenpraat
|
|
||||||
/app/views/user_mailer/*.nl.text.erb @jeroenpraat
|
|
||||||
/config/locales/*.nl.yml @jeroenpraat
|
|
||||||
/config/locales/nl.yml @jeroenpraat
|
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
# Contributor Covenant Code of Conduct
|
|
||||||
|
|
||||||
## Our Pledge
|
|
||||||
|
|
||||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
||||||
|
|
||||||
## Our Standards
|
|
||||||
|
|
||||||
Examples of behavior that contributes to creating a positive environment include:
|
|
||||||
|
|
||||||
* Using welcoming and inclusive language
|
|
||||||
* Being respectful of differing viewpoints and experiences
|
|
||||||
* Gracefully accepting constructive criticism
|
|
||||||
* Focusing on what is best for the community
|
|
||||||
* Showing empathy towards other community members
|
|
||||||
|
|
||||||
Examples of unacceptable behavior by participants include:
|
|
||||||
|
|
||||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
|
||||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
||||||
* Public or private harassment
|
|
||||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
|
||||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
||||||
|
|
||||||
## Our Responsibilities
|
|
||||||
|
|
||||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
|
||||||
|
|
||||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
|
||||||
|
|
||||||
## Scope
|
|
||||||
|
|
||||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
|
||||||
|
|
||||||
## Enforcement
|
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at eugen@zeonfederated.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
|
||||||
|
|
||||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
|
||||||
|
|
||||||
## Attribution
|
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
|
||||||
|
|
||||||
[homepage]: http://contributor-covenant.org
|
|
||||||
[version]: http://contributor-covenant.org/version/1/4/
|
|
||||||
21
Dockerfile
21
Dockerfile
@@ -1,4 +1,4 @@
|
|||||||
FROM ruby:2.4.2-alpine3.6
|
FROM ruby:2.4.1-alpine3.6
|
||||||
|
|
||||||
LABEL maintainer="https://github.com/tootsuite/mastodon" \
|
LABEL maintainer="https://github.com/tootsuite/mastodon" \
|
||||||
description="A GNU Social-compatible microblogging server"
|
description="A GNU Social-compatible microblogging server"
|
||||||
@@ -7,8 +7,6 @@ ENV UID=991 GID=991 \
|
|||||||
RAILS_SERVE_STATIC_FILES=true \
|
RAILS_SERVE_STATIC_FILES=true \
|
||||||
RAILS_ENV=production NODE_ENV=production
|
RAILS_ENV=production NODE_ENV=production
|
||||||
|
|
||||||
ARG YARN_VERSION=1.1.0
|
|
||||||
ARG YARN_DOWNLOAD_SHA256=171c1f9ee93c488c0d774ac6e9c72649047c3f896277d88d0f805266519430f3
|
|
||||||
ARG LIBICONV_VERSION=1.15
|
ARG LIBICONV_VERSION=1.15
|
||||||
ARG LIBICONV_DOWNLOAD_SHA256=ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178
|
ARG LIBICONV_DOWNLOAD_SHA256=ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178
|
||||||
|
|
||||||
@@ -21,7 +19,6 @@ RUN apk -U upgrade \
|
|||||||
build-base \
|
build-base \
|
||||||
icu-dev \
|
icu-dev \
|
||||||
libidn-dev \
|
libidn-dev \
|
||||||
libressl \
|
|
||||||
libtool \
|
libtool \
|
||||||
postgresql-dev \
|
postgresql-dev \
|
||||||
protobuf-dev \
|
protobuf-dev \
|
||||||
@@ -35,21 +32,16 @@ RUN apk -U upgrade \
|
|||||||
imagemagick \
|
imagemagick \
|
||||||
libidn \
|
libidn \
|
||||||
libpq \
|
libpq \
|
||||||
nodejs \
|
|
||||||
nodejs-npm \
|
nodejs-npm \
|
||||||
|
nodejs \
|
||||||
protobuf \
|
protobuf \
|
||||||
su-exec \
|
su-exec \
|
||||||
tini \
|
tini \
|
||||||
|
yarn \
|
||||||
&& update-ca-certificates \
|
&& update-ca-certificates \
|
||||||
&& mkdir -p /tmp/src /opt \
|
|
||||||
&& wget -O yarn.tar.gz "https://github.com/yarnpkg/yarn/releases/download/v$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
|
|
||||||
&& echo "$YARN_DOWNLOAD_SHA256 *yarn.tar.gz" | sha256sum -c - \
|
|
||||||
&& tar -xzf yarn.tar.gz -C /tmp/src \
|
|
||||||
&& rm yarn.tar.gz \
|
|
||||||
&& mv /tmp/src/yarn-v$YARN_VERSION /opt/yarn \
|
|
||||||
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
|
|
||||||
&& wget -O libiconv.tar.gz "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$LIBICONV_VERSION.tar.gz" \
|
&& wget -O libiconv.tar.gz "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$LIBICONV_VERSION.tar.gz" \
|
||||||
&& echo "$LIBICONV_DOWNLOAD_SHA256 *libiconv.tar.gz" | sha256sum -c - \
|
&& echo "$LIBICONV_DOWNLOAD_SHA256 *libiconv.tar.gz" | sha256sum -c - \
|
||||||
|
&& mkdir -p /tmp/src \
|
||||||
&& tar -xzf libiconv.tar.gz -C /tmp/src \
|
&& tar -xzf libiconv.tar.gz -C /tmp/src \
|
||||||
&& rm libiconv.tar.gz \
|
&& rm libiconv.tar.gz \
|
||||||
&& cd /tmp/src/libiconv-$LIBICONV_VERSION \
|
&& cd /tmp/src/libiconv-$LIBICONV_VERSION \
|
||||||
@@ -60,12 +52,11 @@ RUN apk -U upgrade \
|
|||||||
&& cd /mastodon \
|
&& cd /mastodon \
|
||||||
&& rm -rf /tmp/* /var/cache/apk/*
|
&& rm -rf /tmp/* /var/cache/apk/*
|
||||||
|
|
||||||
COPY Gemfile Gemfile.lock package.json yarn.lock .yarnclean /mastodon/
|
COPY Gemfile Gemfile.lock package.json yarn.lock /mastodon/
|
||||||
|
|
||||||
RUN bundle config build.nokogiri --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include \
|
RUN bundle config build.nokogiri --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include \
|
||||||
&& bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without test development \
|
&& bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without test development \
|
||||||
&& yarn --pure-lockfile \
|
&& yarn --ignore-optional --pure-lockfile
|
||||||
&& yarn cache clean
|
|
||||||
|
|
||||||
COPY . /mastodon
|
COPY . /mastodon
|
||||||
|
|
||||||
|
|||||||
47
Gemfile
47
Gemfile
@@ -5,8 +5,8 @@ ruby '>= 2.3.0', '< 2.5.0'
|
|||||||
|
|
||||||
gem 'pkg-config', '~> 1.2'
|
gem 'pkg-config', '~> 1.2'
|
||||||
|
|
||||||
gem 'puma', '~> 3.10'
|
gem 'puma', '~> 3.8'
|
||||||
gem 'rails', '~> 5.1.4'
|
gem 'rails', '~> 5.1.0'
|
||||||
gem 'uglifier', '~> 3.2'
|
gem 'uglifier', '~> 3.2'
|
||||||
|
|
||||||
gem 'hamlit-rails', '~> 0.2'
|
gem 'hamlit-rails', '~> 0.2'
|
||||||
@@ -14,10 +14,8 @@ gem 'pg', '~> 0.20'
|
|||||||
gem 'pghero', '~> 1.7'
|
gem 'pghero', '~> 1.7'
|
||||||
gem 'dotenv-rails', '~> 2.2'
|
gem 'dotenv-rails', '~> 2.2'
|
||||||
|
|
||||||
gem 'fog-aws', '~> 1.4', require: false
|
gem 'aws-sdk', '~> 2.9'
|
||||||
gem 'fog-core', '~> 1.45'
|
gem 'fog-openstack', '~> 0.1'
|
||||||
gem 'fog-local', '~> 0.4', require: false
|
|
||||||
gem 'fog-openstack', '~> 0.1', require: false
|
|
||||||
gem 'paperclip', '~> 5.1'
|
gem 'paperclip', '~> 5.1'
|
||||||
gem 'paperclip-av-transcoder', '~> 0.6'
|
gem 'paperclip-av-transcoder', '~> 0.6'
|
||||||
|
|
||||||
@@ -27,7 +25,7 @@ gem 'bootsnap'
|
|||||||
gem 'browser'
|
gem 'browser'
|
||||||
gem 'charlock_holmes', '~> 0.7.5'
|
gem 'charlock_holmes', '~> 0.7.5'
|
||||||
gem 'iso-639'
|
gem 'iso-639'
|
||||||
gem 'cld3', '~> 3.2.0'
|
gem 'cld3', '~> 3.1'
|
||||||
gem 'devise', '~> 4.2'
|
gem 'devise', '~> 4.2'
|
||||||
gem 'devise-two-factor', '~> 3.0'
|
gem 'devise-two-factor', '~> 3.0'
|
||||||
gem 'doorkeeper', '~> 4.2'
|
gem 'doorkeeper', '~> 4.2'
|
||||||
@@ -40,14 +38,13 @@ gem 'http', '~> 2.2'
|
|||||||
gem 'http_accept_language', '~> 2.1'
|
gem 'http_accept_language', '~> 2.1'
|
||||||
gem 'httplog', '~> 0.99'
|
gem 'httplog', '~> 0.99'
|
||||||
gem 'idn-ruby', require: 'idn'
|
gem 'idn-ruby', require: 'idn'
|
||||||
gem 'kaminari', '~> 1.1'
|
gem 'kaminari', '~> 1.0'
|
||||||
gem 'link_header', '~> 0.0'
|
gem 'link_header', '~> 0.0'
|
||||||
gem 'mime-types', '~> 3.1'
|
gem 'mime-types', '~> 3.1'
|
||||||
gem 'nokogiri', '~> 1.8'
|
gem 'nokogiri', '~> 1.7'
|
||||||
gem 'nsa', '~> 0.2'
|
gem 'oj', '~> 3.0'
|
||||||
gem 'oj', '~> 3.3'
|
|
||||||
gem 'ostatus2', '~> 2.0'
|
gem 'ostatus2', '~> 2.0'
|
||||||
gem 'ox', '~> 2.8'
|
gem 'ox', '~> 2.5'
|
||||||
gem 'pundit', '~> 1.1'
|
gem 'pundit', '~> 1.1'
|
||||||
gem 'rabl', '~> 0.13'
|
gem 'rabl', '~> 0.13'
|
||||||
gem 'rack-attack', '~> 5.0'
|
gem 'rack-attack', '~> 5.0'
|
||||||
@@ -67,25 +64,25 @@ gem 'sidekiq-bulk', '~>0.1.1'
|
|||||||
gem 'simple-navigation', '~> 4.0'
|
gem 'simple-navigation', '~> 4.0'
|
||||||
gem 'simple_form', '~> 3.4'
|
gem 'simple_form', '~> 3.4'
|
||||||
gem 'sprockets-rails', '~> 3.2', require: 'sprockets/railtie'
|
gem 'sprockets-rails', '~> 3.2', require: 'sprockets/railtie'
|
||||||
gem 'strong_migrations'
|
gem 'statsd-instrument', '~> 2.1'
|
||||||
gem 'twitter-text', '~> 1.14'
|
gem 'twitter-text', '~> 1.14'
|
||||||
gem 'tzinfo-data', '~> 1.2017'
|
gem 'tzinfo-data', '~> 1.2017'
|
||||||
gem 'webpacker', '~> 3.0'
|
gem 'webpacker', '~> 2.0'
|
||||||
gem 'webpush'
|
gem 'webpush'
|
||||||
|
|
||||||
gem 'json-ld-preloaded', '~> 2.2.1'
|
gem 'json-ld-preloaded', '~> 2.2.1'
|
||||||
gem 'rdf-normalize', '~> 0.3.1'
|
gem 'rdf-normalize', '~> 0.3.1'
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem 'fabrication', '~> 2.18'
|
gem 'fabrication', '~> 2.16'
|
||||||
gem 'fuubar', '~> 2.2'
|
gem 'fuubar', '~> 2.2'
|
||||||
gem 'i18n-tasks', '~> 0.9', require: false
|
gem 'i18n-tasks', '~> 0.9', require: false
|
||||||
gem 'pry-rails', '~> 0.3'
|
gem 'pry-rails', '~> 0.3'
|
||||||
gem 'rspec-rails', '~> 3.7'
|
gem 'rspec-rails', '~> 3.6'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem 'capybara', '~> 2.15'
|
gem 'capybara', '~> 2.14'
|
||||||
gem 'climate_control', '~> 0.2'
|
gem 'climate_control', '~> 0.2'
|
||||||
gem 'faker', '~> 1.7'
|
gem 'faker', '~> 1.7'
|
||||||
gem 'microformats', '~> 4.0'
|
gem 'microformats', '~> 4.0'
|
||||||
@@ -93,29 +90,29 @@ group :test do
|
|||||||
gem 'rspec-sidekiq', '~> 3.0'
|
gem 'rspec-sidekiq', '~> 3.0'
|
||||||
gem 'simplecov', '~> 0.14', require: false
|
gem 'simplecov', '~> 0.14', require: false
|
||||||
gem 'webmock', '~> 3.0'
|
gem 'webmock', '~> 3.0'
|
||||||
gem 'parallel_tests', '~> 2.17'
|
gem 'parallel_tests', '~> 2.14'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem 'active_record_query_trace', '~> 1.5'
|
gem 'active_record_query_trace', '~> 1.5'
|
||||||
gem 'annotate', '~> 2.7'
|
gem 'annotate', '~> 2.7'
|
||||||
gem 'better_errors', '~> 2.4'
|
gem 'better_errors', '~> 2.1'
|
||||||
gem 'binding_of_caller', '~> 0.7'
|
gem 'binding_of_caller', '~> 0.7'
|
||||||
gem 'bullet', '~> 5.5'
|
gem 'bullet', '~> 5.5'
|
||||||
gem 'letter_opener', '~> 1.4'
|
gem 'letter_opener', '~> 1.4'
|
||||||
gem 'letter_opener_web', '~> 1.3'
|
gem 'letter_opener_web', '~> 1.3'
|
||||||
gem 'rubocop', require: false
|
gem 'rubocop', require: false
|
||||||
gem 'brakeman', '~> 4.0', require: false
|
gem 'brakeman', '~> 3.6', require: false
|
||||||
gem 'bundler-audit', '~> 0.6', require: false
|
gem 'bundler-audit', '~> 0.5', require: false
|
||||||
gem 'scss_lint', '~> 0.55', require: false
|
gem 'scss_lint', '~> 0.53', require: false
|
||||||
|
|
||||||
gem 'capistrano', '~> 3.10'
|
gem 'capistrano', '~> 3.8'
|
||||||
gem 'capistrano-rails', '~> 1.3'
|
gem 'capistrano-rails', '~> 1.2'
|
||||||
gem 'capistrano-rbenv', '~> 2.1'
|
gem 'capistrano-rbenv', '~> 2.1'
|
||||||
gem 'capistrano-yarn', '~> 2.0'
|
gem 'capistrano-yarn', '~> 2.0'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :production do
|
group :production do
|
||||||
gem 'lograge', '~> 0.7'
|
gem 'lograge', '~> 0.5'
|
||||||
gem 'redis-rails', '~> 5.0'
|
gem 'redis-rails', '~> 5.0'
|
||||||
end
|
end
|
||||||
|
|||||||
347
Gemfile.lock
347
Gemfile.lock
@@ -1,25 +1,25 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actioncable (5.1.4)
|
actioncable (5.1.3)
|
||||||
actionpack (= 5.1.4)
|
actionpack (= 5.1.3)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (~> 0.6.1)
|
websocket-driver (~> 0.6.1)
|
||||||
actionmailer (5.1.4)
|
actionmailer (5.1.3)
|
||||||
actionpack (= 5.1.4)
|
actionpack (= 5.1.3)
|
||||||
actionview (= 5.1.4)
|
actionview (= 5.1.3)
|
||||||
activejob (= 5.1.4)
|
activejob (= 5.1.3)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
actionpack (5.1.4)
|
actionpack (5.1.3)
|
||||||
actionview (= 5.1.4)
|
actionview (= 5.1.3)
|
||||||
activesupport (= 5.1.4)
|
activesupport (= 5.1.3)
|
||||||
rack (~> 2.0)
|
rack (~> 2.0)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (~> 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||||
actionview (5.1.4)
|
actionview (5.1.3)
|
||||||
activesupport (= 5.1.4)
|
activesupport (= 5.1.3)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.4)
|
erubi (~> 1.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
@@ -30,16 +30,16 @@ GEM
|
|||||||
case_transform (>= 0.2)
|
case_transform (>= 0.2)
|
||||||
jsonapi-renderer (>= 0.1.1.beta1, < 0.2)
|
jsonapi-renderer (>= 0.1.1.beta1, < 0.2)
|
||||||
active_record_query_trace (1.5.4)
|
active_record_query_trace (1.5.4)
|
||||||
activejob (5.1.4)
|
activejob (5.1.3)
|
||||||
activesupport (= 5.1.4)
|
activesupport (= 5.1.3)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (5.1.4)
|
activemodel (5.1.3)
|
||||||
activesupport (= 5.1.4)
|
activesupport (= 5.1.3)
|
||||||
activerecord (5.1.4)
|
activerecord (5.1.3)
|
||||||
activemodel (= 5.1.4)
|
activemodel (= 5.1.3)
|
||||||
activesupport (= 5.1.4)
|
activesupport (= 5.1.3)
|
||||||
arel (~> 8.0)
|
arel (~> 8.0)
|
||||||
activesupport (5.1.4)
|
activesupport (5.1.3)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (~> 0.7)
|
i18n (~> 0.7)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
@@ -57,43 +57,51 @@ GEM
|
|||||||
encryptor (~> 3.0.0)
|
encryptor (~> 3.0.0)
|
||||||
av (0.9.0)
|
av (0.9.0)
|
||||||
cocaine (~> 0.5.3)
|
cocaine (~> 0.5.3)
|
||||||
|
aws-sdk (2.10.21)
|
||||||
|
aws-sdk-resources (= 2.10.21)
|
||||||
|
aws-sdk-core (2.10.21)
|
||||||
|
aws-sigv4 (~> 1.0)
|
||||||
|
jmespath (~> 1.0)
|
||||||
|
aws-sdk-resources (2.10.21)
|
||||||
|
aws-sdk-core (= 2.10.21)
|
||||||
|
aws-sigv4 (1.0.1)
|
||||||
bcrypt (3.1.11)
|
bcrypt (3.1.11)
|
||||||
better_errors (2.4.0)
|
better_errors (2.1.1)
|
||||||
coderay (>= 1.0.0)
|
coderay (>= 1.0.0)
|
||||||
erubi (>= 1.0.0)
|
erubis (>= 2.6.6)
|
||||||
rack (>= 0.9.0)
|
rack (>= 0.9.0)
|
||||||
binding_of_caller (0.7.3)
|
binding_of_caller (0.7.2)
|
||||||
debug_inspector (>= 0.0.1)
|
debug_inspector (>= 0.0.1)
|
||||||
bootsnap (1.1.5)
|
bootsnap (1.1.2)
|
||||||
msgpack (~> 1.0)
|
msgpack (~> 1.0)
|
||||||
brakeman (4.0.1)
|
brakeman (3.7.2)
|
||||||
browser (2.5.2)
|
browser (2.4.0)
|
||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
bullet (5.6.1)
|
bullet (5.5.1)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
uniform_notifier (~> 1.10.0)
|
uniform_notifier (~> 1.10.0)
|
||||||
bundler-audit (0.6.0)
|
bundler-audit (0.6.0)
|
||||||
bundler (~> 1.2)
|
bundler (~> 1.2)
|
||||||
thor (~> 0.18)
|
thor (~> 0.18)
|
||||||
capistrano (3.10.0)
|
capistrano (3.8.2)
|
||||||
airbrussh (>= 1.0.0)
|
airbrussh (>= 1.0.0)
|
||||||
i18n
|
i18n
|
||||||
rake (>= 10.0.0)
|
rake (>= 10.0.0)
|
||||||
sshkit (>= 1.9.0)
|
sshkit (>= 1.9.0)
|
||||||
capistrano-bundler (1.3.0)
|
capistrano-bundler (1.2.0)
|
||||||
capistrano (~> 3.1)
|
capistrano (~> 3.1)
|
||||||
sshkit (~> 1.2)
|
sshkit (~> 1.2)
|
||||||
capistrano-rails (1.3.0)
|
capistrano-rails (1.3.0)
|
||||||
capistrano (~> 3.1)
|
capistrano (~> 3.1)
|
||||||
capistrano-bundler (~> 1.1)
|
capistrano-bundler (~> 1.1)
|
||||||
capistrano-rbenv (2.1.2)
|
capistrano-rbenv (2.1.1)
|
||||||
capistrano (~> 3.1)
|
capistrano (~> 3.1)
|
||||||
sshkit (~> 1.3)
|
sshkit (~> 1.3)
|
||||||
capistrano-yarn (2.0.2)
|
capistrano-yarn (2.0.2)
|
||||||
capistrano (~> 3.0)
|
capistrano (~> 3.0)
|
||||||
capybara (2.15.4)
|
capybara (2.14.4)
|
||||||
addressable
|
addressable
|
||||||
mini_mime (>= 0.1.3)
|
mime-types (>= 1.16)
|
||||||
nokogiri (>= 1.3.3)
|
nokogiri (>= 1.3.3)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
rack-test (>= 0.5.4)
|
rack-test (>= 0.5.4)
|
||||||
@@ -102,12 +110,12 @@ GEM
|
|||||||
activesupport
|
activesupport
|
||||||
charlock_holmes (0.7.5)
|
charlock_holmes (0.7.5)
|
||||||
chunky_png (1.3.8)
|
chunky_png (1.3.8)
|
||||||
cld3 (3.2.1)
|
cld3 (3.1.3)
|
||||||
ffi (>= 1.1.0, < 1.10.0)
|
ffi (>= 1.1.0, < 1.10.0)
|
||||||
climate_control (0.2.0)
|
climate_control (0.2.0)
|
||||||
cocaine (0.5.8)
|
cocaine (0.5.8)
|
||||||
climate_control (>= 0.0.3, < 1.0)
|
climate_control (>= 0.0.3, < 1.0)
|
||||||
coderay (1.1.2)
|
coderay (1.1.1)
|
||||||
colorize (0.8.1)
|
colorize (0.8.1)
|
||||||
concurrent-ruby (1.0.5)
|
concurrent-ruby (1.0.5)
|
||||||
connection_pool (2.2.1)
|
connection_pool (2.2.1)
|
||||||
@@ -142,21 +150,17 @@ GEM
|
|||||||
thread
|
thread
|
||||||
thread_safe
|
thread_safe
|
||||||
encryptor (3.0.0)
|
encryptor (3.0.0)
|
||||||
erubi (1.7.0)
|
erubi (1.6.1)
|
||||||
et-orbi (1.0.8)
|
erubis (2.7.0)
|
||||||
|
et-orbi (1.0.5)
|
||||||
tzinfo
|
tzinfo
|
||||||
excon (0.59.0)
|
excon (0.58.0)
|
||||||
execjs (2.7.0)
|
execjs (2.7.0)
|
||||||
fabrication (2.18.0)
|
fabrication (2.16.2)
|
||||||
faker (1.8.4)
|
faker (1.7.3)
|
||||||
i18n (~> 0.5)
|
i18n (~> 0.5)
|
||||||
fast_blank (1.0.0)
|
fast_blank (1.0.0)
|
||||||
ffi (1.9.18)
|
ffi (1.9.18)
|
||||||
fog-aws (1.4.1)
|
|
||||||
fog-core (~> 1.38)
|
|
||||||
fog-json (~> 1.0)
|
|
||||||
fog-xml (~> 0.1)
|
|
||||||
ipaddress (~> 0.8)
|
|
||||||
fog-core (1.45.0)
|
fog-core (1.45.0)
|
||||||
builder
|
builder
|
||||||
excon (~> 0.58)
|
excon (~> 0.58)
|
||||||
@@ -164,20 +168,15 @@ GEM
|
|||||||
fog-json (1.0.2)
|
fog-json (1.0.2)
|
||||||
fog-core (~> 1.0)
|
fog-core (~> 1.0)
|
||||||
multi_json (~> 1.10)
|
multi_json (~> 1.10)
|
||||||
fog-local (0.4.0)
|
fog-openstack (0.1.21)
|
||||||
fog-core (~> 1.27)
|
|
||||||
fog-openstack (0.1.22)
|
|
||||||
fog-core (>= 1.40)
|
fog-core (>= 1.40)
|
||||||
fog-json (>= 1.0)
|
fog-json (>= 1.0)
|
||||||
ipaddress (>= 0.8)
|
ipaddress (>= 0.8)
|
||||||
fog-xml (0.1.3)
|
|
||||||
fog-core
|
|
||||||
nokogiri (>= 1.5.11, < 2.0.0)
|
|
||||||
formatador (0.2.5)
|
formatador (0.2.5)
|
||||||
fuubar (2.2.0)
|
fuubar (2.2.0)
|
||||||
rspec-core (~> 3.0)
|
rspec-core (~> 3.0)
|
||||||
ruby-progressbar (~> 1.4)
|
ruby-progressbar (~> 1.4)
|
||||||
globalid (0.4.1)
|
globalid (0.4.0)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
goldfinger (2.0.1)
|
goldfinger (2.0.1)
|
||||||
addressable (~> 2.5)
|
addressable (~> 2.5)
|
||||||
@@ -195,7 +194,7 @@ GEM
|
|||||||
railties (>= 4.0.1)
|
railties (>= 4.0.1)
|
||||||
hamster (3.0.0)
|
hamster (3.0.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
hashdiff (0.3.7)
|
hashdiff (0.3.5)
|
||||||
highline (1.7.8)
|
highline (1.7.8)
|
||||||
hiredis (0.6.1)
|
hiredis (0.6.1)
|
||||||
hkdf (0.3.0)
|
hkdf (0.3.0)
|
||||||
@@ -213,13 +212,12 @@ GEM
|
|||||||
httplog (0.99.7)
|
httplog (0.99.7)
|
||||||
colorize
|
colorize
|
||||||
rack
|
rack
|
||||||
i18n (0.9.0)
|
i18n (0.8.6)
|
||||||
concurrent-ruby (~> 1.0)
|
i18n-tasks (0.9.16)
|
||||||
i18n-tasks (0.9.18)
|
|
||||||
activesupport (>= 4.0.2)
|
activesupport (>= 4.0.2)
|
||||||
ast (>= 2.1.0)
|
ast (>= 2.1.0)
|
||||||
easy_translate (>= 0.5.0)
|
easy_translate (>= 0.5.0)
|
||||||
erubi
|
erubis
|
||||||
highline (>= 1.7.3)
|
highline (>= 1.7.3)
|
||||||
i18n
|
i18n
|
||||||
parser (>= 2.2.3.0)
|
parser (>= 2.2.3.0)
|
||||||
@@ -228,28 +226,29 @@ GEM
|
|||||||
idn-ruby (0.1.0)
|
idn-ruby (0.1.0)
|
||||||
ipaddress (0.8.3)
|
ipaddress (0.8.3)
|
||||||
iso-639 (0.2.8)
|
iso-639 (0.2.8)
|
||||||
|
jmespath (1.3.1)
|
||||||
json (2.1.0)
|
json (2.1.0)
|
||||||
json-ld (2.1.7)
|
json-ld (2.1.5)
|
||||||
multi_json (~> 1.12)
|
multi_json (~> 1.12)
|
||||||
rdf (~> 2.2, >= 2.2.8)
|
rdf (~> 2.2)
|
||||||
json-ld-preloaded (2.2.2)
|
json-ld-preloaded (2.2.1)
|
||||||
json-ld (~> 2.1, >= 2.1.5)
|
json-ld (~> 2.1, >= 2.1.5)
|
||||||
multi_json (~> 1.11)
|
multi_json (~> 1.11)
|
||||||
rdf (~> 2.2)
|
rdf (~> 2.2)
|
||||||
jsonapi-renderer (0.1.3)
|
jsonapi-renderer (0.1.3)
|
||||||
jwt (1.5.6)
|
jwt (1.5.6)
|
||||||
kaminari (1.1.1)
|
kaminari (1.0.1)
|
||||||
activesupport (>= 4.1.0)
|
activesupport (>= 4.1.0)
|
||||||
kaminari-actionview (= 1.1.1)
|
kaminari-actionview (= 1.0.1)
|
||||||
kaminari-activerecord (= 1.1.1)
|
kaminari-activerecord (= 1.0.1)
|
||||||
kaminari-core (= 1.1.1)
|
kaminari-core (= 1.0.1)
|
||||||
kaminari-actionview (1.1.1)
|
kaminari-actionview (1.0.1)
|
||||||
actionview
|
actionview
|
||||||
kaminari-core (= 1.1.1)
|
kaminari-core (= 1.0.1)
|
||||||
kaminari-activerecord (1.1.1)
|
kaminari-activerecord (1.0.1)
|
||||||
activerecord
|
activerecord
|
||||||
kaminari-core (= 1.1.1)
|
kaminari-core (= 1.0.1)
|
||||||
kaminari-core (1.1.1)
|
kaminari-core (1.0.1)
|
||||||
launchy (2.4.3)
|
launchy (2.4.3)
|
||||||
addressable (~> 2.3)
|
addressable (~> 2.3)
|
||||||
letter_opener (1.4.1)
|
letter_opener (1.4.1)
|
||||||
@@ -259,19 +258,17 @@ GEM
|
|||||||
letter_opener (~> 1.0)
|
letter_opener (~> 1.0)
|
||||||
railties (>= 3.2)
|
railties (>= 3.2)
|
||||||
link_header (0.0.8)
|
link_header (0.0.8)
|
||||||
lograge (0.7.1)
|
lograge (0.5.1)
|
||||||
actionpack (>= 4, < 5.2)
|
actionpack (>= 4, < 5.2)
|
||||||
activesupport (>= 4, < 5.2)
|
activesupport (>= 4, < 5.2)
|
||||||
railties (>= 4, < 5.2)
|
railties (>= 4, < 5.2)
|
||||||
request_store (~> 1.0)
|
loofah (2.0.3)
|
||||||
loofah (2.1.1)
|
|
||||||
crass (~> 1.0.2)
|
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
mail (2.6.6)
|
mail (2.6.6)
|
||||||
mime-types (>= 1.16, < 4)
|
mime-types (>= 1.16, < 4)
|
||||||
mario-redis-lock (1.2.0)
|
mario-redis-lock (1.2.0)
|
||||||
redis (~> 3, >= 3.0.5)
|
redis (~> 3, >= 3.0.5)
|
||||||
method_source (0.9.0)
|
method_source (0.8.2)
|
||||||
microformats (4.0.7)
|
microformats (4.0.7)
|
||||||
json
|
json
|
||||||
nokogiri
|
nokogiri
|
||||||
@@ -279,33 +276,27 @@ GEM
|
|||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2016.0521)
|
mime-types-data (3.2016.0521)
|
||||||
mimemagic (0.3.2)
|
mimemagic (0.3.2)
|
||||||
mini_mime (0.1.4)
|
mini_portile2 (2.2.0)
|
||||||
mini_portile2 (2.3.0)
|
|
||||||
minitest (5.10.3)
|
minitest (5.10.3)
|
||||||
msgpack (1.1.0)
|
msgpack (1.1.0)
|
||||||
multi_json (1.12.2)
|
multi_json (1.12.1)
|
||||||
net-scp (1.2.1)
|
net-scp (1.2.1)
|
||||||
net-ssh (>= 2.6.5)
|
net-ssh (>= 2.6.5)
|
||||||
net-ssh (4.2.0)
|
net-ssh (4.1.0)
|
||||||
nio4r (2.1.0)
|
nio4r (2.1.0)
|
||||||
nokogiri (1.8.1)
|
nokogiri (1.8.0)
|
||||||
mini_portile2 (~> 2.3.0)
|
mini_portile2 (~> 2.2.0)
|
||||||
nokogumbo (1.4.13)
|
nokogumbo (1.4.13)
|
||||||
nokogiri
|
nokogiri
|
||||||
nsa (0.2.4)
|
oj (3.3.4)
|
||||||
activesupport (>= 4.2, < 6)
|
openssl (2.0.4)
|
||||||
concurrent-ruby (~> 1.0.0)
|
|
||||||
sidekiq (>= 3.5.0)
|
|
||||||
statsd-ruby (~> 1.2.0)
|
|
||||||
oj (3.3.9)
|
|
||||||
openssl (2.0.6)
|
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
ostatus2 (2.0.1)
|
ostatus2 (2.0.1)
|
||||||
addressable (~> 2.4)
|
addressable (~> 2.4)
|
||||||
http (~> 2.0)
|
http (~> 2.0)
|
||||||
nokogiri (~> 1.6)
|
nokogiri (~> 1.6)
|
||||||
openssl (~> 2.0)
|
openssl (~> 2.0)
|
||||||
ox (2.8.1)
|
ox (2.5.0)
|
||||||
paperclip (5.1.0)
|
paperclip (5.1.0)
|
||||||
activemodel (>= 4.2.0)
|
activemodel (>= 4.2.0)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
@@ -315,23 +306,24 @@ GEM
|
|||||||
paperclip-av-transcoder (0.6.4)
|
paperclip-av-transcoder (0.6.4)
|
||||||
av (~> 0.9.0)
|
av (~> 0.9.0)
|
||||||
paperclip (>= 2.5.2)
|
paperclip (>= 2.5.2)
|
||||||
parallel (1.12.0)
|
parallel (1.11.2)
|
||||||
parallel_tests (2.17.0)
|
parallel_tests (2.14.2)
|
||||||
parallel
|
parallel
|
||||||
parser (2.4.0.0)
|
parser (2.4.0.0)
|
||||||
ast (~> 2.2)
|
ast (~> 2.2)
|
||||||
pg (0.21.0)
|
pg (0.21.0)
|
||||||
pghero (1.7.0)
|
pghero (1.7.0)
|
||||||
activerecord
|
activerecord
|
||||||
pkg-config (1.2.8)
|
pkg-config (1.2.4)
|
||||||
powerpack (0.1.1)
|
powerpack (0.1.1)
|
||||||
pry (0.11.2)
|
pry (0.10.4)
|
||||||
coderay (~> 1.1.0)
|
coderay (~> 1.1.0)
|
||||||
method_source (~> 0.9.0)
|
method_source (~> 0.8.1)
|
||||||
|
slop (~> 3.4)
|
||||||
pry-rails (0.3.6)
|
pry-rails (0.3.6)
|
||||||
pry (>= 0.10.4)
|
pry (>= 0.10.4)
|
||||||
public_suffix (3.0.0)
|
public_suffix (3.0.0)
|
||||||
puma (3.10.0)
|
puma (3.9.1)
|
||||||
pundit (1.1.0)
|
pundit (1.1.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
rabl (0.13.1)
|
rabl (0.13.1)
|
||||||
@@ -342,22 +334,20 @@ GEM
|
|||||||
rack-cors (0.4.1)
|
rack-cors (0.4.1)
|
||||||
rack-protection (2.0.0)
|
rack-protection (2.0.0)
|
||||||
rack
|
rack
|
||||||
rack-proxy (0.6.2)
|
rack-test (0.6.3)
|
||||||
rack
|
rack (>= 1.0)
|
||||||
rack-test (0.7.0)
|
|
||||||
rack (>= 1.0, < 3)
|
|
||||||
rack-timeout (0.4.2)
|
rack-timeout (0.4.2)
|
||||||
rails (5.1.4)
|
rails (5.1.3)
|
||||||
actioncable (= 5.1.4)
|
actioncable (= 5.1.3)
|
||||||
actionmailer (= 5.1.4)
|
actionmailer (= 5.1.3)
|
||||||
actionpack (= 5.1.4)
|
actionpack (= 5.1.3)
|
||||||
actionview (= 5.1.4)
|
actionview (= 5.1.3)
|
||||||
activejob (= 5.1.4)
|
activejob (= 5.1.3)
|
||||||
activemodel (= 5.1.4)
|
activemodel (= 5.1.3)
|
||||||
activerecord (= 5.1.4)
|
activerecord (= 5.1.3)
|
||||||
activesupport (= 5.1.4)
|
activesupport (= 5.1.3)
|
||||||
bundler (>= 1.3.0)
|
bundler (>= 1.3.0)
|
||||||
railties (= 5.1.4)
|
railties (= 5.1.3)
|
||||||
sprockets-rails (>= 2.0.0)
|
sprockets-rails (>= 2.0.0)
|
||||||
rails-controller-testing (1.0.2)
|
rails-controller-testing (1.0.2)
|
||||||
actionpack (~> 5.x, >= 5.0.1)
|
actionpack (~> 5.x, >= 5.0.1)
|
||||||
@@ -373,75 +363,74 @@ GEM
|
|||||||
railties (~> 5.0)
|
railties (~> 5.0)
|
||||||
rails-settings-cached (0.6.6)
|
rails-settings-cached (0.6.6)
|
||||||
rails (>= 4.2.0)
|
rails (>= 4.2.0)
|
||||||
railties (5.1.4)
|
railties (5.1.3)
|
||||||
actionpack (= 5.1.4)
|
actionpack (= 5.1.3)
|
||||||
activesupport (= 5.1.4)
|
activesupport (= 5.1.3)
|
||||||
method_source
|
method_source
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
rainbow (2.2.2)
|
rainbow (2.2.2)
|
||||||
rake
|
rake
|
||||||
rake (12.2.1)
|
rake (12.0.0)
|
||||||
rdf (2.2.11)
|
rdf (2.2.8)
|
||||||
hamster (~> 3.0)
|
hamster (~> 3.0)
|
||||||
link_header (~> 0.0, >= 0.0.8)
|
link_header (~> 0.0, >= 0.0.8)
|
||||||
rdf-normalize (0.3.2)
|
rdf-normalize (0.3.2)
|
||||||
rdf (~> 2.0)
|
rdf (~> 2.0)
|
||||||
redis (3.3.5)
|
redis (3.3.3)
|
||||||
redis-actionpack (5.0.2)
|
redis-actionpack (5.0.1)
|
||||||
actionpack (>= 4.0, < 6)
|
actionpack (>= 4.0, < 6)
|
||||||
redis-rack (>= 1, < 3)
|
redis-rack (>= 1, < 3)
|
||||||
redis-store (>= 1.1.0, < 2)
|
redis-store (>= 1.1.0, < 1.4.0)
|
||||||
redis-activesupport (5.0.4)
|
redis-activesupport (5.0.3)
|
||||||
activesupport (>= 3, < 6)
|
activesupport (>= 3, < 6)
|
||||||
redis-store (>= 1.3, < 2)
|
redis-store (~> 1.3.0)
|
||||||
redis-namespace (1.5.3)
|
redis-namespace (1.5.3)
|
||||||
redis (~> 3.0, >= 3.0.4)
|
redis (~> 3.0, >= 3.0.4)
|
||||||
redis-rack (2.0.3)
|
redis-rack (2.0.2)
|
||||||
rack (>= 1.5, < 3)
|
rack (>= 1.5, < 3)
|
||||||
redis-store (>= 1.2, < 2)
|
redis-store (>= 1.2, < 1.4)
|
||||||
redis-rails (5.0.2)
|
redis-rails (5.0.2)
|
||||||
redis-actionpack (>= 5.0, < 6)
|
redis-actionpack (>= 5.0, < 6)
|
||||||
redis-activesupport (>= 5.0, < 6)
|
redis-activesupport (>= 5.0, < 6)
|
||||||
redis-store (>= 1.2, < 2)
|
redis-store (>= 1.2, < 2)
|
||||||
redis-store (1.4.1)
|
redis-store (1.3.0)
|
||||||
redis (>= 2.2, < 5)
|
redis (>= 2.2)
|
||||||
request_store (1.3.2)
|
|
||||||
responders (2.4.0)
|
responders (2.4.0)
|
||||||
actionpack (>= 4.2.0, < 5.3)
|
actionpack (>= 4.2.0, < 5.3)
|
||||||
railties (>= 4.2.0, < 5.3)
|
railties (>= 4.2.0, < 5.3)
|
||||||
rotp (2.1.2)
|
rotp (2.1.2)
|
||||||
rqrcode (0.10.1)
|
rqrcode (0.10.1)
|
||||||
chunky_png (~> 1.0)
|
chunky_png (~> 1.0)
|
||||||
rspec-core (3.7.0)
|
rspec-core (3.6.0)
|
||||||
rspec-support (~> 3.7.0)
|
rspec-support (~> 3.6.0)
|
||||||
rspec-expectations (3.7.0)
|
rspec-expectations (3.6.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.7.0)
|
rspec-support (~> 3.6.0)
|
||||||
rspec-mocks (3.7.0)
|
rspec-mocks (3.6.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.7.0)
|
rspec-support (~> 3.6.0)
|
||||||
rspec-rails (3.7.1)
|
rspec-rails (3.6.0)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
rspec-core (~> 3.7.0)
|
rspec-core (~> 3.6.0)
|
||||||
rspec-expectations (~> 3.7.0)
|
rspec-expectations (~> 3.6.0)
|
||||||
rspec-mocks (~> 3.7.0)
|
rspec-mocks (~> 3.6.0)
|
||||||
rspec-support (~> 3.7.0)
|
rspec-support (~> 3.6.0)
|
||||||
rspec-sidekiq (3.0.3)
|
rspec-sidekiq (3.0.3)
|
||||||
rspec-core (~> 3.0, >= 3.0.0)
|
rspec-core (~> 3.0, >= 3.0.0)
|
||||||
sidekiq (>= 2.4.0)
|
sidekiq (>= 2.4.0)
|
||||||
rspec-support (3.7.0)
|
rspec-support (3.6.0)
|
||||||
rubocop (0.51.0)
|
rubocop (0.49.1)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.3.3.1, < 3.0)
|
parser (>= 2.3.3.1, < 3.0)
|
||||||
powerpack (~> 0.1)
|
powerpack (~> 0.1)
|
||||||
rainbow (>= 2.2.2, < 3.0)
|
rainbow (>= 1.99.1, < 3.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||||
ruby-oembed (0.12.0)
|
ruby-oembed (0.12.0)
|
||||||
ruby-progressbar (1.9.0)
|
ruby-progressbar (1.8.1)
|
||||||
rufus-scheduler (3.4.2)
|
rufus-scheduler (3.4.2)
|
||||||
et-orbi (~> 1.0)
|
et-orbi (~> 1.0)
|
||||||
safe_yaml (1.0.4)
|
safe_yaml (1.0.4)
|
||||||
@@ -449,24 +438,24 @@ GEM
|
|||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.4.4)
|
nokogiri (>= 1.4.4)
|
||||||
nokogumbo (~> 1.4.1)
|
nokogumbo (~> 1.4.1)
|
||||||
sass (3.4.25)
|
sass (3.4.24)
|
||||||
scss_lint (0.55.0)
|
scss_lint (0.54.0)
|
||||||
rake (>= 0.9, < 13)
|
rake (>= 0.9, < 13)
|
||||||
sass (~> 3.4.20)
|
sass (~> 3.4.20)
|
||||||
sidekiq (5.0.5)
|
sidekiq (5.0.4)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
connection_pool (~> 2.2, >= 2.2.0)
|
connection_pool (~> 2.2, >= 2.2.0)
|
||||||
rack-protection (>= 1.5.0)
|
rack-protection (>= 1.5.0)
|
||||||
redis (>= 3.3.4, < 5)
|
redis (~> 3.3, >= 3.3.3)
|
||||||
sidekiq-bulk (0.1.1)
|
sidekiq-bulk (0.1.1)
|
||||||
activesupport
|
activesupport
|
||||||
sidekiq
|
sidekiq
|
||||||
sidekiq-scheduler (2.1.10)
|
sidekiq-scheduler (2.1.8)
|
||||||
redis (>= 3, < 5)
|
redis (~> 3)
|
||||||
rufus-scheduler (~> 3.2)
|
rufus-scheduler (~> 3.2)
|
||||||
sidekiq (>= 3)
|
sidekiq (>= 3)
|
||||||
tilt (>= 1.4.0)
|
tilt (>= 1.4.0)
|
||||||
sidekiq-unique-jobs (5.0.10)
|
sidekiq-unique-jobs (5.0.9)
|
||||||
sidekiq (>= 4.0, <= 6.0)
|
sidekiq (>= 4.0, <= 6.0)
|
||||||
thor (~> 0)
|
thor (~> 0)
|
||||||
simple-navigation (4.0.5)
|
simple-navigation (4.0.5)
|
||||||
@@ -474,24 +463,23 @@ GEM
|
|||||||
simple_form (3.5.0)
|
simple_form (3.5.0)
|
||||||
actionpack (> 4, < 5.2)
|
actionpack (> 4, < 5.2)
|
||||||
activemodel (> 4, < 5.2)
|
activemodel (> 4, < 5.2)
|
||||||
simplecov (0.15.1)
|
simplecov (0.14.1)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1.0)
|
||||||
json (>= 1.8, < 3)
|
json (>= 1.8, < 3)
|
||||||
simplecov-html (~> 0.10.0)
|
simplecov-html (~> 0.10.0)
|
||||||
simplecov-html (0.10.2)
|
simplecov-html (0.10.1)
|
||||||
|
slop (3.6.0)
|
||||||
sprockets (3.7.1)
|
sprockets (3.7.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (> 1, < 3)
|
||||||
sprockets-rails (3.2.1)
|
sprockets-rails (3.2.0)
|
||||||
actionpack (>= 4.0)
|
actionpack (>= 4.0)
|
||||||
activesupport (>= 4.0)
|
activesupport (>= 4.0)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
sshkit (1.14.0)
|
sshkit (1.13.1)
|
||||||
net-scp (>= 1.1.2)
|
net-scp (>= 1.1.2)
|
||||||
net-ssh (>= 2.8.0)
|
net-ssh (>= 2.8.0)
|
||||||
statsd-ruby (1.2.1)
|
statsd-instrument (2.1.4)
|
||||||
strong_migrations (0.1.9)
|
|
||||||
activerecord (>= 3.2.0)
|
|
||||||
temple (0.8.0)
|
temple (0.8.0)
|
||||||
terminal-table (1.8.0)
|
terminal-table (1.8.0)
|
||||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||||
@@ -501,9 +489,9 @@ GEM
|
|||||||
tilt (2.0.8)
|
tilt (2.0.8)
|
||||||
twitter-text (1.14.7)
|
twitter-text (1.14.7)
|
||||||
unf (~> 0.1.0)
|
unf (~> 0.1.0)
|
||||||
tzinfo (1.2.4)
|
tzinfo (1.2.3)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
tzinfo-data (1.2017.3)
|
tzinfo-data (1.2017.2)
|
||||||
tzinfo (>= 1.0.0)
|
tzinfo (>= 1.0.0)
|
||||||
uglifier (3.2.0)
|
uglifier (3.2.0)
|
||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
@@ -514,13 +502,13 @@ GEM
|
|||||||
uniform_notifier (1.10.0)
|
uniform_notifier (1.10.0)
|
||||||
warden (1.2.7)
|
warden (1.2.7)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
webmock (3.1.0)
|
webmock (3.0.1)
|
||||||
addressable (>= 2.3.6)
|
addressable (>= 2.3.6)
|
||||||
crack (>= 0.3.2)
|
crack (>= 0.3.2)
|
||||||
hashdiff
|
hashdiff
|
||||||
webpacker (3.0.2)
|
webpacker (2.0)
|
||||||
activesupport (>= 4.2)
|
activesupport (>= 4.2)
|
||||||
rack-proxy (>= 0.6.1)
|
multi_json (~> 1.2)
|
||||||
railties (>= 4.2)
|
railties (>= 4.2)
|
||||||
webpush (0.3.2)
|
webpush (0.3.2)
|
||||||
hkdf (~> 0.2)
|
hkdf (~> 0.2)
|
||||||
@@ -539,31 +527,29 @@ DEPENDENCIES
|
|||||||
active_record_query_trace (~> 1.5)
|
active_record_query_trace (~> 1.5)
|
||||||
addressable (~> 2.5)
|
addressable (~> 2.5)
|
||||||
annotate (~> 2.7)
|
annotate (~> 2.7)
|
||||||
better_errors (~> 2.4)
|
aws-sdk (~> 2.9)
|
||||||
|
better_errors (~> 2.1)
|
||||||
binding_of_caller (~> 0.7)
|
binding_of_caller (~> 0.7)
|
||||||
bootsnap
|
bootsnap
|
||||||
brakeman (~> 4.0)
|
brakeman (~> 3.6)
|
||||||
browser
|
browser
|
||||||
bullet (~> 5.5)
|
bullet (~> 5.5)
|
||||||
bundler-audit (~> 0.6)
|
bundler-audit (~> 0.5)
|
||||||
capistrano (~> 3.10)
|
capistrano (~> 3.8)
|
||||||
capistrano-rails (~> 1.3)
|
capistrano-rails (~> 1.2)
|
||||||
capistrano-rbenv (~> 2.1)
|
capistrano-rbenv (~> 2.1)
|
||||||
capistrano-yarn (~> 2.0)
|
capistrano-yarn (~> 2.0)
|
||||||
capybara (~> 2.15)
|
capybara (~> 2.14)
|
||||||
charlock_holmes (~> 0.7.5)
|
charlock_holmes (~> 0.7.5)
|
||||||
cld3 (~> 3.2.0)
|
cld3 (~> 3.1)
|
||||||
climate_control (~> 0.2)
|
climate_control (~> 0.2)
|
||||||
devise (~> 4.2)
|
devise (~> 4.2)
|
||||||
devise-two-factor (~> 3.0)
|
devise-two-factor (~> 3.0)
|
||||||
doorkeeper (~> 4.2)
|
doorkeeper (~> 4.2)
|
||||||
dotenv-rails (~> 2.2)
|
dotenv-rails (~> 2.2)
|
||||||
fabrication (~> 2.18)
|
fabrication (~> 2.16)
|
||||||
faker (~> 1.7)
|
faker (~> 1.7)
|
||||||
fast_blank (~> 1.0)
|
fast_blank (~> 1.0)
|
||||||
fog-aws (~> 1.4)
|
|
||||||
fog-core (~> 1.45)
|
|
||||||
fog-local (~> 0.4)
|
|
||||||
fog-openstack (~> 0.1)
|
fog-openstack (~> 0.1)
|
||||||
fuubar (~> 2.2)
|
fuubar (~> 2.2)
|
||||||
goldfinger (~> 2.0)
|
goldfinger (~> 2.0)
|
||||||
@@ -577,33 +563,32 @@ DEPENDENCIES
|
|||||||
idn-ruby
|
idn-ruby
|
||||||
iso-639
|
iso-639
|
||||||
json-ld-preloaded (~> 2.2.1)
|
json-ld-preloaded (~> 2.2.1)
|
||||||
kaminari (~> 1.1)
|
kaminari (~> 1.0)
|
||||||
letter_opener (~> 1.4)
|
letter_opener (~> 1.4)
|
||||||
letter_opener_web (~> 1.3)
|
letter_opener_web (~> 1.3)
|
||||||
link_header (~> 0.0)
|
link_header (~> 0.0)
|
||||||
lograge (~> 0.7)
|
lograge (~> 0.5)
|
||||||
mario-redis-lock (~> 1.2)
|
mario-redis-lock (~> 1.2)
|
||||||
microformats (~> 4.0)
|
microformats (~> 4.0)
|
||||||
mime-types (~> 3.1)
|
mime-types (~> 3.1)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.7)
|
||||||
nsa (~> 0.2)
|
oj (~> 3.0)
|
||||||
oj (~> 3.3)
|
|
||||||
ostatus2 (~> 2.0)
|
ostatus2 (~> 2.0)
|
||||||
ox (~> 2.8)
|
ox (~> 2.5)
|
||||||
paperclip (~> 5.1)
|
paperclip (~> 5.1)
|
||||||
paperclip-av-transcoder (~> 0.6)
|
paperclip-av-transcoder (~> 0.6)
|
||||||
parallel_tests (~> 2.17)
|
parallel_tests (~> 2.14)
|
||||||
pg (~> 0.20)
|
pg (~> 0.20)
|
||||||
pghero (~> 1.7)
|
pghero (~> 1.7)
|
||||||
pkg-config (~> 1.2)
|
pkg-config (~> 1.2)
|
||||||
pry-rails (~> 0.3)
|
pry-rails (~> 0.3)
|
||||||
puma (~> 3.10)
|
puma (~> 3.8)
|
||||||
pundit (~> 1.1)
|
pundit (~> 1.1)
|
||||||
rabl (~> 0.13)
|
rabl (~> 0.13)
|
||||||
rack-attack (~> 5.0)
|
rack-attack (~> 5.0)
|
||||||
rack-cors (~> 0.4)
|
rack-cors (~> 0.4)
|
||||||
rack-timeout (~> 0.4)
|
rack-timeout (~> 0.4)
|
||||||
rails (~> 5.1.4)
|
rails (~> 5.1.0)
|
||||||
rails-controller-testing (~> 1.0)
|
rails-controller-testing (~> 1.0)
|
||||||
rails-i18n (~> 5.0)
|
rails-i18n (~> 5.0)
|
||||||
rails-settings-cached (~> 0.6)
|
rails-settings-cached (~> 0.6)
|
||||||
@@ -612,12 +597,12 @@ DEPENDENCIES
|
|||||||
redis-namespace (~> 1.5)
|
redis-namespace (~> 1.5)
|
||||||
redis-rails (~> 5.0)
|
redis-rails (~> 5.0)
|
||||||
rqrcode (~> 0.10)
|
rqrcode (~> 0.10)
|
||||||
rspec-rails (~> 3.7)
|
rspec-rails (~> 3.6)
|
||||||
rspec-sidekiq (~> 3.0)
|
rspec-sidekiq (~> 3.0)
|
||||||
rubocop
|
rubocop
|
||||||
ruby-oembed (~> 0.12)
|
ruby-oembed (~> 0.12)
|
||||||
sanitize (~> 4.4)
|
sanitize (~> 4.4)
|
||||||
scss_lint (~> 0.55)
|
scss_lint (~> 0.53)
|
||||||
sidekiq (~> 5.0)
|
sidekiq (~> 5.0)
|
||||||
sidekiq-bulk (~> 0.1.1)
|
sidekiq-bulk (~> 0.1.1)
|
||||||
sidekiq-scheduler (~> 2.1)
|
sidekiq-scheduler (~> 2.1)
|
||||||
@@ -626,16 +611,16 @@ DEPENDENCIES
|
|||||||
simple_form (~> 3.4)
|
simple_form (~> 3.4)
|
||||||
simplecov (~> 0.14)
|
simplecov (~> 0.14)
|
||||||
sprockets-rails (~> 3.2)
|
sprockets-rails (~> 3.2)
|
||||||
strong_migrations
|
statsd-instrument (~> 2.1)
|
||||||
twitter-text (~> 1.14)
|
twitter-text (~> 1.14)
|
||||||
tzinfo-data (~> 1.2017)
|
tzinfo-data (~> 1.2017)
|
||||||
uglifier (~> 3.2)
|
uglifier (~> 3.2)
|
||||||
webmock (~> 3.0)
|
webmock (~> 3.0)
|
||||||
webpacker (~> 3.0)
|
webpacker (~> 2.0)
|
||||||
webpush
|
webpush
|
||||||
|
|
||||||
RUBY VERSION
|
RUBY VERSION
|
||||||
ruby 2.4.2p198
|
ruby 2.4.1p111
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.15.4
|
1.15.4
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
web: PORT=3000 bundle exec puma -C config/puma.rb
|
web: PORT=3000 bundle exec puma -C config/puma.rb
|
||||||
sidekiq: PORT=3000 bundle exec sidekiq
|
sidekiq: PORT=3000 bundle exec sidekiq
|
||||||
stream: PORT=4000 yarn run start
|
stream: PORT=4000 yarn run start
|
||||||
webpack: ./bin/webpack-dev-server --listen-host 0.0.0.0
|
webpack: ./bin/webpack-dev-server --host 0.0.0.0
|
||||||
|
|||||||
2
Vagrantfile
vendored
2
Vagrantfile
vendored
@@ -83,7 +83,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|||||||
|
|
||||||
config.vm.provider :virtualbox do |vb|
|
config.vm.provider :virtualbox do |vb|
|
||||||
vb.name = "mastodon"
|
vb.name = "mastodon"
|
||||||
vb.customize ["modifyvm", :id, "--memory", "4096"]
|
vb.customize ["modifyvm", :id, "--memory", "2048"]
|
||||||
|
|
||||||
# Disable VirtualBox DNS proxy to skip long-delay IPv6 resolutions.
|
# Disable VirtualBox DNS proxy to skip long-delay IPv6 resolutions.
|
||||||
# https://github.com/mitchellh/vagrant/issues/1172
|
# https://github.com/mitchellh/vagrant/issues/1172
|
||||||
|
|||||||
@@ -26,10 +26,7 @@ class AccountsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
format.json do
|
format.json do
|
||||||
render json: @account,
|
render json: @account, serializer: ActivityPub::ActorSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
||||||
serializer: ActivityPub::ActorSerializer,
|
|
||||||
adapter: ActivityPub::Adapter,
|
|
||||||
content_type: 'application/activity+json'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ class ActivityPub::InboxesController < Api::BaseController
|
|||||||
if signed_request_account
|
if signed_request_account
|
||||||
upgrade_account
|
upgrade_account
|
||||||
process_payload
|
process_payload
|
||||||
head 202
|
head 201
|
||||||
else
|
else
|
||||||
[signature_verification_failure_reason, 401]
|
head 202
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -32,7 +32,6 @@ class ActivityPub::InboxesController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
Pubsubhubbub::UnsubscribeWorker.perform_async(signed_request_account.id) if signed_request_account.subscribed?
|
Pubsubhubbub::UnsubscribeWorker.perform_async(signed_request_account.id) if signed_request_account.subscribed?
|
||||||
DeliveryFailureTracker.track_inverse_success!(signed_request_account)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_payload
|
def process_payload
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Admin
|
|
||||||
class AccountModerationNotesController < BaseController
|
|
||||||
before_action :set_account_moderation_note, only: [:destroy]
|
|
||||||
|
|
||||||
def create
|
|
||||||
authorize AccountModerationNote, :create?
|
|
||||||
|
|
||||||
@account_moderation_note = current_account.account_moderation_notes.new(resource_params)
|
|
||||||
|
|
||||||
if @account_moderation_note.save
|
|
||||||
redirect_to admin_account_path(@account_moderation_note.target_account_id), notice: I18n.t('admin.account_moderation_notes.created_msg')
|
|
||||||
else
|
|
||||||
@account = @account_moderation_note.target_account
|
|
||||||
@moderation_notes = @account.targeted_moderation_notes.latest
|
|
||||||
|
|
||||||
render template: 'admin/accounts/show'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
|
||||||
authorize @account_moderation_note, :destroy?
|
|
||||||
@account_moderation_note.destroy
|
|
||||||
redirect_to admin_account_path(@account_moderation_note.target_account_id), notice: I18n.t('admin.account_moderation_notes.destroyed_msg')
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def resource_params
|
|
||||||
params.require(:account_moderation_note).permit(
|
|
||||||
:content,
|
|
||||||
:target_account_id
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_account_moderation_note
|
|
||||||
@account_moderation_note = AccountModerationNote.find(params[:id])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -2,54 +2,26 @@
|
|||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class AccountsController < BaseController
|
class AccountsController < BaseController
|
||||||
before_action :set_account, only: [:show, :subscribe, :unsubscribe, :redownload, :enable, :disable, :memorialize]
|
before_action :set_account, only: [:show, :subscribe, :unsubscribe, :redownload]
|
||||||
before_action :require_remote_account!, only: [:subscribe, :unsubscribe, :redownload]
|
before_action :require_remote_account!, only: [:subscribe, :unsubscribe, :redownload]
|
||||||
before_action :require_local_account!, only: [:enable, :disable, :memorialize]
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
authorize :account, :index?
|
|
||||||
@accounts = filtered_accounts.page(params[:page])
|
@accounts = filtered_accounts.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show; end
|
||||||
authorize @account, :show?
|
|
||||||
@account_moderation_note = current_account.account_moderation_notes.new(target_account: @account)
|
|
||||||
@moderation_notes = @account.targeted_moderation_notes.latest
|
|
||||||
end
|
|
||||||
|
|
||||||
def subscribe
|
def subscribe
|
||||||
authorize @account, :subscribe?
|
|
||||||
Pubsubhubbub::SubscribeWorker.perform_async(@account.id)
|
Pubsubhubbub::SubscribeWorker.perform_async(@account.id)
|
||||||
redirect_to admin_account_path(@account.id)
|
redirect_to admin_account_path(@account.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def unsubscribe
|
def unsubscribe
|
||||||
authorize @account, :unsubscribe?
|
|
||||||
Pubsubhubbub::UnsubscribeWorker.perform_async(@account.id)
|
Pubsubhubbub::UnsubscribeWorker.perform_async(@account.id)
|
||||||
redirect_to admin_account_path(@account.id)
|
redirect_to admin_account_path(@account.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def memorialize
|
|
||||||
authorize @account, :memorialize?
|
|
||||||
@account.memorialize!
|
|
||||||
redirect_to admin_account_path(@account.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def enable
|
|
||||||
authorize @account.user, :enable?
|
|
||||||
@account.user.enable!
|
|
||||||
redirect_to admin_account_path(@account.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def disable
|
|
||||||
authorize @account.user, :disable?
|
|
||||||
@account.user.disable!
|
|
||||||
redirect_to admin_account_path(@account.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def redownload
|
def redownload
|
||||||
authorize @account, :redownload?
|
|
||||||
|
|
||||||
@account.reset_avatar!
|
@account.reset_avatar!
|
||||||
@account.reset_header!
|
@account.reset_header!
|
||||||
@account.save!
|
@account.save!
|
||||||
@@ -67,10 +39,6 @@ module Admin
|
|||||||
redirect_to admin_account_path(@account.id) if @account.local?
|
redirect_to admin_account_path(@account.id) if @account.local?
|
||||||
end
|
end
|
||||||
|
|
||||||
def require_local_account!
|
|
||||||
redirect_to admin_account_path(@account.id) unless @account.local? && @account.user.present?
|
|
||||||
end
|
|
||||||
|
|
||||||
def filtered_accounts
|
def filtered_accounts
|
||||||
AccountFilter.new(filter_params).results
|
AccountFilter.new(filter_params).results
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class BaseController < ApplicationController
|
class BaseController < ApplicationController
|
||||||
include Authorization
|
before_action :require_admin!
|
||||||
|
|
||||||
before_action :require_staff!
|
|
||||||
|
|
||||||
layout 'admin'
|
layout 'admin'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,18 +2,15 @@
|
|||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class ConfirmationsController < BaseController
|
class ConfirmationsController < BaseController
|
||||||
before_action :set_user
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
authorize @user, :confirm?
|
account_user.confirm
|
||||||
@user.confirm!
|
|
||||||
redirect_to admin_accounts_path
|
redirect_to admin_accounts_path
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_user
|
def account_user
|
||||||
@user = Account.find(params[:account_id]).user || raise(ActiveRecord::RecordNotFound)
|
Account.find(params[:account_id]).user || raise(ActiveRecord::RecordNotFound)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,92 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Admin
|
|
||||||
class CustomEmojisController < BaseController
|
|
||||||
before_action :set_custom_emoji, except: [:index, :new, :create]
|
|
||||||
|
|
||||||
def index
|
|
||||||
authorize :custom_emoji, :index?
|
|
||||||
@custom_emojis = filtered_custom_emojis.eager_load(:local_counterpart).page(params[:page])
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
authorize :custom_emoji, :create?
|
|
||||||
@custom_emoji = CustomEmoji.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
authorize :custom_emoji, :create?
|
|
||||||
|
|
||||||
@custom_emoji = CustomEmoji.new(resource_params)
|
|
||||||
|
|
||||||
if @custom_emoji.save
|
|
||||||
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.created_msg')
|
|
||||||
else
|
|
||||||
render :new
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
authorize @custom_emoji, :update?
|
|
||||||
|
|
||||||
if @custom_emoji.update(resource_params)
|
|
||||||
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.updated_msg')
|
|
||||||
else
|
|
||||||
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.update_failed_msg')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
|
||||||
authorize @custom_emoji, :destroy?
|
|
||||||
@custom_emoji.destroy
|
|
||||||
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.destroyed_msg')
|
|
||||||
end
|
|
||||||
|
|
||||||
def copy
|
|
||||||
authorize @custom_emoji, :copy?
|
|
||||||
|
|
||||||
emoji = CustomEmoji.find_or_create_by(domain: nil, shortcode: @custom_emoji.shortcode)
|
|
||||||
|
|
||||||
if emoji.update(image: @custom_emoji.image)
|
|
||||||
flash[:notice] = I18n.t('admin.custom_emojis.copied_msg')
|
|
||||||
else
|
|
||||||
flash[:alert] = I18n.t('admin.custom_emojis.copy_failed_msg')
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_to admin_custom_emojis_path(page: params[:page])
|
|
||||||
end
|
|
||||||
|
|
||||||
def enable
|
|
||||||
authorize @custom_emoji, :enable?
|
|
||||||
@custom_emoji.update!(disabled: false)
|
|
||||||
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.enabled_msg')
|
|
||||||
end
|
|
||||||
|
|
||||||
def disable
|
|
||||||
authorize @custom_emoji, :disable?
|
|
||||||
@custom_emoji.update!(disabled: true)
|
|
||||||
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.disabled_msg')
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_custom_emoji
|
|
||||||
@custom_emoji = CustomEmoji.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def resource_params
|
|
||||||
params.require(:custom_emoji).permit(:shortcode, :image, :visible_in_picker)
|
|
||||||
end
|
|
||||||
|
|
||||||
def filtered_custom_emojis
|
|
||||||
CustomEmojiFilter.new(filter_params).results
|
|
||||||
end
|
|
||||||
|
|
||||||
def filter_params
|
|
||||||
params.permit(
|
|
||||||
:local,
|
|
||||||
:remote
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -5,18 +5,14 @@ module Admin
|
|||||||
before_action :set_domain_block, only: [:show, :destroy]
|
before_action :set_domain_block, only: [:show, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
authorize :domain_block, :index?
|
|
||||||
@domain_blocks = DomainBlock.page(params[:page])
|
@domain_blocks = DomainBlock.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
authorize :domain_block, :create?
|
|
||||||
@domain_block = DomainBlock.new
|
@domain_block = DomainBlock.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
authorize :domain_block, :create?
|
|
||||||
|
|
||||||
@domain_block = DomainBlock.new(resource_params)
|
@domain_block = DomainBlock.new(resource_params)
|
||||||
|
|
||||||
if @domain_block.save
|
if @domain_block.save
|
||||||
@@ -27,12 +23,9 @@ module Admin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show; end
|
||||||
authorize @domain_block, :show?
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
authorize @domain_block, :destroy?
|
|
||||||
UnblockDomainService.new.call(@domain_block, retroactive_unblock?)
|
UnblockDomainService.new.call(@domain_block, retroactive_unblock?)
|
||||||
redirect_to admin_domain_blocks_path, notice: I18n.t('admin.domain_blocks.destroyed_msg')
|
redirect_to admin_domain_blocks_path, notice: I18n.t('admin.domain_blocks.destroyed_msg')
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Admin
|
|
||||||
class EmailDomainBlocksController < BaseController
|
|
||||||
before_action :set_email_domain_block, only: [:show, :destroy]
|
|
||||||
|
|
||||||
def index
|
|
||||||
authorize :email_domain_block, :index?
|
|
||||||
@email_domain_blocks = EmailDomainBlock.page(params[:page])
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
authorize :email_domain_block, :create?
|
|
||||||
@email_domain_block = EmailDomainBlock.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
authorize :email_domain_block, :create?
|
|
||||||
|
|
||||||
@email_domain_block = EmailDomainBlock.new(resource_params)
|
|
||||||
|
|
||||||
if @email_domain_block.save
|
|
||||||
redirect_to admin_email_domain_blocks_path, notice: I18n.t('admin.email_domain_blocks.created_msg')
|
|
||||||
else
|
|
||||||
render :new
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
|
||||||
authorize @email_domain_block, :destroy?
|
|
||||||
@email_domain_block.destroy
|
|
||||||
redirect_to admin_email_domain_blocks_path, notice: I18n.t('admin.email_domain_blocks.destroyed_msg')
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_email_domain_block
|
|
||||||
@email_domain_block = EmailDomainBlock.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def resource_params
|
|
||||||
params.require(:email_domain_block).permit(:domain)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -3,12 +3,10 @@
|
|||||||
module Admin
|
module Admin
|
||||||
class InstancesController < BaseController
|
class InstancesController < BaseController
|
||||||
def index
|
def index
|
||||||
authorize :instance, :index?
|
|
||||||
@instances = ordered_instances
|
@instances = ordered_instances
|
||||||
end
|
end
|
||||||
|
|
||||||
def resubscribe
|
def resubscribe
|
||||||
authorize :instance, :resubscribe?
|
|
||||||
params.require(:by_domain)
|
params.require(:by_domain)
|
||||||
Pubsubhubbub::SubscribeWorker.push_bulk(subscribeable_accounts.pluck(:id))
|
Pubsubhubbub::SubscribeWorker.push_bulk(subscribeable_accounts.pluck(:id))
|
||||||
redirect_to admin_instances_path
|
redirect_to admin_instances_path
|
||||||
@@ -16,12 +14,8 @@ module Admin
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def filtered_instances
|
|
||||||
InstanceFilter.new(filter_params).results
|
|
||||||
end
|
|
||||||
|
|
||||||
def paginated_instances
|
def paginated_instances
|
||||||
filtered_instances.page(params[:page])
|
Account.remote.by_domain_accounts.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
helper_method :paginated_instances
|
helper_method :paginated_instances
|
||||||
@@ -33,11 +27,5 @@ module Admin
|
|||||||
def subscribeable_accounts
|
def subscribeable_accounts
|
||||||
Account.with_followers.remote.where(domain: params[:by_domain])
|
Account.with_followers.remote.where(domain: params[:by_domain])
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter_params
|
|
||||||
params.permit(
|
|
||||||
:domain_name
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,20 +2,19 @@
|
|||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class ReportedStatusesController < BaseController
|
class ReportedStatusesController < BaseController
|
||||||
|
include Authorization
|
||||||
|
|
||||||
before_action :set_report
|
before_action :set_report
|
||||||
before_action :set_status, only: [:update, :destroy]
|
before_action :set_status, only: [:update, :destroy]
|
||||||
|
|
||||||
def create
|
def create
|
||||||
authorize :status, :update?
|
|
||||||
|
|
||||||
@form = Form::StatusBatch.new(form_status_batch_params)
|
@form = Form::StatusBatch.new(form_status_batch_params)
|
||||||
flash[:alert] = I18n.t('admin.statuses.failed_to_execute') unless @form.save
|
flash[:alert] = t('admin.statuses.failed_to_execute') unless @form.save
|
||||||
|
|
||||||
redirect_to admin_report_path(@report)
|
redirect_to admin_report_path(@report)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
authorize @status, :update?
|
|
||||||
@status.update(status_params)
|
@status.update(status_params)
|
||||||
redirect_to admin_report_path(@report)
|
redirect_to admin_report_path(@report)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,17 +5,14 @@ module Admin
|
|||||||
before_action :set_report, except: [:index]
|
before_action :set_report, except: [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
authorize :report, :index?
|
|
||||||
@reports = filtered_reports.page(params[:page])
|
@reports = filtered_reports.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
authorize @report, :show?
|
|
||||||
@form = Form::StatusBatch.new
|
@form = Form::StatusBatch.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
authorize @report, :update?
|
|
||||||
process_report
|
process_report
|
||||||
redirect_to admin_report_path(@report)
|
redirect_to admin_report_path(@report)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,18 +2,17 @@
|
|||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class ResetsController < BaseController
|
class ResetsController < BaseController
|
||||||
before_action :set_user
|
before_action :set_account
|
||||||
|
|
||||||
def create
|
def create
|
||||||
authorize @user, :reset_password?
|
@account.user.send_reset_password_instructions
|
||||||
@user.send_reset_password_instructions
|
|
||||||
redirect_to admin_accounts_path
|
redirect_to admin_accounts_path
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_user
|
def set_account
|
||||||
@user = Account.find(params[:account_id]).user || raise(ActiveRecord::RecordNotFound)
|
@account = Account.find(params[:account_id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Admin
|
|
||||||
class RolesController < BaseController
|
|
||||||
before_action :set_user
|
|
||||||
|
|
||||||
def promote
|
|
||||||
authorize @user, :promote?
|
|
||||||
@user.promote!
|
|
||||||
redirect_to admin_account_path(@user.account_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def demote
|
|
||||||
authorize @user, :demote?
|
|
||||||
@user.demote!
|
|
||||||
redirect_to admin_account_path(@user.account_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_user
|
|
||||||
@user = Account.find(params[:account_id]).user || raise(ActiveRecord::RecordNotFound)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -14,7 +14,6 @@ module Admin
|
|||||||
open_deletion
|
open_deletion
|
||||||
timeline_preview
|
timeline_preview
|
||||||
bootstrap_timeline_accounts
|
bootstrap_timeline_accounts
|
||||||
thumbnail
|
|
||||||
).freeze
|
).freeze
|
||||||
|
|
||||||
BOOLEAN_SETTINGS = %w(
|
BOOLEAN_SETTINGS = %w(
|
||||||
@@ -23,27 +22,15 @@ module Admin
|
|||||||
timeline_preview
|
timeline_preview
|
||||||
).freeze
|
).freeze
|
||||||
|
|
||||||
UPLOAD_SETTINGS = %w(
|
|
||||||
thumbnail
|
|
||||||
).freeze
|
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
authorize :settings, :show?
|
|
||||||
@admin_settings = Form::AdminSettings.new
|
@admin_settings = Form::AdminSettings.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
authorize :settings, :update?
|
|
||||||
|
|
||||||
settings_params.each do |key, value|
|
settings_params.each do |key, value|
|
||||||
if UPLOAD_SETTINGS.include?(key)
|
|
||||||
upload = SiteUpload.where(var: key).first_or_initialize(var: key)
|
|
||||||
upload.update(file: value)
|
|
||||||
else
|
|
||||||
setting = Setting.where(var: key).first_or_initialize(var: key)
|
setting = Setting.where(var: key).first_or_initialize(var: key)
|
||||||
setting.update(value: value_for_update(key, value))
|
setting.update(value: value_for_update(key, value))
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
flash[:notice] = I18n.t('generic.changes_saved_msg')
|
flash[:notice] = I18n.t('generic.changes_saved_msg')
|
||||||
redirect_to edit_admin_settings_path
|
redirect_to edit_admin_settings_path
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ module Admin
|
|||||||
before_action :set_account
|
before_action :set_account
|
||||||
|
|
||||||
def create
|
def create
|
||||||
authorize @account, :silence?
|
|
||||||
@account.update(silenced: true)
|
@account.update(silenced: true)
|
||||||
redirect_to admin_accounts_path
|
redirect_to admin_accounts_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
authorize @account, :unsilence?
|
|
||||||
@account.update(silenced: false)
|
@account.update(silenced: false)
|
||||||
redirect_to admin_accounts_path
|
redirect_to admin_accounts_path
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class StatusesController < BaseController
|
class StatusesController < BaseController
|
||||||
|
include Authorization
|
||||||
|
|
||||||
helper_method :current_params
|
helper_method :current_params
|
||||||
|
|
||||||
before_action :set_account
|
before_action :set_account
|
||||||
@@ -10,30 +12,24 @@ module Admin
|
|||||||
PER_PAGE = 20
|
PER_PAGE = 20
|
||||||
|
|
||||||
def index
|
def index
|
||||||
authorize :status, :index?
|
|
||||||
|
|
||||||
@statuses = @account.statuses
|
@statuses = @account.statuses
|
||||||
|
|
||||||
if params[:media]
|
if params[:media]
|
||||||
account_media_status_ids = @account.media_attachments.attached.reorder(nil).select(:status_id).distinct
|
account_media_status_ids = @account.media_attachments.attached.reorder(nil).select(:status_id).distinct
|
||||||
@statuses.merge!(Status.where(id: account_media_status_ids))
|
@statuses.merge!(Status.where(id: account_media_status_ids))
|
||||||
end
|
end
|
||||||
|
|
||||||
@statuses = @statuses.preload(:media_attachments, :mentions).page(params[:page]).per(PER_PAGE)
|
@statuses = @statuses.preload(:media_attachments, :mentions).page(params[:page]).per(PER_PAGE)
|
||||||
|
|
||||||
@form = Form::StatusBatch.new
|
@form = Form::StatusBatch.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
authorize :status, :update?
|
|
||||||
|
|
||||||
@form = Form::StatusBatch.new(form_status_batch_params)
|
@form = Form::StatusBatch.new(form_status_batch_params)
|
||||||
flash[:alert] = I18n.t('admin.statuses.failed_to_execute') unless @form.save
|
flash[:alert] = t('admin.statuses.failed_to_execute') unless @form.save
|
||||||
|
|
||||||
redirect_to admin_account_statuses_path(@account.id, current_params)
|
redirect_to admin_account_statuses_path(@account.id, current_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
authorize @status, :update?
|
|
||||||
@status.update(status_params)
|
@status.update(status_params)
|
||||||
redirect_to admin_account_statuses_path(@account.id, current_params)
|
redirect_to admin_account_statuses_path(@account.id, current_params)
|
||||||
end
|
end
|
||||||
@@ -64,7 +60,6 @@ module Admin
|
|||||||
|
|
||||||
def current_params
|
def current_params
|
||||||
page = (params[:page] || 1).to_i
|
page = (params[:page] || 1).to_i
|
||||||
|
|
||||||
{
|
{
|
||||||
media: params[:media],
|
media: params[:media],
|
||||||
page: page > 1 && page,
|
page: page > 1 && page,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
module Admin
|
module Admin
|
||||||
class SubscriptionsController < BaseController
|
class SubscriptionsController < BaseController
|
||||||
def index
|
def index
|
||||||
authorize :subscription, :index?
|
|
||||||
@subscriptions = ordered_subscriptions.page(requested_page)
|
@subscriptions = ordered_subscriptions.page(requested_page)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,12 @@ module Admin
|
|||||||
before_action :set_account
|
before_action :set_account
|
||||||
|
|
||||||
def create
|
def create
|
||||||
authorize @account, :suspend?
|
|
||||||
Admin::SuspensionWorker.perform_async(@account.id)
|
Admin::SuspensionWorker.perform_async(@account.id)
|
||||||
redirect_to admin_accounts_path
|
redirect_to admin_accounts_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
authorize @account, :unsuspend?
|
@account.update(suspended: false)
|
||||||
@account.unsuspend!
|
|
||||||
redirect_to admin_accounts_path
|
redirect_to admin_accounts_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ module Admin
|
|||||||
before_action :set_user
|
before_action :set_user
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
authorize @user, :disable_2fa?
|
|
||||||
@user.disable_two_factor!
|
@user.disable_two_factor!
|
||||||
redirect_to admin_accounts_path
|
redirect_to admin_accounts_path
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,11 +7,9 @@ class Api::SalmonController < Api::BaseController
|
|||||||
def update
|
def update
|
||||||
if verify_payload?
|
if verify_payload?
|
||||||
process_salmon
|
process_salmon
|
||||||
head 202
|
head 201
|
||||||
elsif payload.present?
|
|
||||||
[signature_verification_failure_reason, 401]
|
|
||||||
else
|
else
|
||||||
head 400
|
head 202
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,7 @@ class Api::V1::Accounts::RelationshipsController < Api::BaseController
|
|||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
def index
|
def index
|
||||||
accounts = Account.where(id: account_ids).select('id')
|
@accounts = Account.where(id: account_ids).select('id')
|
||||||
# .where doesn't guarantee that our results are in the same order
|
|
||||||
# we requested them, so return the "right" order to the requestor.
|
|
||||||
@accounts = accounts.index_by(&:id).values_at(*account_ids)
|
|
||||||
render json: @accounts, each_serializer: REST::RelationshipSerializer, relationships: relationships
|
render json: @accounts, each_serializer: REST::RelationshipSerializer, relationships: relationships
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,9 @@ class Api::V1::AccountsController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def follow
|
def follow
|
||||||
reblogs_arg = { reblogs: params[:reblogs] }
|
FollowService.new.call(current_user.account, @account.acct)
|
||||||
|
|
||||||
FollowService.new.call(current_user.account, @account.acct, reblogs_arg)
|
options = @account.locked? ? {} : { following_map: { @account.id => true }, requested_map: { @account.id => false } }
|
||||||
|
|
||||||
options = @account.locked? ? {} : { following_map: { @account.id => reblogs_arg }, requested_map: { @account.id => false } }
|
|
||||||
|
|
||||||
render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships(options)
|
render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships(options)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Api::V1::Apps::CredentialsController < Api::BaseController
|
|
||||||
before_action -> { doorkeeper_authorize! :read }
|
|
||||||
|
|
||||||
respond_to :json
|
|
||||||
|
|
||||||
def show
|
|
||||||
render json: doorkeeper_token.application, serializer: REST::StatusSerializer::ApplicationSerializer
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Api::V1::AppsController < Api::BaseController
|
class Api::V1::AppsController < Api::BaseController
|
||||||
|
respond_to :json
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@app = Doorkeeper::Application.create!(application_options)
|
@app = Doorkeeper::Application.create!(application_options)
|
||||||
render json: @app, serializer: REST::ApplicationSerializer
|
render json: @app, serializer: REST::ApplicationSerializer
|
||||||
|
|||||||
@@ -15,13 +15,15 @@ class Api::V1::BlocksController < Api::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def load_accounts
|
def load_accounts
|
||||||
paginated_blocks.map(&:target_account)
|
default_accounts.merge(paginated_blocks).to_a
|
||||||
|
end
|
||||||
|
|
||||||
|
def default_accounts
|
||||||
|
Account.includes(:blocked_by).references(:blocked_by)
|
||||||
end
|
end
|
||||||
|
|
||||||
def paginated_blocks
|
def paginated_blocks
|
||||||
@paginated_blocks ||= Block.eager_load(:target_account)
|
Block.where(account: current_account).paginate_by_max_id(
|
||||||
.where(account: current_account)
|
|
||||||
.paginate_by_max_id(
|
|
||||||
limit_param(DEFAULT_ACCOUNTS_LIMIT),
|
limit_param(DEFAULT_ACCOUNTS_LIMIT),
|
||||||
params[:max_id],
|
params[:max_id],
|
||||||
params[:since_id]
|
params[:since_id]
|
||||||
@@ -39,21 +41,21 @@ class Api::V1::BlocksController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def prev_path
|
def prev_path
|
||||||
unless paginated_blocks.empty?
|
unless @accounts.empty?
|
||||||
api_v1_blocks_url pagination_params(since_id: pagination_since_id)
|
api_v1_blocks_url pagination_params(since_id: pagination_since_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pagination_max_id
|
def pagination_max_id
|
||||||
paginated_blocks.last.id
|
@accounts.last.blocked_by_ids.last
|
||||||
end
|
end
|
||||||
|
|
||||||
def pagination_since_id
|
def pagination_since_id
|
||||||
paginated_blocks.first.id
|
@accounts.first.blocked_by_ids.first
|
||||||
end
|
end
|
||||||
|
|
||||||
def records_continue?
|
def records_continue?
|
||||||
paginated_blocks.size == limit_param(DEFAULT_ACCOUNTS_LIMIT)
|
@accounts.size == limit_param(DEFAULT_ACCOUNTS_LIMIT)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pagination_params(core_params)
|
def pagination_params(core_params)
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Api::V1::CustomEmojisController < Api::BaseController
|
|
||||||
respond_to :json
|
|
||||||
|
|
||||||
def index
|
|
||||||
render json: CustomEmoji.local.where(disabled: false), each_serializer: REST::CustomEmojiSerializer
|
|
||||||
end
|
|
||||||
end
|
|
||||||
8
app/controllers/api/v1/extensions_controller.rb
Normal file
8
app/controllers/api/v1/extensions_controller.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
require 'mastodon/extension'
|
||||||
|
|
||||||
|
class Api::V1::ExtensionsController < Api::BaseController
|
||||||
|
def index
|
||||||
|
render json: Mastodon::Extension.all
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,7 +10,7 @@ class Api::V1::MediaController < Api::BaseController
|
|||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@media = current_account.media_attachments.create!(media_params)
|
@media = current_account.media_attachments.create!(file: media_params[:file])
|
||||||
render json: @media, serializer: REST::MediaAttachmentSerializer
|
render json: @media, serializer: REST::MediaAttachmentSerializer
|
||||||
rescue Paperclip::Errors::NotIdentifiedByImageMagickError
|
rescue Paperclip::Errors::NotIdentifiedByImageMagickError
|
||||||
render json: file_type_error, status: 422
|
render json: file_type_error, status: 422
|
||||||
@@ -18,16 +18,10 @@ class Api::V1::MediaController < Api::BaseController
|
|||||||
render json: processing_error, status: 500
|
render json: processing_error, status: 500
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
|
||||||
@media = current_account.media_attachments.where(status_id: nil).find(params[:id])
|
|
||||||
@media.update!(media_params)
|
|
||||||
render json: @media, serializer: REST::MediaAttachmentSerializer
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def media_params
|
def media_params
|
||||||
params.permit(:file, :description)
|
params.permit(:file)
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_type_error
|
def file_type_error
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class Api::V1::ReportsController < Api::BaseController
|
|||||||
comment: report_params[:comment]
|
comment: report_params[:comment]
|
||||||
)
|
)
|
||||||
|
|
||||||
User.staff.includes(:account).each { |u| AdminMailer.new_report(u.account, @report).deliver_later }
|
User.admins.includes(:account).each { |u| AdminMailer.new_report(u.account, @report).deliver_later }
|
||||||
|
|
||||||
render json: @report, serializer: REST::ReportSerializer
|
render json: @report, serializer: REST::ReportSerializer
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Api::V1::SearchController < Api::BaseController
|
class Api::V1::SearchController < Api::BaseController
|
||||||
include Authorization
|
|
||||||
|
|
||||||
RESULTS_LIMIT = 10
|
RESULTS_LIMIT = 10
|
||||||
|
|
||||||
before_action -> { doorkeeper_authorize! :read }
|
before_action -> { doorkeeper_authorize! :read }
|
||||||
@@ -11,24 +9,12 @@ class Api::V1::SearchController < Api::BaseController
|
|||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@search = Search.new(search)
|
@search = Search.new(search_results)
|
||||||
render json: @search, serializer: REST::SearchSerializer
|
render json: @search, serializer: REST::SearchSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def search
|
|
||||||
search_results.tap do |search|
|
|
||||||
search[:statuses].keep_if do |status|
|
|
||||||
begin
|
|
||||||
authorize status, :show?
|
|
||||||
rescue Mastodon::NotPermittedError
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def search_results
|
def search_results
|
||||||
SearchService.new.call(
|
SearchService.new.call(
|
||||||
params[:q],
|
params[:q],
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Api::V1::Timelines::DirectController < Api::BaseController
|
|
||||||
before_action -> { doorkeeper_authorize! :read }, only: [:show]
|
|
||||||
before_action :require_user!, only: [:show]
|
|
||||||
after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
|
|
||||||
|
|
||||||
respond_to :json
|
|
||||||
|
|
||||||
def show
|
|
||||||
@statuses = load_statuses
|
|
||||||
render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def load_statuses
|
|
||||||
cached_direct_statuses
|
|
||||||
end
|
|
||||||
|
|
||||||
def cached_direct_statuses
|
|
||||||
cache_collection direct_statuses, Status
|
|
||||||
end
|
|
||||||
|
|
||||||
def direct_statuses
|
|
||||||
direct_timeline_statuses.paginate_by_max_id(
|
|
||||||
limit_param(DEFAULT_STATUSES_LIMIT),
|
|
||||||
params[:max_id],
|
|
||||||
params[:since_id]
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
def direct_timeline_statuses
|
|
||||||
Status.as_direct_timeline(current_account)
|
|
||||||
end
|
|
||||||
|
|
||||||
def insert_pagination_headers
|
|
||||||
set_pagination_headers(next_path, prev_path)
|
|
||||||
end
|
|
||||||
|
|
||||||
def pagination_params(core_params)
|
|
||||||
params.permit(:local, :limit).merge(core_params)
|
|
||||||
end
|
|
||||||
|
|
||||||
def next_path
|
|
||||||
api_v1_timelines_direct_url pagination_params(max_id: pagination_max_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def prev_path
|
|
||||||
api_v1_timelines_direct_url pagination_params(since_id: pagination_since_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def pagination_max_id
|
|
||||||
@statuses.last.id
|
|
||||||
end
|
|
||||||
|
|
||||||
def pagination_since_id
|
|
||||||
@statuses.first.id
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -12,13 +12,11 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
helper_method :current_account
|
helper_method :current_account
|
||||||
helper_method :current_session
|
helper_method :current_session
|
||||||
helper_method :current_theme
|
|
||||||
helper_method :single_user_mode?
|
helper_method :single_user_mode?
|
||||||
|
|
||||||
rescue_from ActionController::RoutingError, with: :not_found
|
rescue_from ActionController::RoutingError, with: :not_found
|
||||||
rescue_from ActiveRecord::RecordNotFound, with: :not_found
|
rescue_from ActiveRecord::RecordNotFound, with: :not_found
|
||||||
rescue_from ActionController::InvalidAuthenticityToken, with: :unprocessable_entity
|
rescue_from ActionController::InvalidAuthenticityToken, with: :unprocessable_entity
|
||||||
rescue_from Mastodon::NotPermittedError, with: :forbidden
|
|
||||||
|
|
||||||
before_action :store_current_location, except: :raise_not_found, unless: :devise_controller?
|
before_action :store_current_location, except: :raise_not_found, unless: :devise_controller?
|
||||||
before_action :check_suspension, if: :user_signed_in?
|
before_action :check_suspension, if: :user_signed_in?
|
||||||
@@ -41,10 +39,6 @@ class ApplicationController < ActionController::Base
|
|||||||
redirect_to root_path unless current_user&.admin?
|
redirect_to root_path unless current_user&.admin?
|
||||||
end
|
end
|
||||||
|
|
||||||
def require_staff!
|
|
||||||
redirect_to root_path unless current_user&.staff?
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_suspension
|
def check_suspension
|
||||||
forbidden if current_user.account.suspended?
|
forbidden if current_user.account.suspended?
|
||||||
end
|
end
|
||||||
@@ -83,11 +77,6 @@ class ApplicationController < ActionController::Base
|
|||||||
@current_session ||= SessionActivation.find_by(session_id: cookies.signed['_session_id'])
|
@current_session ||= SessionActivation.find_by(session_id: cookies.signed['_session_id'])
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_theme
|
|
||||||
return Setting.default_settings['theme'] unless Themes.instance.names.include? current_user&.setting_theme
|
|
||||||
current_user.setting_theme
|
|
||||||
end
|
|
||||||
|
|
||||||
def cache_collection(raw, klass)
|
def cache_collection(raw, klass)
|
||||||
return raw unless klass.respond_to?(:with_includes)
|
return raw unless klass.respond_to?(:with_includes)
|
||||||
|
|
||||||
@@ -104,7 +93,7 @@ class ApplicationController < ActionController::Base
|
|||||||
unless uncached_ids.empty?
|
unless uncached_ids.empty?
|
||||||
uncached = klass.where(id: uncached_ids).with_includes.map { |item| [item.id, item] }.to_h
|
uncached = klass.where(id: uncached_ids).with_includes.map { |item| [item.id, item] }.to_h
|
||||||
|
|
||||||
uncached.each_value do |item|
|
uncached.values.each do |item|
|
||||||
Rails.cache.write(item.cache_key, item)
|
Rails.cache.write(item.cache_key, item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||||||
before_action :check_enabled_registrations, only: [:new, :create]
|
before_action :check_enabled_registrations, only: [:new, :create]
|
||||||
before_action :configure_sign_up_params, only: [:create]
|
before_action :configure_sign_up_params, only: [:create]
|
||||||
before_action :set_sessions, only: [:edit, :update]
|
before_action :set_sessions, only: [:edit, :update]
|
||||||
before_action :set_instance_presenter, only: [:new, :create, :update]
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
not_found
|
not_found
|
||||||
@@ -40,10 +39,6 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_instance_presenter
|
|
||||||
@instance_presenter = InstancePresenter.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def determine_layout
|
def determine_layout
|
||||||
%w(edit update).include?(action_name) ? 'admin' : 'auth'
|
%w(edit update).include?(action_name) ? 'admin' : 'auth'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ class Auth::SessionsController < Devise::SessionsController
|
|||||||
skip_before_action :require_no_authentication, only: [:create]
|
skip_before_action :require_no_authentication, only: [:create]
|
||||||
skip_before_action :check_suspension, only: [:destroy]
|
skip_before_action :check_suspension, only: [:destroy]
|
||||||
prepend_before_action :authenticate_with_two_factor, if: :two_factor_enabled?, only: [:create]
|
prepend_before_action :authenticate_with_two_factor, if: :two_factor_enabled?, only: [:create]
|
||||||
before_action :set_instance_presenter, only: [:new]
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
super do |resource|
|
super do |resource|
|
||||||
@@ -62,7 +61,7 @@ class Auth::SessionsController < Devise::SessionsController
|
|||||||
|
|
||||||
if user_params[:otp_attempt].present? && session[:otp_user_id]
|
if user_params[:otp_attempt].present? && session[:otp_user_id]
|
||||||
authenticate_with_two_factor_via_otp(user)
|
authenticate_with_two_factor_via_otp(user)
|
||||||
elsif user&.valid_password?(user_params[:password])
|
elsif user && user.valid_password?(user_params[:password])
|
||||||
prompt_for_two_factor(user)
|
prompt_for_two_factor(user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -85,10 +84,6 @@ class Auth::SessionsController < Devise::SessionsController
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_instance_presenter
|
|
||||||
@instance_presenter = InstancePresenter.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def home_paths(resource)
|
def home_paths(resource)
|
||||||
paths = [about_path]
|
paths = [about_path]
|
||||||
if single_user_mode? && resource.is_a?(User)
|
if single_user_mode? && resource.is_a?(User)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
module Authorization
|
module Authorization
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
include Pundit
|
include Pundit
|
||||||
|
|
||||||
def pundit_user
|
def pundit_user
|
||||||
|
|||||||
@@ -9,15 +9,10 @@ module SignatureVerification
|
|||||||
request.headers['Signature'].present?
|
request.headers['Signature'].present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def signature_verification_failure_reason
|
|
||||||
return @signature_verification_failure_reason if defined?(@signature_verification_failure_reason)
|
|
||||||
end
|
|
||||||
|
|
||||||
def signed_request_account
|
def signed_request_account
|
||||||
return @signed_request_account if defined?(@signed_request_account)
|
return @signed_request_account if defined?(@signed_request_account)
|
||||||
|
|
||||||
unless signed_request?
|
unless signed_request?
|
||||||
@signature_verification_failure_reason = 'Request not signed'
|
|
||||||
@signed_request_account = nil
|
@signed_request_account = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -32,7 +27,6 @@ module SignatureVerification
|
|||||||
end
|
end
|
||||||
|
|
||||||
if incompatible_signature?(signature_params)
|
if incompatible_signature?(signature_params)
|
||||||
@signature_verification_failure_reason = 'Incompatible request signature'
|
|
||||||
@signed_request_account = nil
|
@signed_request_account = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -40,7 +34,6 @@ module SignatureVerification
|
|||||||
account = account_from_key_id(signature_params['keyId'])
|
account = account_from_key_id(signature_params['keyId'])
|
||||||
|
|
||||||
if account.nil?
|
if account.nil?
|
||||||
@signature_verification_failure_reason = "Public key not found for key #{signature_params['keyId']}"
|
|
||||||
@signed_request_account = nil
|
@signed_request_account = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -48,21 +41,10 @@ module SignatureVerification
|
|||||||
signature = Base64.decode64(signature_params['signature'])
|
signature = Base64.decode64(signature_params['signature'])
|
||||||
compare_signed_string = build_signed_string(signature_params['headers'])
|
compare_signed_string = build_signed_string(signature_params['headers'])
|
||||||
|
|
||||||
if account.keypair.public_key.verify(OpenSSL::Digest::SHA256.new, signature, compare_signed_string)
|
|
||||||
@signed_request_account = account
|
|
||||||
@signed_request_account
|
|
||||||
elsif account.possibly_stale?
|
|
||||||
account = account.refresh!
|
|
||||||
|
|
||||||
if account.keypair.public_key.verify(OpenSSL::Digest::SHA256.new, signature, compare_signed_string)
|
if account.keypair.public_key.verify(OpenSSL::Digest::SHA256.new, signature, compare_signed_string)
|
||||||
@signed_request_account = account
|
@signed_request_account = account
|
||||||
@signed_request_account
|
@signed_request_account
|
||||||
else
|
else
|
||||||
@signed_verification_failure_reason = "Verification failed for #{account.username}@#{account.domain} #{account.uri}"
|
|
||||||
@signed_request_account = nil
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@signed_verification_failure_reason = "Verification failed for #{account.username}@#{account.domain} #{account.uri}"
|
|
||||||
@signed_request_account = nil
|
@signed_request_account = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -117,7 +99,7 @@ module SignatureVerification
|
|||||||
ResolveRemoteAccountService.new.call(key_id.gsub(/\Aacct:/, ''))
|
ResolveRemoteAccountService.new.call(key_id.gsub(/\Aacct:/, ''))
|
||||||
elsif !ActivityPub::TagManager.instance.local_uri?(key_id)
|
elsif !ActivityPub::TagManager.instance.local_uri?(key_id)
|
||||||
account = ActivityPub::TagManager.instance.uri_to_resource(key_id, Account)
|
account = ActivityPub::TagManager.instance.uri_to_resource(key_id, Account)
|
||||||
account ||= ActivityPub::FetchRemoteKeyService.new.call(key_id, id: false)
|
account ||= ActivityPub::FetchRemoteKeyService.new.call(key_id)
|
||||||
account
|
account
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,14 +7,12 @@ module UserTrackingConcern
|
|||||||
UPDATE_SIGN_IN_HOURS = 24
|
UPDATE_SIGN_IN_HOURS = 24
|
||||||
|
|
||||||
included do
|
included do
|
||||||
before_action :set_user_activity
|
before_action :set_user_activity, if: %i(user_signed_in? user_needs_sign_in_update?)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_user_activity
|
def set_user_activity
|
||||||
return unless user_needs_sign_in_update?
|
|
||||||
|
|
||||||
# Mark as signed-in today
|
# Mark as signed-in today
|
||||||
current_user.update_tracked_fields!(request)
|
current_user.update_tracked_fields!(request)
|
||||||
|
|
||||||
@@ -23,7 +21,7 @@ module UserTrackingConcern
|
|||||||
end
|
end
|
||||||
|
|
||||||
def user_needs_sign_in_update?
|
def user_needs_sign_in_update?
|
||||||
user_signed_in? && (current_user.current_sign_in_at.nil? || current_user.current_sign_in_at < UPDATE_SIGN_IN_HOURS.hours.ago)
|
current_user.current_sign_in_at.nil? || current_user.current_sign_in_at < UPDATE_SIGN_IN_HOURS.hours.ago
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_needs_feed_update?
|
def user_needs_feed_update?
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class EmojisController < ApplicationController
|
|
||||||
before_action :set_emoji
|
|
||||||
|
|
||||||
def show
|
|
||||||
respond_to do |format|
|
|
||||||
format.json do
|
|
||||||
render json: @emoji,
|
|
||||||
serializer: ActivityPub::EmojiSerializer,
|
|
||||||
adapter: ActivityPub::Adapter,
|
|
||||||
content_type: 'application/activity+json'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_emoji
|
|
||||||
@emoji = CustomEmoji.local.find(params[:id])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -10,39 +10,19 @@ class FollowerAccountsController < ApplicationController
|
|||||||
format.html
|
format.html
|
||||||
|
|
||||||
format.json do
|
format.json do
|
||||||
render json: collection_presenter,
|
render json: collection_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
||||||
serializer: ActivityPub::CollectionSerializer,
|
|
||||||
adapter: ActivityPub::Adapter,
|
|
||||||
content_type: 'application/activity+json'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def page_url(page)
|
|
||||||
account_followers_url(@account, page: page) unless page.nil?
|
|
||||||
end
|
|
||||||
|
|
||||||
def collection_presenter
|
def collection_presenter
|
||||||
page = ActivityPub::CollectionPresenter.new(
|
|
||||||
id: account_followers_url(@account, page: params.fetch(:page, 1)),
|
|
||||||
type: :ordered,
|
|
||||||
size: @account.followers_count,
|
|
||||||
items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.account) },
|
|
||||||
part_of: account_followers_url(@account),
|
|
||||||
next: page_url(@follows.next_page),
|
|
||||||
prev: page_url(@follows.prev_page)
|
|
||||||
)
|
|
||||||
if params[:page].present?
|
|
||||||
page
|
|
||||||
else
|
|
||||||
ActivityPub::CollectionPresenter.new(
|
ActivityPub::CollectionPresenter.new(
|
||||||
id: account_followers_url(@account),
|
id: account_followers_url(@account),
|
||||||
type: :ordered,
|
type: :ordered,
|
||||||
size: @account.followers_count,
|
size: @account.followers_count,
|
||||||
first: page
|
items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.account) }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,39 +10,19 @@ class FollowingAccountsController < ApplicationController
|
|||||||
format.html
|
format.html
|
||||||
|
|
||||||
format.json do
|
format.json do
|
||||||
render json: collection_presenter,
|
render json: collection_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
||||||
serializer: ActivityPub::CollectionSerializer,
|
|
||||||
adapter: ActivityPub::Adapter,
|
|
||||||
content_type: 'application/activity+json'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def page_url(page)
|
|
||||||
account_following_index_url(@account, page: page) unless page.nil?
|
|
||||||
end
|
|
||||||
|
|
||||||
def collection_presenter
|
def collection_presenter
|
||||||
page = ActivityPub::CollectionPresenter.new(
|
|
||||||
id: account_following_index_url(@account, page: params.fetch(:page, 1)),
|
|
||||||
type: :ordered,
|
|
||||||
size: @account.following_count,
|
|
||||||
items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.target_account) },
|
|
||||||
part_of: account_following_index_url(@account),
|
|
||||||
next: page_url(@follows.next_page),
|
|
||||||
prev: page_url(@follows.prev_page)
|
|
||||||
)
|
|
||||||
if params[:page].present?
|
|
||||||
page
|
|
||||||
else
|
|
||||||
ActivityPub::CollectionPresenter.new(
|
ActivityPub::CollectionPresenter.new(
|
||||||
id: account_following_index_url(@account),
|
id: account_following_index_url(@account),
|
||||||
type: :ordered,
|
type: :ordered,
|
||||||
size: @account.following_count,
|
size: @account.following_count,
|
||||||
first: page
|
items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.target_account) }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,30 +12,7 @@ class HomeController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def authenticate_user!
|
def authenticate_user!
|
||||||
return if user_signed_in?
|
redirect_to(single_user_mode? ? account_path(Account.first) : about_path) unless user_signed_in?
|
||||||
|
|
||||||
matches = request.path.match(/\A\/web\/(statuses|accounts)\/([\d]+)\z/)
|
|
||||||
|
|
||||||
if matches
|
|
||||||
case matches[1]
|
|
||||||
when 'statuses'
|
|
||||||
status = Status.find_by(id: matches[2])
|
|
||||||
|
|
||||||
if status && (status.public_visibility? || status.unlisted_visibility?)
|
|
||||||
redirect_to(ActivityPub::TagManager.instance.url_for(status))
|
|
||||||
return
|
|
||||||
end
|
|
||||||
when 'accounts'
|
|
||||||
account = Account.find_by(id: matches[2])
|
|
||||||
|
|
||||||
if account
|
|
||||||
redirect_to(ActivityPub::TagManager.instance.url_for(account))
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_to(default_redirect_path)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_initial_state_json
|
def set_initial_state_json
|
||||||
@@ -52,14 +29,4 @@ class HomeController < ApplicationController
|
|||||||
admin: Account.find_local(Setting.site_contact_username),
|
admin: Account.find_local(Setting.site_contact_username),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_redirect_path
|
|
||||||
if request.path.start_with?('/web')
|
|
||||||
new_user_session_path
|
|
||||||
elsif single_user_mode?
|
|
||||||
short_account_path(Account.first)
|
|
||||||
else
|
|
||||||
about_path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ManifestsController < ApplicationController
|
class ManifestsController < ApplicationController
|
||||||
def show
|
before_action :set_instance_presenter
|
||||||
render json: InstancePresenter.new, serializer: ManifestSerializer
|
|
||||||
|
def show; end
|
||||||
|
|
||||||
|
def set_instance_presenter
|
||||||
|
@instance_presenter = InstancePresenter.new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class MediaProxyController < ApplicationController
|
|
||||||
include RoutingHelper
|
|
||||||
|
|
||||||
def show
|
|
||||||
RedisLock.acquire(lock_options) do |lock|
|
|
||||||
if lock.acquired?
|
|
||||||
@media_attachment = MediaAttachment.remote.find(params[:id])
|
|
||||||
redownload! if @media_attachment.needs_redownload? && !reject_media?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_to full_asset_url(@media_attachment.file.url(version))
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def redownload!
|
|
||||||
@media_attachment.file_remote_url = @media_attachment.remote_url
|
|
||||||
@media_attachment.created_at = Time.now.utc
|
|
||||||
@media_attachment.save!
|
|
||||||
end
|
|
||||||
|
|
||||||
def version
|
|
||||||
if request.path.ends_with?('/small')
|
|
||||||
:small
|
|
||||||
else
|
|
||||||
:original
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def lock_options
|
|
||||||
{ redis: Redis.current, key: "media_download:#{params[:id]}" }
|
|
||||||
end
|
|
||||||
|
|
||||||
def reject_media?
|
|
||||||
DomainBlock.find_by(domain: @media_attachment.account.domain)&.reject_media?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -9,7 +9,7 @@ class Settings::FollowerDomainsController < ApplicationController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
@account = current_account
|
@account = current_account
|
||||||
@domains = current_account.followers.reorder('MIN(follows.id) DESC').group('accounts.domain').select('accounts.domain, count(accounts.id) as accounts_from_domain').page(params[:page]).per(10)
|
@domains = current_account.followers.reorder(nil).group('accounts.domain').select('accounts.domain, count(accounts.id) as accounts_from_domain').page(params[:page]).per(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Settings::KeywordMutesController < ApplicationController
|
|
||||||
layout 'admin'
|
|
||||||
|
|
||||||
before_action :authenticate_user!
|
|
||||||
before_action :load_keyword_mute, only: [:edit, :update, :destroy]
|
|
||||||
|
|
||||||
def index
|
|
||||||
@keyword_mutes = paginated_keyword_mutes_for_account
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
@keyword_mute = keyword_mutes_for_account.build
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@keyword_mute = keyword_mutes_for_account.create(keyword_mute_params)
|
|
||||||
|
|
||||||
if @keyword_mute.persisted?
|
|
||||||
redirect_to settings_keyword_mutes_path, notice: I18n.t('generic.changes_saved_msg')
|
|
||||||
else
|
|
||||||
render :new
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
if @keyword_mute.update(keyword_mute_params)
|
|
||||||
redirect_to settings_keyword_mutes_path, notice: I18n.t('generic.changes_saved_msg')
|
|
||||||
else
|
|
||||||
render :edit
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
|
||||||
@keyword_mute.destroy!
|
|
||||||
|
|
||||||
redirect_to settings_keyword_mutes_path, notice: I18n.t('generic.changes_saved_msg')
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy_all
|
|
||||||
keyword_mutes_for_account.delete_all
|
|
||||||
|
|
||||||
redirect_to settings_keyword_mutes_path, notice: I18n.t('generic.changes_saved_msg')
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def keyword_mutes_for_account
|
|
||||||
Glitch::KeywordMute.where(account: current_account)
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_keyword_mute
|
|
||||||
@keyword_mute = keyword_mutes_for_account.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def keyword_mute_params
|
|
||||||
params.require(:keyword_mute).permit(:keyword, :whole_word)
|
|
||||||
end
|
|
||||||
|
|
||||||
def paginated_keyword_mutes_for_account
|
|
||||||
keyword_mutes_for_account.order(:keyword).page params[:page]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Settings::NotificationsController < ApplicationController
|
|
||||||
layout 'admin'
|
|
||||||
|
|
||||||
before_action :authenticate_user!
|
|
||||||
|
|
||||||
def show; end
|
|
||||||
|
|
||||||
def update
|
|
||||||
user_settings.update(user_settings_params.to_h)
|
|
||||||
|
|
||||||
if current_user.save
|
|
||||||
redirect_to settings_notifications_path, notice: I18n.t('generic.changes_saved_msg')
|
|
||||||
else
|
|
||||||
render :show
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def user_settings
|
|
||||||
UserSettingsDecorator.new(current_user)
|
|
||||||
end
|
|
||||||
|
|
||||||
def user_settings_params
|
|
||||||
params.require(:user).permit(
|
|
||||||
notification_emails: %i(follow follow_request reblog favourite mention digest),
|
|
||||||
interactions: %i(must_be_follower must_be_following must_be_following_dm)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -39,10 +39,8 @@ class Settings::PreferencesController < ApplicationController
|
|||||||
:setting_boost_modal,
|
:setting_boost_modal,
|
||||||
:setting_delete_modal,
|
:setting_delete_modal,
|
||||||
:setting_auto_play_gif,
|
:setting_auto_play_gif,
|
||||||
:setting_reduce_motion,
|
|
||||||
:setting_system_font_ui,
|
:setting_system_font_ui,
|
||||||
:setting_noindex,
|
:setting_noindex,
|
||||||
:setting_theme,
|
|
||||||
notification_emails: %i(follow follow_request reblog favourite mention digest),
|
notification_emails: %i(follow follow_request reblog favourite mention digest),
|
||||||
interactions: %i(must_be_follower must_be_following)
|
interactions: %i(must_be_follower must_be_following)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -21,19 +21,13 @@ class StatusesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
format.json do
|
format.json do
|
||||||
render json: @status,
|
render json: @status, serializer: ActivityPub::NoteSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
||||||
serializer: ActivityPub::NoteSerializer,
|
|
||||||
adapter: ActivityPub::Adapter,
|
|
||||||
content_type: 'application/activity+json'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def activity
|
def activity
|
||||||
render json: @status,
|
render json: @status, serializer: ActivityPub::ActivitySerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
||||||
serializer: ActivityPub::ActivitySerializer,
|
|
||||||
adapter: ActivityPub::Adapter,
|
|
||||||
content_type: 'application/activity+json'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def embed
|
def embed
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class StreamEntriesController < ApplicationController
|
|||||||
@type = @stream_entry.activity_type.downcase
|
@type = @stream_entry.activity_type.downcase
|
||||||
|
|
||||||
raise ActiveRecord::RecordNotFound if @stream_entry.activity.nil?
|
raise ActiveRecord::RecordNotFound if @stream_entry.activity.nil?
|
||||||
authorize @stream_entry.activity, :show? if @stream_entry.hidden? || @stream_entry.local_only?
|
authorize @stream_entry.activity, :show? if @stream_entry.hidden?
|
||||||
rescue Mastodon::NotPermittedError
|
rescue Mastodon::NotPermittedError
|
||||||
# Reraise in order to get a 404
|
# Reraise in order to get a 404
|
||||||
raise ActiveRecord::RecordNotFound
|
raise ActiveRecord::RecordNotFound
|
||||||
|
|||||||
@@ -1,40 +1,24 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class TagsController < ApplicationController
|
class TagsController < ApplicationController
|
||||||
before_action :set_body_classes
|
layout 'public'
|
||||||
before_action :set_instance_presenter
|
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@tag = Tag.find_by!(name: params[:id].downcase)
|
@tag = Tag.find_by!(name: params[:id].downcase)
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html do
|
|
||||||
serializable_resource = ActiveModelSerializers::SerializableResource.new(InitialStatePresenter.new(initial_state_params), serializer: InitialStateSerializer)
|
|
||||||
@initial_state_json = serializable_resource.to_json
|
|
||||||
end
|
|
||||||
|
|
||||||
format.json do
|
|
||||||
@statuses = Status.as_tag_timeline(@tag, current_account, params[:local]).paginate_by_max_id(20, params[:max_id])
|
@statuses = Status.as_tag_timeline(@tag, current_account, params[:local]).paginate_by_max_id(20, params[:max_id])
|
||||||
@statuses = cache_collection(@statuses, Status)
|
@statuses = cache_collection(@statuses, Status)
|
||||||
|
|
||||||
render json: collection_presenter,
|
respond_to do |format|
|
||||||
serializer: ActivityPub::CollectionSerializer,
|
format.html
|
||||||
adapter: ActivityPub::Adapter,
|
|
||||||
content_type: 'application/activity+json'
|
format.json do
|
||||||
|
render json: collection_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_body_classes
|
|
||||||
@body_classes = 'tag-body'
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_instance_presenter
|
|
||||||
@instance_presenter = InstancePresenter.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def collection_presenter
|
def collection_presenter
|
||||||
ActivityPub::CollectionPresenter.new(
|
ActivityPub::CollectionPresenter.new(
|
||||||
id: tag_url(@tag),
|
id: tag_url(@tag),
|
||||||
@@ -43,11 +27,4 @@ class TagsController < ApplicationController
|
|||||||
items: @statuses.map { |s| ActivityPub::TagManager.instance.uri_for(s) }
|
items: @statuses.map { |s| ActivityPub::TagManager.instance.uri_for(s) }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def initial_state_params
|
|
||||||
{
|
|
||||||
settings: {},
|
|
||||||
token: current_session&.token,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Admin::AccountModerationNotesHelper
|
|
||||||
end
|
|
||||||
@@ -18,7 +18,7 @@ module Admin::FilterHelper
|
|||||||
|
|
||||||
def selected?(more_params)
|
def selected?(more_params)
|
||||||
new_url = filtered_url_for(more_params)
|
new_url = filtered_url_for(more_params)
|
||||||
filter_link_class(new_url) == 'selected'
|
filter_link_class(new_url) == 'selected' ? true : false
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -35,11 +35,6 @@ module ApplicationHelper
|
|||||||
Rails.env.production? ? site_title : "#{site_title} (Dev)"
|
Rails.env.production? ? site_title : "#{site_title} (Dev)"
|
||||||
end
|
end
|
||||||
|
|
||||||
def can?(action, record)
|
|
||||||
return false if record.nil?
|
|
||||||
policy(record).public_send("#{action}?")
|
|
||||||
end
|
|
||||||
|
|
||||||
def fa_icon(icon, attributes = {})
|
def fa_icon(icon, attributes = {})
|
||||||
class_names = attributes[:class]&.split(' ') || []
|
class_names = attributes[:class]&.split(' ') || []
|
||||||
class_names << 'fa'
|
class_names << 'fa'
|
||||||
@@ -47,12 +42,4 @@ module ApplicationHelper
|
|||||||
|
|
||||||
content_tag(:i, nil, attributes.merge(class: class_names.join(' ')))
|
content_tag(:i, nil, attributes.merge(class: class_names.join(' ')))
|
||||||
end
|
end
|
||||||
|
|
||||||
def custom_emoji_tag(custom_emoji)
|
|
||||||
image_tag(custom_emoji.image.url, class: 'emojione', alt: ":#{custom_emoji.shortcode}:")
|
|
||||||
end
|
|
||||||
|
|
||||||
def opengraph(property, content)
|
|
||||||
tag(:meta, content: content, property: property)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
24
app/helpers/emoji_helper.rb
Normal file
24
app/helpers/emoji_helper.rb
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module EmojiHelper
|
||||||
|
def emojify(text)
|
||||||
|
return text if text.blank?
|
||||||
|
|
||||||
|
text.gsub(emoji_pattern) do |match|
|
||||||
|
emoji = Emoji.instance.unicode($1) # rubocop:disable Style/PerlBackrefs
|
||||||
|
|
||||||
|
if emoji
|
||||||
|
emoji
|
||||||
|
else
|
||||||
|
match
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def emoji_pattern
|
||||||
|
@emoji_pattern ||=
|
||||||
|
/(?<=[^[:alnum:]:]|\n|^)
|
||||||
|
(#{Emoji.instance.names.map { |name| Regexp.escape(name) }.join('|')})
|
||||||
|
(?=[^[:alnum:]:]|$)/x
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -9,10 +9,6 @@ module JsonLdHelper
|
|||||||
value.is_a?(Array) ? value.first : value
|
value.is_a?(Array) ? value.first : value
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_array(value)
|
|
||||||
value.is_a?(Array) ? value : [value]
|
|
||||||
end
|
|
||||||
|
|
||||||
def value_or_id(value)
|
def value_or_id(value)
|
||||||
value.is_a?(String) || value.nil? ? value : value['id']
|
value.is_a?(String) || value.nil? ? value : value['id']
|
||||||
end
|
end
|
||||||
@@ -26,18 +22,7 @@ module JsonLdHelper
|
|||||||
graph.dump(:normalize)
|
graph.dump(:normalize)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_resource(uri, id)
|
def fetch_resource(uri)
|
||||||
unless id
|
|
||||||
json = fetch_resource_without_id_validation(uri)
|
|
||||||
return unless json
|
|
||||||
uri = json['id']
|
|
||||||
end
|
|
||||||
|
|
||||||
json = fetch_resource_without_id_validation(uri)
|
|
||||||
json.present? && json['id'] == uri ? json : nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def fetch_resource_without_id_validation(uri)
|
|
||||||
response = build_request(uri).perform
|
response = build_request(uri).perform
|
||||||
return if response.code != 200
|
return if response.code != 200
|
||||||
body_to_json(response.to_s)
|
body_to_json(response.to_s)
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
module Settings::KeywordMutesHelper
|
|
||||||
end
|
|
||||||
@@ -27,7 +27,6 @@ module SettingsHelper
|
|||||||
pt: 'Português',
|
pt: 'Português',
|
||||||
'pt-BR': 'Português do Brasil',
|
'pt-BR': 'Português do Brasil',
|
||||||
ru: 'Русский',
|
ru: 'Русский',
|
||||||
sv: 'Svenska',
|
|
||||||
th: 'ภาษาไทย',
|
th: 'ภาษาไทย',
|
||||||
tr: 'Türkçe',
|
tr: 'Türkçe',
|
||||||
uk: 'Українська',
|
uk: 'Українська',
|
||||||
@@ -42,7 +41,7 @@ module SettingsHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def filterable_languages
|
def filterable_languages
|
||||||
LanguageDetector.instance.language_names.select(&HUMAN_LOCALES.method(:key?))
|
I18n.available_locales.map { |locale| locale.to_s.split('-').first.to_sym }.uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
def hash_to_object(hash)
|
def hash_to_object(hash)
|
||||||
|
|||||||
@@ -44,14 +44,14 @@ Imports:
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import escapeTextContentForBrowser from 'escape-html';
|
||||||
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
|
||||||
// Mastodon imports //
|
// Mastodon imports //
|
||||||
import emojify from '../../../mastodon/features/emoji/emoji';
|
import emojify from '../../../mastodon/emoji';
|
||||||
import IconButton from '../../../mastodon/components/icon_button';
|
import IconButton from '../../../mastodon/components/icon_button';
|
||||||
import Avatar from '../../../mastodon/components/avatar';
|
import Avatar from '../../../mastodon/components/avatar';
|
||||||
import { me } from '../../../mastodon/initial_state';
|
|
||||||
|
|
||||||
// Our imports //
|
// Our imports //
|
||||||
import { processBio } from '../../util/bio_metadata';
|
import { processBio } from '../../util/bio_metadata';
|
||||||
@@ -89,6 +89,7 @@ export default class AccountHeader extends ImmutablePureComponent {
|
|||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
account : ImmutablePropTypes.map,
|
account : ImmutablePropTypes.map,
|
||||||
|
me : PropTypes.number.isRequired,
|
||||||
onFollow : PropTypes.func.isRequired,
|
onFollow : PropTypes.func.isRequired,
|
||||||
intl : PropTypes.object.isRequired,
|
intl : PropTypes.object.isRequired,
|
||||||
};
|
};
|
||||||
@@ -102,7 +103,7 @@ The `render()` function is used to render our component.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { account, intl } = this.props;
|
const { account, me, intl } = this.props;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -116,11 +117,15 @@ then we set the `displayName` to just be the `username` of the account.
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let displayName = account.get('display_name_html');
|
let displayName = account.get('display_name');
|
||||||
let info = '';
|
let info = '';
|
||||||
let actionBtn = '';
|
let actionBtn = '';
|
||||||
let following = false;
|
let following = false;
|
||||||
|
|
||||||
|
if (displayName.length === 0) {
|
||||||
|
displayName = account.get('username');
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Next, we handle the account relationships. If the account follows the
|
Next, we handle the account relationships. If the account follows the
|
||||||
@@ -152,7 +157,7 @@ appropriate icon.
|
|||||||
<IconButton
|
<IconButton
|
||||||
size={26}
|
size={26}
|
||||||
icon={following ? 'user-times' : 'user-plus'}
|
icon={following ? 'user-times' : 'user-plus'}
|
||||||
active={following ? true : false}
|
active={following}
|
||||||
title={intl.formatMessage(following ? messages.unfollow : messages.follow)}
|
title={intl.formatMessage(following ? messages.unfollow : messages.follow)}
|
||||||
onClick={this.props.onFollow}
|
onClick={this.props.onFollow}
|
||||||
/>
|
/>
|
||||||
@@ -162,11 +167,16 @@ appropriate icon.
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
we extract the `text` and
|
|
||||||
|
`displayNameHTML` processes the `displayName` and prepares it for
|
||||||
|
insertion into the document. Meanwhile, we extract the `text` and
|
||||||
`metadata` from our account's `note` using `processBio()`.
|
`metadata` from our account's `note` using `processBio()`.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const displayNameHTML = {
|
||||||
|
__html : emojify(escapeTextContentForBrowser(displayName)),
|
||||||
|
};
|
||||||
const { text, metadata } = processBio(account.get('note'));
|
const { text, metadata } = processBio(account.get('note'));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -188,7 +198,7 @@ Here, we render our component using all the things we've defined above.
|
|||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className='account__header__display-name'
|
className='account__header__display-name'
|
||||||
dangerouslySetInnerHTML={{ __html: displayName }}
|
dangerouslySetInnerHTML={displayNameHTML}
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<span className='account__header__username'>
|
<span className='account__header__username'>
|
||||||
|
|||||||
@@ -47,9 +47,11 @@ import PropTypes from 'prop-types';
|
|||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { injectIntl, defineMessages } from 'react-intl';
|
import { injectIntl, defineMessages } from 'react-intl';
|
||||||
|
|
||||||
|
// Mastodon imports //
|
||||||
|
import IconButton from '../../../../mastodon/components/icon_button';
|
||||||
|
|
||||||
// Our imports //
|
// Our imports //
|
||||||
import ComposeAdvancedOptionsToggle from './toggle';
|
import ComposeAdvancedOptionsToggle from './toggle';
|
||||||
import ComposeDropdown from '../dropdown/index';
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
@@ -75,6 +77,11 @@ const messages = defineMessages({
|
|||||||
{ id: 'advanced_options.icon_title', defaultMessage: 'Advanced options' },
|
{ id: 'advanced_options.icon_title', defaultMessage: 'Advanced options' },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const iconStyle = {
|
||||||
|
height : null,
|
||||||
|
lineHeight : '27px',
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Implementation:
|
Implementation:
|
||||||
@@ -93,6 +100,67 @@ export default class ComposeAdvancedOptions extends React.PureComponent {
|
|||||||
intl : PropTypes.object.isRequired,
|
intl : PropTypes.object.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
state = {
|
||||||
|
open: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
### `onToggleDropdown()`
|
||||||
|
|
||||||
|
This function toggles the opening and closing of the advanced options
|
||||||
|
dropdown.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
onToggleDropdown = () => {
|
||||||
|
this.setState({ open: !this.state.open });
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
### `onGlobalClick(e)`
|
||||||
|
|
||||||
|
This function closes the advanced options dropdown if you click
|
||||||
|
anywhere else on the screen.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
onGlobalClick = (e) => {
|
||||||
|
if (e.target !== this.node && !this.node.contains(e.target) && this.state.open) {
|
||||||
|
this.setState({ open: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
### `componentDidMount()`, `componentWillUnmount()`
|
||||||
|
|
||||||
|
This function closes the advanced options dropdown if you click
|
||||||
|
anywhere else on the screen.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
componentDidMount () {
|
||||||
|
window.addEventListener('click', this.onGlobalClick);
|
||||||
|
window.addEventListener('touchstart', this.onGlobalClick);
|
||||||
|
}
|
||||||
|
componentWillUnmount () {
|
||||||
|
window.removeEventListener('click', this.onGlobalClick);
|
||||||
|
window.removeEventListener('touchstart', this.onGlobalClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
### `setRef(c)`
|
||||||
|
|
||||||
|
`setRef()` stores a reference to the dropdown's `<div> in `this.node`.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
setRef = (c) => {
|
||||||
|
this.node = c;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -103,6 +171,7 @@ export default class ComposeAdvancedOptions extends React.PureComponent {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
const { open } = this.state;
|
||||||
const { intl, values } = this.props;
|
const { intl, values } = this.props;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -149,14 +218,23 @@ toggle as its `key` so that React can keep track of it.
|
|||||||
Finally, we can render our component.
|
Finally, we can render our component.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ComposeDropdown
|
<div ref={this.setRef} className={`advanced-options-dropdown ${open ? 'open' : ''} ${anyEnabled ? 'active' : ''} `}>
|
||||||
|
<div className='advanced-options-dropdown__value'>
|
||||||
|
<IconButton
|
||||||
|
className='advanced-options-dropdown__value'
|
||||||
title={intl.formatMessage(messages.advanced_options_icon_title)}
|
title={intl.formatMessage(messages.advanced_options_icon_title)}
|
||||||
icon='home'
|
icon='ellipsis-h' active={open || anyEnabled}
|
||||||
highlight={anyEnabled}
|
size={18}
|
||||||
>
|
style={iconStyle}
|
||||||
|
onClick={this.onToggleDropdown}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className='advanced-options-dropdown__dropdown'>
|
||||||
{optionElems}
|
{optionElems}
|
||||||
</ComposeDropdown>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,133 +0,0 @@
|
|||||||
// Package imports //
|
|
||||||
import React from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { injectIntl, defineMessages } from 'react-intl';
|
|
||||||
|
|
||||||
// Our imports //
|
|
||||||
import ComposeDropdown from '../dropdown/index';
|
|
||||||
import { uploadCompose } from '../../../../mastodon/actions/compose';
|
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
|
||||||
import { openModal } from '../../../../mastodon/actions/modal';
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
|
|
||||||
const messages = defineMessages({
|
|
||||||
upload :
|
|
||||||
{ id: 'compose.attach.upload', defaultMessage: 'Upload a file' },
|
|
||||||
doodle :
|
|
||||||
{ id: 'compose.attach.doodle', defaultMessage: 'Draw something' },
|
|
||||||
attach :
|
|
||||||
{ id: 'compose.attach', defaultMessage: 'Attach...' },
|
|
||||||
});
|
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
|
||||||
// This horrible expression is copied from vanilla upload_button_container
|
|
||||||
disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size > 3 || state.getIn(['compose', 'media_attachments']).some(m => m.get('type') === 'video')),
|
|
||||||
resetFileKey: state.getIn(['compose', 'resetFileKey']),
|
|
||||||
acceptContentTypes: state.getIn(['media_attachments', 'accept_content_types']),
|
|
||||||
});
|
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
|
||||||
onSelectFile (files) {
|
|
||||||
dispatch(uploadCompose(files));
|
|
||||||
},
|
|
||||||
onOpenDoodle () {
|
|
||||||
dispatch(openModal('DOODLE', { noEsc: true }));
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
@injectIntl
|
|
||||||
@connect(mapStateToProps, mapDispatchToProps)
|
|
||||||
export default class ComposeAttachOptions extends ImmutablePureComponent {
|
|
||||||
|
|
||||||
static propTypes = {
|
|
||||||
intl : PropTypes.object.isRequired,
|
|
||||||
resetFileKey: PropTypes.number,
|
|
||||||
acceptContentTypes: ImmutablePropTypes.listOf(PropTypes.string).isRequired,
|
|
||||||
disabled: PropTypes.bool,
|
|
||||||
onSelectFile: PropTypes.func.isRequired,
|
|
||||||
onOpenDoodle: PropTypes.func.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
handleItemClick = bt => {
|
|
||||||
if (bt === 'upload') {
|
|
||||||
this.fileElement.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bt === 'doodle') {
|
|
||||||
this.props.onOpenDoodle();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.dropdown.setState({ open: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
handleFileChange = (e) => {
|
|
||||||
if (e.target.files.length > 0) {
|
|
||||||
this.props.onSelectFile(e.target.files);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setFileRef = (c) => {
|
|
||||||
this.fileElement = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
setDropdownRef = (c) => {
|
|
||||||
this.dropdown = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
render () {
|
|
||||||
const { intl, resetFileKey, disabled, acceptContentTypes } = this.props;
|
|
||||||
|
|
||||||
const options = [
|
|
||||||
{ icon: 'cloud-upload', text: messages.upload, name: 'upload' },
|
|
||||||
{ icon: 'paint-brush', text: messages.doodle, name: 'doodle' },
|
|
||||||
];
|
|
||||||
|
|
||||||
const optionElems = options.map((item) => {
|
|
||||||
const hdl = () => this.handleItemClick(item.name);
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
role='button'
|
|
||||||
tabIndex='0'
|
|
||||||
key={item.name}
|
|
||||||
onClick={hdl}
|
|
||||||
className='privacy-dropdown__option'
|
|
||||||
>
|
|
||||||
<div className='privacy-dropdown__option__icon'>
|
|
||||||
<i className={`fa fa-fw fa-${item.icon}`} />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className='privacy-dropdown__option__content'>
|
|
||||||
<strong>{intl.formatMessage(item.text)}</strong>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<ComposeDropdown
|
|
||||||
title={intl.formatMessage(messages.attach)}
|
|
||||||
icon='paperclip'
|
|
||||||
disabled={disabled}
|
|
||||||
ref={this.setDropdownRef}
|
|
||||||
>
|
|
||||||
{optionElems}
|
|
||||||
</ComposeDropdown>
|
|
||||||
<input
|
|
||||||
key={resetFileKey}
|
|
||||||
ref={this.setFileRef}
|
|
||||||
type='file'
|
|
||||||
multiple={false}
|
|
||||||
accept={acceptContentTypes.toArray().join(',')}
|
|
||||||
onChange={this.handleFileChange}
|
|
||||||
disabled={disabled}
|
|
||||||
style={{ display: 'none' }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
// Package imports //
|
|
||||||
import React from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
// Mastodon imports //
|
|
||||||
import IconButton from '../../../../mastodon/components/icon_button';
|
|
||||||
|
|
||||||
const iconStyle = {
|
|
||||||
height : null,
|
|
||||||
lineHeight : '27px',
|
|
||||||
};
|
|
||||||
|
|
||||||
export default class ComposeDropdown extends React.PureComponent {
|
|
||||||
|
|
||||||
static propTypes = {
|
|
||||||
title: PropTypes.string.isRequired,
|
|
||||||
icon: PropTypes.string,
|
|
||||||
highlight: PropTypes.bool,
|
|
||||||
disabled: PropTypes.bool,
|
|
||||||
children: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
state = {
|
|
||||||
open: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
onGlobalClick = (e) => {
|
|
||||||
if (e.target !== this.node && !this.node.contains(e.target) && this.state.open) {
|
|
||||||
this.setState({ open: false });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
componentDidMount () {
|
|
||||||
window.addEventListener('click', this.onGlobalClick);
|
|
||||||
window.addEventListener('touchstart', this.onGlobalClick);
|
|
||||||
}
|
|
||||||
componentWillUnmount () {
|
|
||||||
window.removeEventListener('click', this.onGlobalClick);
|
|
||||||
window.removeEventListener('touchstart', this.onGlobalClick);
|
|
||||||
}
|
|
||||||
|
|
||||||
onToggleDropdown = () => {
|
|
||||||
if (this.props.disabled) return;
|
|
||||||
this.setState({ open: !this.state.open });
|
|
||||||
};
|
|
||||||
|
|
||||||
setRef = (c) => {
|
|
||||||
this.node = c;
|
|
||||||
};
|
|
||||||
|
|
||||||
render () {
|
|
||||||
const { open } = this.state;
|
|
||||||
let { highlight, title, icon, disabled } = this.props;
|
|
||||||
|
|
||||||
if (!icon) icon = 'ellipsis-h';
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div ref={this.setRef} className={`advanced-options-dropdown ${open ? 'open' : ''} ${highlight ? 'active' : ''} `}>
|
|
||||||
<div className='advanced-options-dropdown__value'>
|
|
||||||
<IconButton
|
|
||||||
className={'inverted'}
|
|
||||||
title={title}
|
|
||||||
icon={icon} active={open || highlight}
|
|
||||||
size={18}
|
|
||||||
style={iconStyle}
|
|
||||||
disabled={disabled}
|
|
||||||
onClick={this.onToggleDropdown}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className='advanced-options-dropdown__dropdown'>
|
|
||||||
{this.props.children}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
// Mastodon imports //
|
// Mastodon imports //
|
||||||
import { closeModal } from '../../../mastodon/actions/modal';
|
import { closeModal } from 'mastodon/actions/modal';
|
||||||
|
|
||||||
// Our imports //
|
// Our imports //
|
||||||
import { changeLocalSetting } from '../../../glitch/actions/local_settings';
|
import { changeLocalSetting } from 'glitch/actions/local_settings';
|
||||||
import LocalSettings from '.';
|
import LocalSettings from '.';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import LocalSettingsPage from './page';
|
|||||||
import LocalSettingsNavigation from './navigation';
|
import LocalSettingsNavigation from './navigation';
|
||||||
|
|
||||||
// Stylesheet imports
|
// Stylesheet imports
|
||||||
import './style.scss';
|
import './style';
|
||||||
|
|
||||||
export default class LocalSettings extends React.PureComponent {
|
export default class LocalSettings extends React.PureComponent {
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { injectIntl, defineMessages } from 'react-intl';
|
|||||||
import LocalSettingsNavigationItem from './item';
|
import LocalSettingsNavigationItem from './item';
|
||||||
|
|
||||||
// Stylesheet imports
|
// Stylesheet imports
|
||||||
import './style.scss';
|
import './style';
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
// Stylesheet imports
|
// Stylesheet imports
|
||||||
import './style.scss';
|
import './style';
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import 'styles/mastodon/variables';
|
@import 'variables';
|
||||||
|
|
||||||
.glitch.local-settings__navigation__item {
|
.glitch.local-settings__navigation__item {
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import 'styles/mastodon/variables';
|
@import 'variables';
|
||||||
|
|
||||||
.glitch.local-settings__navigation {
|
.glitch.local-settings__navigation {
|
||||||
background: $primary-text-color;
|
background: $primary-text-color;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
|
|||||||
import LocalSettingsPageItem from './item';
|
import LocalSettingsPageItem from './item';
|
||||||
|
|
||||||
// Stylesheet imports
|
// Stylesheet imports
|
||||||
import './style.scss';
|
import './style';
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
@@ -16,7 +16,6 @@ const messages = defineMessages({
|
|||||||
layout_auto: { id: 'layout.auto', defaultMessage: 'Auto' },
|
layout_auto: { id: 'layout.auto', defaultMessage: 'Auto' },
|
||||||
layout_desktop: { id: 'layout.desktop', defaultMessage: 'Desktop' },
|
layout_desktop: { id: 'layout.desktop', defaultMessage: 'Desktop' },
|
||||||
layout_mobile: { id: 'layout.single', defaultMessage: 'Mobile' },
|
layout_mobile: { id: 'layout.single', defaultMessage: 'Mobile' },
|
||||||
side_arm_none: { id: 'settings.side_arm.none', defaultMessage: 'None' },
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@injectIntl
|
@injectIntl
|
||||||
@@ -62,24 +61,6 @@ export default class LocalSettingsPage extends React.PureComponent {
|
|||||||
>
|
>
|
||||||
<FormattedMessage id='settings.navbar_under' defaultMessage='Navbar at the bottom (Mobile only)' />
|
<FormattedMessage id='settings.navbar_under' defaultMessage='Navbar at the bottom (Mobile only)' />
|
||||||
</LocalSettingsPageItem>
|
</LocalSettingsPageItem>
|
||||||
<section>
|
|
||||||
<h2><FormattedMessage id='settings.compose_box_opts' defaultMessage='Compose box options' /></h2>
|
|
||||||
<LocalSettingsPageItem
|
|
||||||
settings={settings}
|
|
||||||
item={['side_arm']}
|
|
||||||
id='mastodon-settings--side_arm'
|
|
||||||
options={[
|
|
||||||
{ value: 'none', message: intl.formatMessage(messages.side_arm_none) },
|
|
||||||
{ value: 'direct', message: intl.formatMessage({ id: 'privacy.direct.short' }) },
|
|
||||||
{ value: 'private', message: intl.formatMessage({ id: 'privacy.private.short' }) },
|
|
||||||
{ value: 'unlisted', message: intl.formatMessage({ id: 'privacy.unlisted.short' }) },
|
|
||||||
{ value: 'public', message: intl.formatMessage({ id: 'privacy.public.short' }) },
|
|
||||||
]}
|
|
||||||
onChange={onChange}
|
|
||||||
>
|
|
||||||
<FormattedMessage id='settings.side_arm' defaultMessage='Secondary toot button:' />
|
|
||||||
</LocalSettingsPageItem>
|
|
||||||
</section>
|
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
({ onChange, settings }) => (
|
({ onChange, settings }) => (
|
||||||
@@ -124,16 +105,6 @@ export default class LocalSettingsPage extends React.PureComponent {
|
|||||||
>
|
>
|
||||||
<FormattedMessage id='settings.auto_collapse_lengthy' defaultMessage='Lengthy toots' />
|
<FormattedMessage id='settings.auto_collapse_lengthy' defaultMessage='Lengthy toots' />
|
||||||
</LocalSettingsPageItem>
|
</LocalSettingsPageItem>
|
||||||
<LocalSettingsPageItem
|
|
||||||
settings={settings}
|
|
||||||
item={['collapsed', 'auto', 'reblogs']}
|
|
||||||
id='mastodon-settings--collapsed-auto-reblogs'
|
|
||||||
onChange={onChange}
|
|
||||||
dependsOn={[['collapsed', 'enabled']]}
|
|
||||||
dependsOnNot={[['collapsed', 'auto', 'all']]}
|
|
||||||
>
|
|
||||||
<FormattedMessage id='settings.auto_collapse_reblogs' defaultMessage='Boosts' />
|
|
||||||
</LocalSettingsPageItem>
|
|
||||||
<LocalSettingsPageItem
|
<LocalSettingsPageItem
|
||||||
settings={settings}
|
settings={settings}
|
||||||
item={['collapsed', 'auto', 'replies']}
|
item={['collapsed', 'auto', 'replies']}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
|
||||||
// Stylesheet imports
|
// Stylesheet imports
|
||||||
import './style.scss';
|
import './style';
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import 'styles/mastodon/variables';
|
@import 'variables';
|
||||||
|
|
||||||
.glitch.local-settings__page__item {
|
.glitch.local-settings__page__item {
|
||||||
select {
|
select {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import 'styles/mastodon/variables';
|
@import 'variables';
|
||||||
|
|
||||||
.glitch.local-settings__page {
|
.glitch.local-settings__page {
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import 'styles/mastodon/variables';
|
@import 'variables';
|
||||||
|
|
||||||
.glitch.local-settings {
|
.glitch.local-settings {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -19,30 +19,38 @@ Imports:
|
|||||||
// Package imports //
|
// Package imports //
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
|
// Mastodon imports //
|
||||||
|
import { makeGetNotification } from '../../../mastodon/selectors';
|
||||||
|
|
||||||
// Our imports //
|
// Our imports //
|
||||||
import Notification from '.';
|
import Notification from '.';
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
const mapStateToProps = (state, props) => {
|
/*
|
||||||
// replace account id with object
|
|
||||||
let leNotif = props.notification.set('account', state.getIn(['accounts', props.notification.get('account')]));
|
|
||||||
|
|
||||||
// populate markedForDelete from state - is mysteriously lost somewhere
|
State mapping:
|
||||||
for (let n of state.getIn(['notifications', 'items'])) {
|
--------------
|
||||||
if (n.get('id') === props.notification.get('id')) {
|
|
||||||
leNotif = leNotif.set('markedForDelete', n.get('markedForDelete'));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ({
|
The `mapStateToProps()` function maps various state properties to the
|
||||||
notification: leNotif,
|
props of our component. We wrap this in `makeMapStateToProps()` so that
|
||||||
|
we only have to call `makeGetNotification()` once instead of every
|
||||||
|
time.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
const makeMapStateToProps = () => {
|
||||||
|
const getNotification = makeGetNotification();
|
||||||
|
|
||||||
|
const mapStateToProps = (state, props) => ({
|
||||||
|
notification: getNotification(state, props.notification, props.accountId),
|
||||||
settings: state.get('local_settings'),
|
settings: state.get('local_settings'),
|
||||||
notifCleaning: state.getIn(['notifications', 'cleaningMode']),
|
notifCleaning: state.getIn(['notifications', 'cleaningMode']),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return mapStateToProps;
|
||||||
};
|
};
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
export default connect(mapStateToProps)(Notification);
|
export default connect(makeMapStateToProps)(Notification);
|
||||||
|
|||||||
@@ -11,9 +11,11 @@ import React from 'react';
|
|||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
import escapeTextContentForBrowser from 'escape-html';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
|
||||||
// Mastodon imports.
|
// Mastodon imports.
|
||||||
|
import emojify from '../../../mastodon/emoji';
|
||||||
import Permalink from '../../../mastodon/components/permalink';
|
import Permalink from '../../../mastodon/components/permalink';
|
||||||
import AccountContainer from '../../../mastodon/containers/account_container';
|
import AccountContainer from '../../../mastodon/containers/account_container';
|
||||||
|
|
||||||
@@ -28,7 +30,7 @@ import NotificationOverlayContainer from '../notification/overlay/container';
|
|||||||
export default class NotificationFollow extends ImmutablePureComponent {
|
export default class NotificationFollow extends ImmutablePureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
id : PropTypes.string.isRequired,
|
id : PropTypes.number.isRequired,
|
||||||
account : ImmutablePropTypes.map.isRequired,
|
account : ImmutablePropTypes.map.isRequired,
|
||||||
notification : ImmutablePropTypes.map.isRequired,
|
notification : ImmutablePropTypes.map.isRequired,
|
||||||
};
|
};
|
||||||
@@ -37,14 +39,15 @@ export default class NotificationFollow extends ImmutablePureComponent {
|
|||||||
const { account, notification } = this.props;
|
const { account, notification } = this.props;
|
||||||
|
|
||||||
// Links to the display name.
|
// Links to the display name.
|
||||||
const displayName = account.get('display_name_html') || account.get('username');
|
const displayName = account.get('display_name') || account.get('username');
|
||||||
|
const displayNameHTML = { __html: emojify(escapeTextContentForBrowser(displayName)) };
|
||||||
const link = (
|
const link = (
|
||||||
<Permalink
|
<Permalink
|
||||||
className='notification__display-name'
|
className='notification__display-name'
|
||||||
href={account.get('url')}
|
href={account.get('url')}
|
||||||
title={account.get('acct')}
|
title={account.get('acct')}
|
||||||
to={`/accounts/${account.get('id')}`}
|
to={`/accounts/${account.get('id')}`}
|
||||||
dangerouslySetInnerHTML={{ __html: displayName }}
|
dangerouslySetInnerHTML={displayNameHTML}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
|
|||||||
import RelativeTimestamp from '../../../mastodon/components/relative_timestamp';
|
import RelativeTimestamp from '../../../mastodon/components/relative_timestamp';
|
||||||
import IconButton from '../../../mastodon/components/icon_button';
|
import IconButton from '../../../mastodon/components/icon_button';
|
||||||
import DropdownMenuContainer from '../../../mastodon/containers/dropdown_menu_container';
|
import DropdownMenuContainer from '../../../mastodon/containers/dropdown_menu_container';
|
||||||
import { me } from '../../../mastodon/initial_state';
|
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
delete: { id: 'status.delete', defaultMessage: 'Delete' },
|
delete: { id: 'status.delete', defaultMessage: 'Delete' },
|
||||||
@@ -51,6 +50,7 @@ export default class StatusActionBar extends ImmutablePureComponent {
|
|||||||
onEmbed: PropTypes.func,
|
onEmbed: PropTypes.func,
|
||||||
onMuteConversation: PropTypes.func,
|
onMuteConversation: PropTypes.func,
|
||||||
onPin: PropTypes.func,
|
onPin: PropTypes.func,
|
||||||
|
me: PropTypes.number,
|
||||||
withDismiss: PropTypes.bool,
|
withDismiss: PropTypes.bool,
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
};
|
};
|
||||||
@@ -59,6 +59,7 @@ export default class StatusActionBar extends ImmutablePureComponent {
|
|||||||
// evaluate to false. See react-immutable-pure-component for usage.
|
// evaluate to false. See react-immutable-pure-component for usage.
|
||||||
updateOnProps = [
|
updateOnProps = [
|
||||||
'status',
|
'status',
|
||||||
|
'me',
|
||||||
'withDismiss',
|
'withDismiss',
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -118,7 +119,7 @@ export default class StatusActionBar extends ImmutablePureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { status, intl, withDismiss } = this.props;
|
const { status, me, intl, withDismiss } = this.props;
|
||||||
|
|
||||||
const mutingConversation = status.get('muted');
|
const mutingConversation = status.get('muted');
|
||||||
const anonymousAccess = !me;
|
const anonymousAccess = !me;
|
||||||
|
|||||||
@@ -102,16 +102,6 @@ const makeMapStateToProps = () => {
|
|||||||
const mapStateToProps = (state, ownProps) => {
|
const mapStateToProps = (state, ownProps) => {
|
||||||
|
|
||||||
let status = getStatus(state, ownProps.id);
|
let status = getStatus(state, ownProps.id);
|
||||||
|
|
||||||
if(status === null) {
|
|
||||||
console.error(`ERROR! NULL STATUS! ${ownProps.id}`);
|
|
||||||
// work-around: find first good status
|
|
||||||
for (let k of state.get('statuses').keys()) {
|
|
||||||
status = getStatus(state, k);
|
|
||||||
if (status !== null) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let reblogStatus = status.get('reblog', null);
|
let reblogStatus = status.get('reblog', null);
|
||||||
let account = undefined;
|
let account = undefined;
|
||||||
let prepend = undefined;
|
let prepend = undefined;
|
||||||
@@ -140,10 +130,12 @@ Here are the props we pass to `<Status>`.
|
|||||||
return {
|
return {
|
||||||
status : status,
|
status : status,
|
||||||
account : account || ownProps.account,
|
account : account || ownProps.account,
|
||||||
|
me : state.getIn(['meta', 'me']),
|
||||||
settings : state.get('local_settings'),
|
settings : state.get('local_settings'),
|
||||||
prepend : prepend || ownProps.prepend,
|
prepend : prepend || ownProps.prepend,
|
||||||
reblogModal : state.getIn(['meta', 'boost_modal']),
|
reblogModal : state.getIn(['meta', 'boost_modal']),
|
||||||
deleteModal : state.getIn(['meta', 'delete_modal']),
|
deleteModal : state.getIn(['meta', 'delete_modal']),
|
||||||
|
autoPlayGif : state.getIn(['meta', 'auto_play_gif']),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
// Package imports //
|
// Package imports //
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
import escapeTextContentForBrowser from 'escape-html';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
// Mastodon imports //
|
// Mastodon imports //
|
||||||
|
import emojify from '../../../mastodon/emoji';
|
||||||
import { isRtl } from '../../../mastodon/rtl';
|
import { isRtl } from '../../../mastodon/rtl';
|
||||||
import Permalink from '../../../mastodon/components/permalink';
|
import Permalink from '../../../mastodon/components/permalink';
|
||||||
|
|
||||||
@@ -30,7 +32,7 @@ export default class StatusContent extends React.PureComponent {
|
|||||||
const node = this.node;
|
const node = this.node;
|
||||||
const links = node.querySelectorAll('a');
|
const links = node.querySelectorAll('a');
|
||||||
|
|
||||||
for (let i = 0; i < links.length; ++i) {
|
for (var i = 0; i < links.length; ++i) {
|
||||||
let link = links[i];
|
let link = links[i];
|
||||||
let mention = this.props.status.get('mentions').find(item => link.href === item.get('url'));
|
let mention = this.props.status.get('mentions').find(item => link.href === item.get('url'));
|
||||||
|
|
||||||
@@ -129,8 +131,12 @@ export default class StatusContent extends React.PureComponent {
|
|||||||
this.state.hidden
|
this.state.hidden
|
||||||
);
|
);
|
||||||
|
|
||||||
const content = { __html: status.get('contentHtml') };
|
const content = { __html: emojify(status.get('content')) };
|
||||||
const spoilerContent = { __html: status.get('spoilerHtml') };
|
const spoilerContent = {
|
||||||
|
__html: emojify(escapeTextContentForBrowser(
|
||||||
|
status.get('spoiler_text', '')
|
||||||
|
)),
|
||||||
|
};
|
||||||
const directionStyle = { direction: 'ltr' };
|
const directionStyle = { direction: 'ltr' };
|
||||||
const classNames = classnames('status__content', {
|
const classNames = classnames('status__content', {
|
||||||
'status__content--with-action': parseClick && !disabled,
|
'status__content--with-action': parseClick && !disabled,
|
||||||
|
|||||||
@@ -117,13 +117,7 @@ export default class StatusGalleryItem extends React.PureComponent {
|
|||||||
onClick={this.handleClick}
|
onClick={this.handleClick}
|
||||||
target='_blank'
|
target='_blank'
|
||||||
>
|
>
|
||||||
<img
|
<img className={letterbox ? 'letterbox' : ''} src={previewUrl} srcSet={srcSet} sizes={sizes} alt='' />
|
||||||
className={letterbox ? 'letterbox' : ''}
|
|
||||||
src={previewUrl} srcSet={srcSet}
|
|
||||||
sizes={sizes}
|
|
||||||
alt={attachment.get('description')}
|
|
||||||
title={attachment.get('description')}
|
|
||||||
/>
|
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
} else if (attachment.get('type') === 'gifv') {
|
} else if (attachment.get('type') === 'gifv') {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
|
|||||||
|
|
||||||
// Mastodon imports //
|
// Mastodon imports //
|
||||||
import scheduleIdleTask from '../../../mastodon/features/ui/util/schedule_idle_task';
|
import scheduleIdleTask from '../../../mastodon/features/ui/util/schedule_idle_task';
|
||||||
import { autoPlayGif } from '../../../mastodon/initial_state';
|
|
||||||
|
|
||||||
// Our imports //
|
// Our imports //
|
||||||
import StatusPrepend from './prepend';
|
import StatusPrepend from './prepend';
|
||||||
@@ -90,6 +89,9 @@ few parts:
|
|||||||
These are our local settings, fetched from our store. We need this
|
These are our local settings, fetched from our store. We need this
|
||||||
to determine how best to collapse our statuses, among other things.
|
to determine how best to collapse our statuses, among other things.
|
||||||
|
|
||||||
|
- __`me` (`PropTypes.number`) :__
|
||||||
|
This is the id of the currently-signed-in user.
|
||||||
|
|
||||||
- __`onFavourite`, `onReblog`, `onModalReblog`, `onDelete`,
|
- __`onFavourite`, `onReblog`, `onModalReblog`, `onDelete`,
|
||||||
`onMention`, `onMute`, `onMuteConversation`, onBlock`, `onReport`,
|
`onMention`, `onMute`, `onMuteConversation`, onBlock`, `onReport`,
|
||||||
`onOpenMedia`, `onOpenVideo` (`PropTypes.func`) :__
|
`onOpenMedia`, `onOpenVideo` (`PropTypes.func`) :__
|
||||||
@@ -101,6 +103,9 @@ few parts:
|
|||||||
reblogging and deleting statuses. They are used by the `onReblog`
|
reblogging and deleting statuses. They are used by the `onReblog`
|
||||||
and `onDelete` functions, but we don't deal with them here.
|
and `onDelete` functions, but we don't deal with them here.
|
||||||
|
|
||||||
|
- __`autoPlayGif` (`PropTypes.bool`) :__
|
||||||
|
This tells the frontend whether or not to autoplay gifs!
|
||||||
|
|
||||||
- __`muted` (`PropTypes.bool`) :__
|
- __`muted` (`PropTypes.bool`) :__
|
||||||
This has nothing to do with a user or conversation mute! "Muted" is
|
This has nothing to do with a user or conversation mute! "Muted" is
|
||||||
what Mastodon internally calls the subdued look of statuses in the
|
what Mastodon internally calls the subdued look of statuses in the
|
||||||
@@ -150,11 +155,12 @@ export default class Status extends ImmutablePureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
id : PropTypes.string,
|
id : PropTypes.number,
|
||||||
status : ImmutablePropTypes.map,
|
status : ImmutablePropTypes.map,
|
||||||
account : ImmutablePropTypes.map,
|
account : ImmutablePropTypes.map,
|
||||||
settings : ImmutablePropTypes.map,
|
settings : ImmutablePropTypes.map,
|
||||||
notification : ImmutablePropTypes.map,
|
notification : ImmutablePropTypes.map,
|
||||||
|
me : PropTypes.number,
|
||||||
onFavourite : PropTypes.func,
|
onFavourite : PropTypes.func,
|
||||||
onReblog : PropTypes.func,
|
onReblog : PropTypes.func,
|
||||||
onModalReblog : PropTypes.func,
|
onModalReblog : PropTypes.func,
|
||||||
@@ -171,6 +177,7 @@ export default class Status extends ImmutablePureComponent {
|
|||||||
onOpenVideo : PropTypes.func,
|
onOpenVideo : PropTypes.func,
|
||||||
reblogModal : PropTypes.bool,
|
reblogModal : PropTypes.bool,
|
||||||
deleteModal : PropTypes.bool,
|
deleteModal : PropTypes.bool,
|
||||||
|
autoPlayGif : PropTypes.bool,
|
||||||
muted : PropTypes.bool,
|
muted : PropTypes.bool,
|
||||||
collapse : PropTypes.bool,
|
collapse : PropTypes.bool,
|
||||||
prepend : PropTypes.string,
|
prepend : PropTypes.string,
|
||||||
@@ -204,7 +211,9 @@ to remember to specify it here.
|
|||||||
'account',
|
'account',
|
||||||
'settings',
|
'settings',
|
||||||
'prepend',
|
'prepend',
|
||||||
|
'me',
|
||||||
'boostModal',
|
'boostModal',
|
||||||
|
'autoPlayGif',
|
||||||
'muted',
|
'muted',
|
||||||
'collapse',
|
'collapse',
|
||||||
'notification',
|
'notification',
|
||||||
@@ -278,7 +287,6 @@ properly and our intersection observer is good to go.
|
|||||||
muted,
|
muted,
|
||||||
id,
|
id,
|
||||||
intersectionObserverWrapper,
|
intersectionObserverWrapper,
|
||||||
prepend,
|
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const autoCollapseSettings = settings.getIn(['collapsed', 'auto']);
|
const autoCollapseSettings = settings.getIn(['collapsed', 'auto']);
|
||||||
|
|
||||||
@@ -291,9 +299,6 @@ properly and our intersection observer is good to go.
|
|||||||
node.clientHeight > (
|
node.clientHeight > (
|
||||||
status.get('media_attachments').size && !muted ? 650 : 400
|
status.get('media_attachments').size && !muted ? 650 : 400
|
||||||
)
|
)
|
||||||
) || (
|
|
||||||
autoCollapseSettings.get('reblogs') &&
|
|
||||||
prepend === 'reblogged_by'
|
|
||||||
) || (
|
) || (
|
||||||
autoCollapseSettings.get('replies') &&
|
autoCollapseSettings.get('replies') &&
|
||||||
status.get('in_reply_to_id', null) !== null
|
status.get('in_reply_to_id', null) !== null
|
||||||
@@ -551,6 +556,7 @@ this operation are further explained in the code below.
|
|||||||
intersectionObserverWrapper,
|
intersectionObserverWrapper,
|
||||||
onOpenVideo,
|
onOpenVideo,
|
||||||
onOpenMedia,
|
onOpenMedia,
|
||||||
|
autoPlayGif,
|
||||||
notification,
|
notification,
|
||||||
...other
|
...other
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|||||||
@@ -22,8 +22,12 @@ Imports:
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
import escapeTextContentForBrowser from 'escape-html';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
// Mastodon imports //
|
||||||
|
import emojify from '../../../mastodon/emoji';
|
||||||
|
|
||||||
/* * * * */
|
/* * * * */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -95,7 +99,9 @@ generate the message.
|
|||||||
>
|
>
|
||||||
<b
|
<b
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html : account.get('display_name_html') || account.get('username'),
|
__html : emojify(escapeTextContentForBrowser(
|
||||||
|
account.get('display_name') || account.get('username')
|
||||||
|
)),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
"settings.auto_collapse_lengthy": "Lengthy toots",
|
"settings.auto_collapse_lengthy": "Lengthy toots",
|
||||||
"settings.auto_collapse_media": "Toots with media",
|
"settings.auto_collapse_media": "Toots with media",
|
||||||
"settings.auto_collapse_notifications": "Notifications",
|
"settings.auto_collapse_notifications": "Notifications",
|
||||||
"settings.auto_collapse_reblogs": "Boosts",
|
|
||||||
"settings.auto_collapse_replies": "Replies",
|
"settings.auto_collapse_replies": "Replies",
|
||||||
"settings.close": "Close",
|
"settings.close": "Close",
|
||||||
"settings.collapsed_statuses": "Collapsed toots",
|
"settings.collapsed_statuses": "Collapsed toots",
|
||||||
|
|||||||
@@ -52,14 +52,12 @@ const initialState = ImmutableMap({
|
|||||||
layout : 'auto',
|
layout : 'auto',
|
||||||
stretch : true,
|
stretch : true,
|
||||||
navbar_under : false,
|
navbar_under : false,
|
||||||
side_arm : 'none',
|
|
||||||
collapsed : ImmutableMap({
|
collapsed : ImmutableMap({
|
||||||
enabled : true,
|
enabled : true,
|
||||||
auto : ImmutableMap({
|
auto : ImmutableMap({
|
||||||
all : false,
|
all : false,
|
||||||
notifications : true,
|
notifications : true,
|
||||||
lengthy : true,
|
lengthy : true,
|
||||||
reblogs : false,
|
|
||||||
replies : false,
|
replies : false,
|
||||||
media : false,
|
media : false,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -69,10 +69,6 @@ functions are:
|
|||||||
easier to read and to maintain. I leave it to the future readers of
|
easier to read and to maintain. I leave it to the future readers of
|
||||||
this code to determine the extent of my successes in this endeavor.
|
this code to determine the extent of my successes in this endeavor.
|
||||||
|
|
||||||
UPDATE 19 Oct 2017: We no longer allow character escapes inside our
|
|
||||||
double-quoted strings for ease of processing. We now internally use
|
|
||||||
the name "ƔAML" in our code to clarify that this is Not Quite YAML.
|
|
||||||
|
|
||||||
Sending love + warmth eternal,
|
Sending love + warmth eternal,
|
||||||
- kibigo [@kibi@glitch.social]
|
- kibigo [@kibi@glitch.social]
|
||||||
|
|
||||||
@@ -100,7 +96,10 @@ const ALLOWED_CHAR = unirex( // `c-printable` in the YAML 1.2 spec.
|
|||||||
compat_mode ? '[\t\n\r\x20-\x7e\x85\xa0-\ufffd]' : '[\t\n\r\x20-\x7e\x85\xa0-\ud7ff\ue000-\ufffd\u{10000}-\u{10FFFF}]'
|
compat_mode ? '[\t\n\r\x20-\x7e\x85\xa0-\ufffd]' : '[\t\n\r\x20-\x7e\x85\xa0-\ud7ff\ue000-\ufffd\u{10000}-\u{10FFFF}]'
|
||||||
);
|
);
|
||||||
const WHITE_SPACE = /[ \t]/;
|
const WHITE_SPACE = /[ \t]/;
|
||||||
|
const INDENTATION = / */; // Indentation must be only spaces.
|
||||||
const LINE_BREAK = /\r?\n|\r|<br\s*\/?>/;
|
const LINE_BREAK = /\r?\n|\r|<br\s*\/?>/;
|
||||||
|
const ESCAPE_CHAR = /[0abt\tnvfre "\/\\N_LP]/;
|
||||||
|
const HEXADECIMAL_CHARS = /[0-9a-fA-F]/;
|
||||||
const INDICATOR = /[-?:,[\]{}&#*!|>'"%@`]/;
|
const INDICATOR = /[-?:,[\]{}&#*!|>'"%@`]/;
|
||||||
const FLOW_CHAR = /[,[\]{}]/;
|
const FLOW_CHAR = /[,[\]{}]/;
|
||||||
|
|
||||||
@@ -122,7 +121,7 @@ const NEW_LINE = unirex(
|
|||||||
rexstr(ANY_WHITE_SPACE) + rexstr(LINE_BREAK)
|
rexstr(ANY_WHITE_SPACE) + rexstr(LINE_BREAK)
|
||||||
);
|
);
|
||||||
const SOME_NEW_LINES = unirex(
|
const SOME_NEW_LINES = unirex(
|
||||||
'(?:' + rexstr(NEW_LINE) + ')+'
|
'(?:' + rexstr(ANY_WHITE_SPACE) + rexstr(LINE_BREAK) + ')+'
|
||||||
);
|
);
|
||||||
const POSSIBLE_STARTS = unirex(
|
const POSSIBLE_STARTS = unirex(
|
||||||
rexstr(DOCUMENT_START) + rexstr(/<p[^<>]*>/) + '?'
|
rexstr(DOCUMENT_START) + rexstr(/<p[^<>]*>/) + '?'
|
||||||
@@ -132,13 +131,22 @@ const POSSIBLE_ENDS = unirex(
|
|||||||
rexstr(DOCUMENT_END) + '|' +
|
rexstr(DOCUMENT_END) + '|' +
|
||||||
rexstr(/<\/p>/)
|
rexstr(/<\/p>/)
|
||||||
);
|
);
|
||||||
const QUOTE_CHAR = unirex(
|
const CHARACTER_ESCAPE = unirex(
|
||||||
'(?=' + rexstr(NOT_LINE_BREAK) + ')[^"]'
|
rexstr(/\\/) +
|
||||||
|
'(?:' +
|
||||||
|
rexstr(ESCAPE_CHAR) + '|' +
|
||||||
|
rexstr(/x/) + rexstr(HEXADECIMAL_CHARS) + '{2}' + '|' +
|
||||||
|
rexstr(/u/) + rexstr(HEXADECIMAL_CHARS) + '{4}' + '|' +
|
||||||
|
rexstr(/U/) + rexstr(HEXADECIMAL_CHARS) + '{8}' +
|
||||||
|
')'
|
||||||
);
|
);
|
||||||
const ANY_QUOTE_CHAR = unirex(
|
const ESCAPED_CHAR = unirex(
|
||||||
rexstr(QUOTE_CHAR) + '*'
|
rexstr(/(?!["\\])/) + rexstr(NOT_LINE_BREAK) + '|' +
|
||||||
|
rexstr(CHARACTER_ESCAPE)
|
||||||
|
);
|
||||||
|
const ANY_ESCAPED_CHARS = unirex(
|
||||||
|
rexstr(ESCAPED_CHAR) + '*'
|
||||||
);
|
);
|
||||||
|
|
||||||
const ESCAPED_APOS = unirex(
|
const ESCAPED_APOS = unirex(
|
||||||
'(?=' + rexstr(NOT_LINE_BREAK) + ')' + rexstr(/[^']|''/)
|
'(?=' + rexstr(NOT_LINE_BREAK) + ')' + rexstr(/[^']|''/)
|
||||||
);
|
);
|
||||||
@@ -182,76 +190,120 @@ const LATER_VALUE_CHAR = unirex(
|
|||||||
|
|
||||||
/* YAML CONSTRUCTS */
|
/* YAML CONSTRUCTS */
|
||||||
|
|
||||||
const ƔAML_START = unirex(
|
const YAML_START = unirex(
|
||||||
rexstr(ANY_WHITE_SPACE) + '---'
|
rexstr(ANY_WHITE_SPACE) + rexstr(/---/)
|
||||||
);
|
);
|
||||||
const ƔAML_END = unirex(
|
const YAML_END = unirex(
|
||||||
rexstr(ANY_WHITE_SPACE) + '(?:---|\.\.\.)'
|
rexstr(ANY_WHITE_SPACE) + rexstr(/(?:---|\.\.\.)/)
|
||||||
);
|
);
|
||||||
const ƔAML_LOOKAHEAD = unirex(
|
const YAML_LOOKAHEAD = unirex(
|
||||||
'(?=' +
|
'(?=' +
|
||||||
rexstr(ƔAML_START) +
|
rexstr(YAML_START) +
|
||||||
rexstr(ANY_ALLOWED_CHARS) + rexstr(NEW_LINE) +
|
rexstr(ANY_ALLOWED_CHARS) + rexstr(NEW_LINE) +
|
||||||
rexstr(ƔAML_END) + rexstr(POSSIBLE_ENDS) +
|
rexstr(YAML_END) + rexstr(POSSIBLE_ENDS) +
|
||||||
')'
|
')'
|
||||||
);
|
);
|
||||||
const ƔAML_DOUBLE_QUOTE = unirex(
|
const YAML_DOUBLE_QUOTE = unirex(
|
||||||
'"' + rexstr(ANY_QUOTE_CHAR) + '"'
|
rexstr(/"/) + rexstr(ANY_ESCAPED_CHARS) + rexstr(/"/)
|
||||||
);
|
);
|
||||||
const ƔAML_SINGLE_QUOTE = unirex(
|
const YAML_SINGLE_QUOTE = unirex(
|
||||||
'\'' + rexstr(ANY_ESCAPED_APOS) + '\''
|
rexstr(/'/) + rexstr(ANY_ESCAPED_APOS) + rexstr(/'/)
|
||||||
);
|
);
|
||||||
const ƔAML_SIMPLE_KEY = unirex(
|
const YAML_SIMPLE_KEY = unirex(
|
||||||
rexstr(FIRST_KEY_CHAR) + rexstr(LATER_KEY_CHAR) + '*'
|
rexstr(FIRST_KEY_CHAR) + rexstr(LATER_KEY_CHAR) + '*'
|
||||||
);
|
);
|
||||||
const ƔAML_SIMPLE_VALUE = unirex(
|
const YAML_SIMPLE_VALUE = unirex(
|
||||||
rexstr(FIRST_VALUE_CHAR) + rexstr(LATER_VALUE_CHAR) + '*'
|
rexstr(FIRST_VALUE_CHAR) + rexstr(LATER_VALUE_CHAR) + '*'
|
||||||
);
|
);
|
||||||
const ƔAML_KEY = unirex(
|
const YAML_KEY = unirex(
|
||||||
rexstr(ƔAML_DOUBLE_QUOTE) + '|' +
|
rexstr(YAML_DOUBLE_QUOTE) + '|' +
|
||||||
rexstr(ƔAML_SINGLE_QUOTE) + '|' +
|
rexstr(YAML_SINGLE_QUOTE) + '|' +
|
||||||
rexstr(ƔAML_SIMPLE_KEY)
|
rexstr(YAML_SIMPLE_KEY)
|
||||||
);
|
);
|
||||||
const ƔAML_VALUE = unirex(
|
const YAML_VALUE = unirex(
|
||||||
rexstr(ƔAML_DOUBLE_QUOTE) + '|' +
|
rexstr(YAML_DOUBLE_QUOTE) + '|' +
|
||||||
rexstr(ƔAML_SINGLE_QUOTE) + '|' +
|
rexstr(YAML_SINGLE_QUOTE) + '|' +
|
||||||
rexstr(ƔAML_SIMPLE_VALUE)
|
rexstr(YAML_SIMPLE_VALUE)
|
||||||
);
|
);
|
||||||
const ƔAML_SEPARATOR = unirex(
|
const YAML_SEPARATOR = unirex(
|
||||||
rexstr(ANY_WHITE_SPACE) +
|
rexstr(ANY_WHITE_SPACE) +
|
||||||
':' + rexstr(WHITE_SPACE) +
|
':' + rexstr(WHITE_SPACE) +
|
||||||
rexstr(ANY_WHITE_SPACE)
|
rexstr(ANY_WHITE_SPACE)
|
||||||
);
|
);
|
||||||
const ƔAML_LINE = unirex(
|
const YAML_LINE = unirex(
|
||||||
'(' + rexstr(ƔAML_KEY) + ')' +
|
'(' + rexstr(YAML_KEY) + ')' +
|
||||||
rexstr(ƔAML_SEPARATOR) +
|
rexstr(YAML_SEPARATOR) +
|
||||||
'(' + rexstr(ƔAML_VALUE) + ')'
|
'(' + rexstr(YAML_VALUE) + ')'
|
||||||
);
|
);
|
||||||
|
|
||||||
/* FRONTMATTER REGEX */
|
/* FRONTMATTER REGEX */
|
||||||
|
|
||||||
const ƔAML_FRONTMATTER = unirex(
|
const YAML_FRONTMATTER = unirex(
|
||||||
rexstr(POSSIBLE_STARTS) +
|
rexstr(POSSIBLE_STARTS) +
|
||||||
rexstr(ƔAML_LOOKAHEAD) +
|
rexstr(YAML_LOOKAHEAD) +
|
||||||
rexstr(ƔAML_START) + rexstr(SOME_NEW_LINES) +
|
rexstr(YAML_START) + rexstr(SOME_NEW_LINES) +
|
||||||
'(?:' +
|
'(?:' +
|
||||||
rexstr(ANY_WHITE_SPACE) + rexstr(ƔAML_LINE) + rexstr(SOME_NEW_LINES) +
|
'(' + rexstr(INDENTATION) + ')' +
|
||||||
'){0,5}' +
|
rexstr(YAML_LINE) + rexstr(SOME_NEW_LINES) +
|
||||||
rexstr(ƔAML_END) + rexstr(POSSIBLE_ENDS)
|
'(?:' +
|
||||||
|
'\\1' + rexstr(YAML_LINE) + rexstr(SOME_NEW_LINES) +
|
||||||
|
'){0,4}' +
|
||||||
|
')?' +
|
||||||
|
rexstr(YAML_END) + rexstr(POSSIBLE_ENDS)
|
||||||
);
|
);
|
||||||
|
|
||||||
/* SEARCHES */
|
/* SEARCHES */
|
||||||
|
|
||||||
const FIND_ƔAML_LINE = unirex(
|
const FIND_YAML_LINES = unirex(
|
||||||
rexstr(NEW_LINE) + rexstr(ANY_WHITE_SPACE) + rexstr(ƔAML_LINE)
|
rexstr(NEW_LINE) + rexstr(INDENTATION) + rexstr(YAML_LINE)
|
||||||
);
|
);
|
||||||
|
|
||||||
/* STRING PROCESSING */
|
/* STRING PROCESSING */
|
||||||
|
|
||||||
function processString (str) {
|
function processString(str) {
|
||||||
switch (str.charAt(0)) {
|
switch (str.charAt(0)) {
|
||||||
case '"':
|
case '"':
|
||||||
return str.substring(1, str.length - 1);
|
return str
|
||||||
|
.substring(1, str.length - 1)
|
||||||
|
.replace(/\\0/g, '\x00')
|
||||||
|
.replace(/\\a/g, '\x07')
|
||||||
|
.replace(/\\b/g, '\x08')
|
||||||
|
.replace(/\\t/g, '\x09')
|
||||||
|
.replace(/\\\x09/g, '\x09')
|
||||||
|
.replace(/\\n/g, '\x0a')
|
||||||
|
.replace(/\\v/g, '\x0b')
|
||||||
|
.replace(/\\f/g, '\x0c')
|
||||||
|
.replace(/\\r/g, '\x0d')
|
||||||
|
.replace(/\\e/g, '\x1b')
|
||||||
|
.replace(/\\ /g, '\x20')
|
||||||
|
.replace(/\\"/g, '\x22')
|
||||||
|
.replace(/\\\//g, '\x2f')
|
||||||
|
.replace(/\\\\/g, '\x5c')
|
||||||
|
.replace(/\\N/g, '\x85')
|
||||||
|
.replace(/\\_/g, '\xa0')
|
||||||
|
.replace(/\\L/g, '\u2028')
|
||||||
|
.replace(/\\P/g, '\u2029')
|
||||||
|
.replace(
|
||||||
|
new RegExp(
|
||||||
|
unirex(
|
||||||
|
rexstr(/\\x/) + '(' + rexstr(HEXADECIMAL_CHARS) + '{2})'
|
||||||
|
), 'gu'
|
||||||
|
), (_, n) => String.fromCodePoint('0x' + n)
|
||||||
|
)
|
||||||
|
.replace(
|
||||||
|
new RegExp(
|
||||||
|
unirex(
|
||||||
|
rexstr(/\\u/) + '(' + rexstr(HEXADECIMAL_CHARS) + '{4})'
|
||||||
|
), 'gu'
|
||||||
|
), (_, n) => String.fromCodePoint('0x' + n)
|
||||||
|
)
|
||||||
|
.replace(
|
||||||
|
new RegExp(
|
||||||
|
unirex(
|
||||||
|
rexstr(/\\U/) + '(' + rexstr(HEXADECIMAL_CHARS) + '{8})'
|
||||||
|
), 'gu'
|
||||||
|
), (_, n) => String.fromCodePoint('0x' + n)
|
||||||
|
);
|
||||||
case '\'':
|
case '\'':
|
||||||
return str
|
return str
|
||||||
.substring(1, str.length - 1)
|
.substring(1, str.length - 1)
|
||||||
@@ -269,18 +321,15 @@ export function processBio(content) {
|
|||||||
text: content,
|
text: content,
|
||||||
metadata: [],
|
metadata: [],
|
||||||
};
|
};
|
||||||
let ɣaml = content.match(ƔAML_FRONTMATTER);
|
let yaml = content.match(YAML_FRONTMATTER);
|
||||||
if (!ɣaml) {
|
if (!yaml) return result;
|
||||||
return result;
|
else yaml = yaml[0];
|
||||||
} else {
|
let start = content.search(YAML_START);
|
||||||
ɣaml = ɣaml[0];
|
let end = start + yaml.length - yaml.search(YAML_START);
|
||||||
}
|
result.text = content.substr(0, start) + content.substr(end);
|
||||||
const start = content.search(ƔAML_START);
|
|
||||||
const end = start + ɣaml.length - ɣaml.search(ƔAML_START);
|
|
||||||
result.text = content.substr(end);
|
|
||||||
let metadata = null;
|
let metadata = null;
|
||||||
let query = new RegExp(rexstr(FIND_ƔAML_LINE), 'g'); // Some browsers don't allow flags unless both args are strings
|
let query = new RegExp(FIND_YAML_LINES, 'g');
|
||||||
while ((metadata = query.exec(ɣaml))) {
|
while ((metadata = query.exec(yaml))) {
|
||||||
result.metadata.push([
|
result.metadata.push([
|
||||||
processString(metadata[1]),
|
processString(metadata[1]),
|
||||||
processString(metadata[2]),
|
processString(metadata[2]),
|
||||||
@@ -303,23 +352,63 @@ export function createBio(note, data) {
|
|||||||
let val = '' + data[i][1];
|
let val = '' + data[i][1];
|
||||||
|
|
||||||
// Key processing
|
// Key processing
|
||||||
if (key === (key.match(ƔAML_SIMPLE_KEY) || [])[0]) /* do nothing */;
|
if (key === (key.match(YAML_SIMPLE_KEY) || [])[0]) /* do nothing */;
|
||||||
else if (key === (key.match(ANY_QUOTE_CHAR) || [])[0]) key = '"' + key + '"';
|
else if (key.indexOf('\'') === -1 && key === (key.match(ANY_ESCAPED_APOS) || [])[0]) key = '\'' + key + '\'';
|
||||||
else {
|
else {
|
||||||
key = key
|
key = key
|
||||||
.replace(/'/g, '\'\'')
|
.replace(/\x00/g, '\\0')
|
||||||
.replace(new RegExp(rexstr(NOT_ALLOWED_CHAR), compat_mode ? 'g' : 'gu'), '<EFBFBD>');
|
.replace(/\x07/g, '\\a')
|
||||||
key = '\'' + key + '\'';
|
.replace(/\x08/g, '\\b')
|
||||||
|
.replace(/\x0a/g, '\\n')
|
||||||
|
.replace(/\x0b/g, '\\v')
|
||||||
|
.replace(/\x0c/g, '\\f')
|
||||||
|
.replace(/\x0d/g, '\\r')
|
||||||
|
.replace(/\x1b/g, '\\e')
|
||||||
|
.replace(/\x22/g, '\\"')
|
||||||
|
.replace(/\x5c/g, '\\\\');
|
||||||
|
let badchars = key.match(
|
||||||
|
new RegExp(rexstr(NOT_ALLOWED_CHAR), 'gu')
|
||||||
|
) || [];
|
||||||
|
for (let j = 0; j < badchars.length; j++) {
|
||||||
|
key = key.replace(
|
||||||
|
badchars[i],
|
||||||
|
'\\u' + badchars[i].codePointAt(0).toLocaleString('en', {
|
||||||
|
useGrouping: false,
|
||||||
|
minimumIntegerDigits: 4,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
key = '"' + key + '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Value processing
|
// Value processing
|
||||||
if (val === (val.match(ƔAML_SIMPLE_VALUE) || [])[0]) /* do nothing */;
|
if (val === (val.match(YAML_SIMPLE_VALUE) || [])[0]) /* do nothing */;
|
||||||
else if (val === (val.match(ANY_QUOTE_CHAR) || [])[0]) val = '"' + val + '"';
|
else if (val.indexOf('\'') === -1 && val === (val.match(ANY_ESCAPED_APOS) || [])[0]) val = '\'' + val + '\'';
|
||||||
else {
|
else {
|
||||||
key = key
|
val = val
|
||||||
.replace(/'/g, '\'\'')
|
.replace(/\x00/g, '\\0')
|
||||||
.replace(new RegExp(rexstr(NOT_ALLOWED_CHAR), compat_mode ? 'g' : 'gu'), '<EFBFBD>');
|
.replace(/\x07/g, '\\a')
|
||||||
key = '\'' + key + '\'';
|
.replace(/\x08/g, '\\b')
|
||||||
|
.replace(/\x0a/g, '\\n')
|
||||||
|
.replace(/\x0b/g, '\\v')
|
||||||
|
.replace(/\x0c/g, '\\f')
|
||||||
|
.replace(/\x0d/g, '\\r')
|
||||||
|
.replace(/\x1b/g, '\\e')
|
||||||
|
.replace(/\x22/g, '\\"')
|
||||||
|
.replace(/\x5c/g, '\\\\');
|
||||||
|
let badchars = val.match(
|
||||||
|
new RegExp(rexstr(NOT_ALLOWED_CHAR), 'gu')
|
||||||
|
) || [];
|
||||||
|
for (let j = 0; j < badchars.length; j++) {
|
||||||
|
val = val.replace(
|
||||||
|
badchars[i],
|
||||||
|
'\\u' + badchars[i].codePointAt(0).toLocaleString('en', {
|
||||||
|
useGrouping: false,
|
||||||
|
minimumIntegerDigits: 4,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
val = '"' + val + '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
frontmatter += key + ': ' + val + '\n';
|
frontmatter += key + ': ' + val + '\n';
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 216.4144 232.00976"><path d="M211.80734 139.0875c-3.18125 16.36625-28.4925 34.2775-57.5625 37.74875-15.15875 1.80875-30.08375 3.47125-45.99875 2.74125-26.0275-1.1925-46.565-6.2125-46.565-6.2125 0 2.53375.15625 4.94625.46875 7.2025 3.38375 25.68625 25.47 27.225 46.39125 27.9425 21.11625.7225 39.91875-5.20625 39.91875-5.20625l.8675 19.09s-14.77 7.93125-41.08125 9.39c-14.50875.7975-32.52375-.365-53.50625-5.91875C9.23234 213.82 1.40609 165.31125.20859 116.09125c-.365-14.61375-.14-28.39375-.14-39.91875 0-50.33 32.97625-65.0825 32.97625-65.0825C49.67234 3.45375 78.20359.2425 107.86484 0h.72875c29.66125.2425 58.21125 3.45375 74.8375 11.09 0 0 32.975 14.7525 32.975 65.0825 0 0 .41375 37.13375-4.59875 62.915" fill="#3088d4"/><path d="M177.50984 80.077v60.94125h-24.14375v-59.15c0-12.46875-5.24625-18.7975-15.74-18.7975-11.6025 0-17.4175 7.5075-17.4175 22.3525v32.37625H96.20734V85.42325c0-14.845-5.81625-22.3525-17.41875-22.3525-10.49375 0-15.74 6.32875-15.74 18.7975v59.15H38.90484V80.077c0-12.455 3.17125-22.3525 9.54125-29.675 6.56875-7.3225 15.17125-11.07625 25.85-11.07625 12.355 0 21.71125 4.74875 27.8975 14.2475l6.01375 10.08125 6.015-10.08125c6.185-9.49875 15.54125-14.2475 27.8975-14.2475 10.6775 0 19.28 3.75375 25.85 11.07625 6.36875 7.3225 9.54 17.22 9.54 29.675" fill="#fff"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="61.076954mm" height="65.47831mm" viewBox="0 0 216.4144 232.00976"><path d="M211.80734 139.0875c-3.18125 16.36625-28.4925 34.2775-57.5625 37.74875-15.15875 1.80875-30.08375 3.47125-45.99875 2.74125-26.0275-1.1925-46.565-6.2125-46.565-6.2125 0 2.53375.15625 4.94625.46875 7.2025 3.38375 25.68625 25.47 27.225 46.39125 27.9425 21.11625.7225 39.91875-5.20625 39.91875-5.20625l.8675 19.09s-14.77 7.93125-41.08125 9.39c-14.50875.7975-32.52375-.365-53.50625-5.91875C9.23234 213.82 1.40609 165.31125.20859 116.09125c-.365-14.61375-.14-28.39375-.14-39.91875 0-50.33 32.97625-65.0825 32.97625-65.0825C49.67234 3.45375 78.20359.2425 107.86484 0h.72875c29.66125.2425 58.21125 3.45375 74.8375 11.09 0 0 32.975 14.7525 32.975 65.0825 0 0 .41375 37.13375-4.59875 62.915" fill="#3088d4"/><path d="M177.50984 80.077v60.94125h-24.14375v-59.15c0-12.46875-5.24625-18.7975-15.74-18.7975-11.6025 0-17.4175 7.5075-17.4175 22.3525v32.37625H96.20734V85.42325c0-14.845-5.81625-22.3525-17.41875-22.3525-10.49375 0-15.74 6.32875-15.74 18.7975v59.15H38.90484V80.077c0-12.455 3.17125-22.3525 9.54125-29.675 6.56875-7.3225 15.17125-11.07625 25.85-11.07625 12.355 0 21.71125 4.74875 27.8975 14.2475l6.01375 10.08125 6.015-10.08125c6.185-9.49875 15.54125-14.2475 27.8975-14.2475 10.6775 0 19.28 3.75375 25.85 11.07625 6.36875 7.3225 9.54 17.22 9.54 29.675" fill="#fff"/></svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user