Updated GabTrendsController, ShopController to use Request instead of Net
• Updated: - GabTrendsController, ShopController to use Request instead of Net
This commit is contained in:
parent
2ae611d7ed
commit
0fdf762815
@ -11,14 +11,14 @@ class Api::V1::GabTrendsController < Api::BaseController
|
|||||||
body = Redis.current.get("gabtrends:feed")
|
body = Redis.current.get("gabtrends:feed")
|
||||||
|
|
||||||
if body.nil?
|
if body.nil?
|
||||||
uri = URI("https://trends.gab.com/trend-feed/json")
|
Request.new(:get, "https://trends.gab.com/trend-feed/json").perform do |res|
|
||||||
uri.query = URI.encode_www_form({})
|
if res.code == 200
|
||||||
|
body = res.body_with_limit
|
||||||
res = Net::HTTP.get_response(uri)
|
Redis.current.set("gabtrends:feed", body)
|
||||||
if res.is_a?(Net::HTTPSuccess)
|
Redis.current.expire("gabtrends:feed", 1.hour.seconds)
|
||||||
body = res.body
|
else
|
||||||
Redis.current.set("gabtrends:feed", res.body)
|
body = nil
|
||||||
Redis.current.expire("gabtrends:feed", 1.hour.seconds)
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -27,14 +27,14 @@ class Api::V1::GabTrendsController < Api::BaseController
|
|||||||
body = Redis.current.get("gabtrends:partner")
|
body = Redis.current.get("gabtrends:partner")
|
||||||
|
|
||||||
if body.nil?
|
if body.nil?
|
||||||
uri = URI("https://trends.gab.com/partner")
|
Request.new(:get, "https://trends.gab.com/partner").perform do |res|
|
||||||
uri.query = URI.encode_www_form({})
|
if res.code == 200
|
||||||
|
body = res.body_with_limit
|
||||||
res = Net::HTTP.get_response(uri)
|
Redis.current.set("gabtrends:partner", body)
|
||||||
if res.is_a?(Net::HTTPSuccess)
|
|
||||||
body = res.body
|
|
||||||
Redis.current.set("gabtrends:partner", res.body)
|
|
||||||
Redis.current.expire("gabtrends:partner", 1.minute.seconds)
|
Redis.current.expire("gabtrends:partner", 1.minute.seconds)
|
||||||
|
else
|
||||||
|
body = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -13,14 +13,14 @@ class Api::V1::ShopController < Api::BaseController
|
|||||||
body = Redis.current.get("gabstore:featuredproducts")
|
body = Redis.current.get("gabstore:featuredproducts")
|
||||||
|
|
||||||
if body.nil?
|
if body.nil?
|
||||||
uri = URI("https://shop.dissenter.com/product/group/json")
|
Request.new(:get, "https://shop.dissenter.com/product/group/json").perform do |res|
|
||||||
uri.query = URI.encode_www_form({})
|
if res.code == 200
|
||||||
|
body = res.body_with_limit
|
||||||
res = Net::HTTP.get_response(uri)
|
Redis.current.set("gabstore:featuredproducts", body)
|
||||||
if res.is_a?(Net::HTTPSuccess)
|
Redis.current.expire("gabstore:featuredproducts", 15.minutes.seconds)
|
||||||
body = res.body
|
else
|
||||||
Redis.current.set("gabstore:featuredproducts", res.body)
|
body = nil
|
||||||
Redis.current.expire("gabstore:featuredproducts", 15.minutes.seconds)
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
32
app/javascript/gabsocial/layouts/introduction_layout.js
Normal file
32
app/javascript/gabsocial/layouts/introduction_layout.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import NavigationBar from '../components/navigation_bar'
|
||||||
|
|
||||||
|
export default class IntroductionLayout extends PureComponent {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
children: PropTypes.node,
|
||||||
|
title: PropTypes.string,
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { children, title } = this.props
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={[_s.default, _s.width100PC, _s.heightMin100VH, _s.bgTertiary].join(' ')}>
|
||||||
|
|
||||||
|
<NavigationBar title={title} />
|
||||||
|
|
||||||
|
<div className={[_s.default, _s.flexRow, _s.width100PC].join(' ')}>
|
||||||
|
<div className={[_s.default, _s.width100PC].join(' ')}>
|
||||||
|
<main role='main'>
|
||||||
|
<div className={[_s.default, _s.mlAuto, _s.mrAuto].join(' ')}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
17
app/javascript/gabsocial/pages/introduction_page.js
Normal file
17
app/javascript/gabsocial/pages/introduction_page.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import PageTitle from '../features/ui/util/page_title'
|
||||||
|
import IntroductionLayout from '../layouts/introduction_layout'
|
||||||
|
|
||||||
|
export default class IntroductionPage extends PureComponent {
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { children } = this.props
|
||||||
|
|
||||||
|
return (
|
||||||
|
<IntroductionLayout>
|
||||||
|
<PageTitle path='Welcome to Gab' />
|
||||||
|
{children}
|
||||||
|
</IntroductionLayout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
16
app/models/shortcut.rb
Normal file
16
app/models/shortcut.rb
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: shortcuts
|
||||||
|
#
|
||||||
|
# id :bigint(8) not null, primary key
|
||||||
|
# account_id :bigint(8) not null
|
||||||
|
# shortcut_id :bigint(8) not null
|
||||||
|
# shortcut_type :string not null
|
||||||
|
# created_at :datetime not null
|
||||||
|
# updated_at :datetime
|
||||||
|
#
|
||||||
|
|
||||||
|
class Shortcut < ApplicationRecord
|
||||||
|
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user