Browse Source

置顶消息,回复API限制,修改闭社树地址配置方式

closed-social-v3
欧醚 5 years ago
parent
commit
c2dc7566c1
4 changed files with 11 additions and 4 deletions
  1. +6
    -1
      app/javascript/mastodon/features/ui/components/tabs_bar.js
  2. +1
    -0
      app/javascript/mastodon/initial_state.js
  3. +2
    -1
      app/serializers/initial_state_serializer.rb
  4. +2
    -2
      config/initializers/rack_attack.rb

+ 6
- 1
app/javascript/mastodon/features/ui/components/tabs_bar.js View File

@ -7,7 +7,7 @@ import { isUserTouching } from '../../../is_mobile';
import Icon from 'mastodon/components/icon';
import NotificationsCounterIcon from './notifications_counter_icon';
import { treeRoot } from '../../../initial_state';
import { treeRoot, pinnedInfo } from '../../../initial_state';
export const links = [
<NavLink className='tabs-bar__link' to='/timelines/home' data-preview-title-id='column.home' data-preview-icon='home' ><Icon id='home' fixedWidth /><FormattedMessage id='tabs_bar.home' defaultMessage='Home' /></NavLink>,
@ -82,6 +82,11 @@ class TabsBar extends React.PureComponent {
</nav>
<div id='tabs-bar__portal' />
{ pinnedInfo &&
<div className="hero-widget__text pinned-info">
<p>{pinnedInfo}</p>
</div>
}
</div>
);
}

+ 1
- 0
app/javascript/mastodon/initial_state.js View File

@ -26,5 +26,6 @@ export const showTrends = getMeta('trends');
export const title = getMeta('title');
export const treeRoot = getMeta('tree_root');
export const pinnedInfo = getMeta('pinned_info');
export default initialState;

+ 2
- 1
app/serializers/initial_state_serializer.rb View File

@ -22,7 +22,8 @@ class InitialStateSerializer < ActiveModel::Serializer
mascot: instance_presenter.mascot&.file&.url,
profile_directory: Setting.profile_directory,
trends: Setting.trends,
tree_root: Setting.site_description,
tree_root: ENV['TREE_ADDRESS'],
pinned_info: Setting.site_description,
}
if object.current_account

+ 2
- 2
config/initializers/rack_attack.rb View File

@ -53,11 +53,11 @@ class Rack::Attack
req.remote_ip == '127.0.0.1' || req.remote_ip == '::1'
end
throttle('throttle_authenticated_api', limit: 300, period: 2.minutes) do |req|
throttle('throttle_authenticated_api', limit: 300, period: 5.minutes) do |req|
req.authenticated_user_id if req.api_request?
end
throttle('throttle_unauthenticated_api', limit: 300, period: 2.minutes) do |req|
throttle('throttle_unauthenticated_api', limit: 300, period: 5.minutes) do |req|
req.remote_ip if req.api_request? && req.unauthenticated?
end

Loading…
Cancel
Save