Merge branch 'master' into glitch-soc/merge-upstream

This commit is contained in:
Thibaut Girka
2018-05-29 13:52:26 +02:00
37 changed files with 553 additions and 93 deletions

View File

@ -271,6 +271,7 @@ Rails.application.routes.draw do
resources :favourites, only: [:index]
resources :bookmarks, only: [:index]
resources :reports, only: [:index, :create]
resources :trends, only: [:index]
namespace :apps do
get :verify_credentials, to: 'credentials#show'
@ -332,6 +333,10 @@ Rails.application.routes.draw do
end
end
namespace :v2 do
get '/search', to: 'search#index', as: :search
end
namespace :web do
resource :settings, only: [:update]
resource :embed, only: [:create]

View File

@ -6,8 +6,9 @@ const CompressionPlugin = require('compression-webpack-plugin');
const sharedConfig = require('./shared.js');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const OfflinePlugin = require('offline-plugin');
const { env, publicPath } = require('./configuration.js');
const { publicPath } = require('./configuration.js');
const path = require('path');
const { URL } = require('whatwg-url');
let compressionAlgorithm;
try {
@ -19,6 +20,21 @@ try {
compressionAlgorithm = 'gzip';
}
let attachmentHost;
if (process.env.S3_ENABLED === 'true') {
if (process.env.S3_CLOUDFRONT_HOST) {
attachmentHost = process.env.S3_CLOUDFRONT_HOST;
} else {
attachmentHost = process.env.S3_HOSTNAME || `s3-${process.env.S3_REGION || 'us-east-1'}.amazonaws.com`;
}
} else if (process.env.SWIFT_ENABLED === 'true') {
const { host } = new URL(process.env.SWIFT_OBJECT_URL);
attachmentHost = host;
} else {
attachmentHost = null;
}
module.exports = merge(sharedConfig, {
output: {
filename: '[name]-[chunkhash].js',
@ -90,7 +106,7 @@ module.exports = merge(sharedConfig, {
'**/*.woff',
],
ServiceWorker: {
entry: `imports-loader?process.env=>${encodeURIComponent(JSON.stringify(env))}!${encodeURI(path.join(__dirname, '../../app/javascript/mastodon/service_worker/entry.js'))}`,
entry: `imports-loader?ATTACHMENT_HOST=>${encodeURIComponent(JSON.stringify(attachmentHost))}!${encodeURI(path.join(__dirname, '../../app/javascript/mastodon/service_worker/entry.js'))}`,
cacheName: 'mastodon',
output: '../assets/sw.js',
publicPath: '/sw.js',