wco_models 3.4.0.10 → 3.5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/wco/main.scss +3 -7
- data/app/assets/stylesheets/wco/photos.scss +1 -2
- data/app/controllers/wco/api/newspartials_controller.rb +9 -0
- data/app/controllers/wco/newsvideos_controller.rb +12 -6
- data/app/controllers/wco/office_action_templates_controller.rb +0 -3
- data/app/controllers/wco/publishers_controller.rb +16 -6
- data/app/controllers/wco/reports_controller.rb +5 -6
- data/app/controllers/wco/sitemap_paths_controller.rb +2 -14
- data/app/controllers/wco/sites_controller.rb +1 -1
- data/app/controllers/wco/tags_controller.rb +1 -1
- data/app/models/iro/option.rb +4 -37
- data/app/models/iro/priceitem.rb +4 -62
- data/app/models/tda/option.rb +41 -39
- data/app/models/wco/newspartial.rb +12 -2
- data/app/models/wco/publisher.rb +8 -29
- data/app/models/wco/report.rb +2 -12
- data/app/models/wco/setting.rb +1 -1
- data/app/models/wco/site.rb +67 -1
- data/app/models/wco/sitemap_path.rb +13 -19
- data/app/models/wco/tag.rb +8 -15
- data/app/views/wco/api/newsproducer/_studio_blue2.js +16 -37
- data/app/views/wco/api/newsproducer/_studio_fps.js +12 -12
- data/app/views/wco/api/newsproducer/studio_fps.html.erb +8 -10
- data/app/views/wco/api/newsproducer/trash/_scenes.js-bk +20 -0
- data/app/views/wco/api/newsproducer/trash/_scenes.js.erb +15 -0
- data/app/views/wco/api/newsproducer/trash/_studio_blue0.js +326 -0
- data/app/views/wco/api/newsproducer/trash/_studio_blue1.js +733 -0
- data/app/views/wco/api/newsproducer/trash/studio_blue0.html.erb +27 -0
- data/app/views/wco/api/newsproducer/trash/studio_blue1.html.erb +108 -0
- data/app/views/wco/api/newsvideos/show.jbuilder +1 -1
- data/app/views/wco/newsvideos/show.haml +2 -2
- data/app/views/wco/office_action_templates/index.haml +1 -1
- data/app/views/wco/office_actions/_actions.haml +1 -1
- data/app/views/wco/publishers/_form.haml +2 -11
- data/app/views/wco/publishers/_post_with.haml +1 -1
- data/app/views/wco/reports/_form.haml +2 -13
- data/app/views/wco/reports/_index.haml +11 -18
- data/app/views/wco/reports/show.haml +1 -6
- data/app/views/wco/sitemap_paths/_index.haml +0 -1
- data/app/views/wco/sitemap_paths/check.haml +13 -0
- data/app/views/wco/sites/index.haml +0 -6
- data/app/views/wco/sites/show.haml +1 -1
- data/app/views/wco/tags/_form.haml +0 -3
- data/config/routes.rb +12 -11
- data/lib/shortcuts.rb +1 -1
- data/lib/wco_models.rb +1 -1
- metadata +28 -24
- data/app/models/wco/publisher_d10.rb +0 -50
- data/app/views/wco/api/newsproducer/README_newsproducer.txt +0 -12
- data/app/views/wco/sitemap_paths/show.haml +0 -14
- /data/app/views/wco/api/newsproducer/{_scenes.js-bk → done/_scenes.js-bk} +0 -0
- /data/app/views/wco/api/newsproducer/{_scenes.js.erb → done/_scenes.js.erb} +0 -0
- /data/app/views/wco/api/newsproducer/{_studio_1.js → done/_studio_1.js} +0 -0
- /data/app/views/wco/api/newsproducer/{_studio_blue0.js → done/_studio_blue0.js} +0 -0
- /data/app/views/wco/api/newsproducer/{_studio_blue1.js → done/_studio_blue1.js} +0 -0
- /data/app/views/wco/api/newsproducer/{_studio_coc.js → done/_studio_coc.js} +0 -0
- /data/app/views/wco/api/newsproducer/{_studio_coc.js-bk → done/_studio_coc.js-bk} +0 -0
- /data/app/views/wco/api/newsproducer/{_studio_coc.js-cannon → done/_studio_coc.js-cannon} +0 -0
- /data/app/views/wco/api/newsproducer/{_studio_ra2.js → done/_studio_ra2.js} +0 -0
- /data/app/views/wco/api/newsproducer/{_touch_controls.js → done/_touch_controls.js} +0 -0
- /data/app/views/wco/api/newsproducer/{_touch_pad.css → done/_touch_pad.css} +0 -0
- /data/app/views/wco/api/newsproducer/{canvas.html.erb → done/canvas.html.erb} +0 -0
- /data/app/views/wco/api/newsproducer/{canvas_minimal.html.erb → done/canvas_minimal.html.erb} +0 -0
- /data/app/views/wco/api/newsproducer/{games_fps.html → done/games_fps.html} +0 -0
- /data/app/views/wco/api/newsproducer/{studio_1.html.erb → done/studio_1.html.erb} +0 -0
- /data/app/views/wco/api/newsproducer/{studio_blue0.html.erb → done/studio_blue0.html.erb} +0 -0
- /data/app/views/wco/api/newsproducer/{studio_blue1.html.erb → done/studio_blue1.html.erb} +0 -0
- /data/app/views/wco/api/newsproducer/{studio_coc.html.erb → done/studio_coc.html.erb} +0 -0
- /data/app/views/wco/api/newsproducer/{studio_ra2.html.erb → done/studio_ra2.html.erb} +0 -0
data/app/models/wco/report.rb
CHANGED
|
@@ -25,24 +25,14 @@ class Wco::Report
|
|
|
25
25
|
|
|
26
26
|
field :body
|
|
27
27
|
def body_json
|
|
28
|
-
|
|
29
|
-
if FORMAT_PLAINTEXT == body_format
|
|
30
|
-
out = out.gsub(/\r/, '').gsub(/\n\n+/, '<br /><br />')
|
|
31
|
-
end
|
|
32
|
-
out.to_json
|
|
28
|
+
body.gsub(/\r/, '').gsub(/\n\n+/, '<br /><br />').to_json
|
|
33
29
|
end
|
|
34
|
-
FORMAT_PLAINTEXT = 'format-plaintext'
|
|
35
|
-
FORMAT_FULLHTML = 'format-fullhtml'
|
|
36
|
-
FORMATS = [ FORMAT_PLAINTEXT, FORMAT_FULLHTML ]
|
|
37
|
-
field :body_format, type: :string, default: FORMAT_PLAINTEXT
|
|
38
30
|
|
|
39
31
|
field :x, :type => Float
|
|
40
32
|
field :y, :type => Float
|
|
41
33
|
field :z, :type => Float
|
|
42
|
-
field :source_url, type: :string
|
|
43
|
-
field :summary, type: :string
|
|
44
34
|
|
|
45
|
-
belongs_to :author, class_name: 'Wco::Profile'
|
|
35
|
+
belongs_to :author, class_name: 'Wco::Profile'
|
|
46
36
|
|
|
47
37
|
has_one :image_thumb, class_name: 'Wco::Photo', inverse_of: :report, dependent: :destroy
|
|
48
38
|
accepts_nested_attributes_for :image_thumb
|
data/app/models/wco/setting.rb
CHANGED
|
@@ -5,7 +5,7 @@ class Wco::Setting
|
|
|
5
5
|
store_in collection: 'wco_settings'
|
|
6
6
|
|
|
7
7
|
KEYS = [ 'HEAD_TTS_ORIGIN', 'ISHLIB3JS_ROOT',
|
|
8
|
-
'OPENAI_API_KEY', 'PEXELS_API_KEY',
|
|
8
|
+
'OPENAI_API_KEY', 'PEXELS_API_KEY', 'PUPPETEER_ROOT',
|
|
9
9
|
'WASYACO_ORIGIN', 'WASYACO_SIMPLE_API_KEY', 'WASYACO_SIMPLE_API_SECRET',
|
|
10
10
|
];
|
|
11
11
|
|
data/app/models/wco/site.rb
CHANGED
|
@@ -18,7 +18,7 @@ class Wco::Site
|
|
|
18
18
|
has_many :logs, inverse_of: :obj
|
|
19
19
|
has_many :publishers # , class_name: 'Wco::Publisher'
|
|
20
20
|
has_many :sitemap_paths, class_name: 'Wco::SitemapPath'
|
|
21
|
-
has_many :tags, class_name: 'Wco::Tag'
|
|
21
|
+
has_many :tags, class_name: 'Wco::Tag'
|
|
22
22
|
|
|
23
23
|
field :slug
|
|
24
24
|
validates :slug, presence: true, uniqueness: true
|
|
@@ -34,12 +34,78 @@ class Wco::Site
|
|
|
34
34
|
|
|
35
35
|
def to_s
|
|
36
36
|
slug
|
|
37
|
+
# origin
|
|
37
38
|
end
|
|
38
39
|
|
|
39
40
|
def self.list
|
|
40
41
|
[[nil,nil]] + all.map { |s| [ s.slug, s.id ] }
|
|
41
42
|
end
|
|
42
43
|
|
|
44
|
+
def body
|
|
45
|
+
{
|
|
46
|
+
"_links": {
|
|
47
|
+
"type":{"href":"http://pi.local/rest/type/node/article"}
|
|
48
|
+
},
|
|
49
|
+
"title":[{"value":"Node +++ 123 bac +++" }],
|
|
50
|
+
"body":[{"value": "<b>hello, wor</b>ld!", "format": "full_html" }],
|
|
51
|
+
"type":[{"target_id":"article"}],
|
|
52
|
+
"status": [{"value": 1}],
|
|
53
|
+
"_embedded": {
|
|
54
|
+
"http://pi.local/rest/relation/node/article/field_issue": [
|
|
55
|
+
{ "uuid": [{ "value": "56229a95-d675-43e1-99b1-f9e11b5579c5" }] }
|
|
56
|
+
],
|
|
57
|
+
"http://pi.local/rest/relation/node/article/field_tags": [
|
|
58
|
+
{ "uuid": [{ "value": "45646a7d-1a16-42e8-b758-f6e1c8d976f7" }] },
|
|
59
|
+
{ "uuid": [{ "value": "834e34e2-05ae-498d-b876-453798872ce1" }] }
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def do_post
|
|
67
|
+
HTTParty.post( post_url,
|
|
68
|
+
body: JSON.generate( body ),
|
|
69
|
+
headers: { 'Content-Type' => 'application/hal+json' },
|
|
70
|
+
basic_auth: { username: username, password: password },
|
|
71
|
+
)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def wp_import
|
|
75
|
+
site = self
|
|
76
|
+
|
|
77
|
+
root_tag = Wco::Tag.find_or_create_by slug: "#{site.slug}_wp-import", site_id: site.id
|
|
78
|
+
url = "#{site.origin}/wp-json/wp/v2/posts"
|
|
79
|
+
pi_admin = Wco::Profile.find_or_create_by email: 'admin@piousbox.com'
|
|
80
|
+
n_pages = 12
|
|
81
|
+
per_page = 100
|
|
82
|
+
|
|
83
|
+
(1..n_pages).each do |page|
|
|
84
|
+
print "Page #{page}"
|
|
85
|
+
|
|
86
|
+
posts = HTTParty.get url, query: { per_page: per_page, page: page }
|
|
87
|
+
posts.each do |post|
|
|
88
|
+
report = Wco::Report.new({
|
|
89
|
+
legacy_id: post['id'],
|
|
90
|
+
created_at: post['date'],
|
|
91
|
+
slug: post['link'].sub(site.origin, ''),
|
|
92
|
+
title: post['title']['rendered'],
|
|
93
|
+
subtitle: post['excerpt']['rendered'],
|
|
94
|
+
body: post['content']['rendered'],
|
|
95
|
+
author: pi_admin,
|
|
96
|
+
tag_ids: ( [ root_tag ] + site.tags.where( :legacy_id.in => post['categories'] ) ).map(&:id),
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
if report.save
|
|
100
|
+
print '^'
|
|
101
|
+
else
|
|
102
|
+
puts report.errors.messages
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
puts "ok"
|
|
107
|
+
end
|
|
108
|
+
|
|
43
109
|
def check_sitemap
|
|
44
110
|
@results = []
|
|
45
111
|
@total_count = 0
|
|
@@ -15,15 +15,9 @@ class Wco::SitemapPath
|
|
|
15
15
|
field :selectors, type: Array, default: []
|
|
16
16
|
field :title, type: String
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
field :results, type: Array, default: []
|
|
19
19
|
field :status, type: String
|
|
20
20
|
|
|
21
|
-
# field :results, type: Array, default: []
|
|
22
|
-
has_many :logs, inverse_of: :obj
|
|
23
|
-
def results
|
|
24
|
-
logs.map { |log| "#{log.message} [on #{log.created_at.to_s[0...10]}]" }
|
|
25
|
-
end
|
|
26
|
-
|
|
27
21
|
def check
|
|
28
22
|
self.status = 'NOT_OK'
|
|
29
23
|
skip_rest = false
|
|
@@ -32,26 +26,26 @@ class Wco::SitemapPath
|
|
|
32
26
|
begin
|
|
33
27
|
body = HTTParty.get( "#{site.origin}#{self[:path]}" ).body
|
|
34
28
|
rescue OpenSSL::SSL::SSLError => err
|
|
35
|
-
|
|
29
|
+
results.push "NOT OK [ssl-exception] #{self[:path]}" # .red
|
|
36
30
|
return
|
|
37
31
|
end
|
|
38
32
|
doc = Nokogiri::HTML( body )
|
|
39
33
|
out = doc.search self[:selector]
|
|
40
34
|
if out.present?
|
|
41
|
-
|
|
35
|
+
results.push "OK #{self[:path]}"
|
|
42
36
|
self.status = 'OK'
|
|
43
37
|
else
|
|
44
|
-
|
|
38
|
+
results.push "NOT OK [selector-missing] #{self[:path]}" # .red
|
|
45
39
|
end
|
|
46
40
|
|
|
47
41
|
elsif self[:redirect_to].present?
|
|
48
42
|
out = HTTParty.get( "#{site.origin}#{self[:path]}", follow_redirects: false )
|
|
49
43
|
if( out.headers[:location] == self[:redirect_to] ||
|
|
50
44
|
out.headers[:location] == "#{site.origin}#{self[:redirect_to]}" )
|
|
51
|
-
|
|
45
|
+
results.push "OK #{self[:path]}"
|
|
52
46
|
self.status = 'OK'
|
|
53
47
|
else
|
|
54
|
-
|
|
48
|
+
results.push "NOT OK [redirect-missing] #{self[:path]}" # .red
|
|
55
49
|
|
|
56
50
|
puts!( out.response, 'response' ) if DEBUG
|
|
57
51
|
# puts!( out.body, 'body' ) if DEBUG
|
|
@@ -62,7 +56,7 @@ class Wco::SitemapPath
|
|
|
62
56
|
end
|
|
63
57
|
skip_rest = true
|
|
64
58
|
else
|
|
65
|
-
|
|
59
|
+
results.push "SKIP #{self[:path]}"
|
|
66
60
|
self.status = 'OK'
|
|
67
61
|
skip_rest = true
|
|
68
62
|
end
|
|
@@ -72,10 +66,10 @@ class Wco::SitemapPath
|
|
|
72
66
|
if self[:meta_description].present?
|
|
73
67
|
out = doc.search( 'head meta[name="description"]' )[0]['content']
|
|
74
68
|
if out.include?( self[:meta_description] )
|
|
75
|
-
|
|
69
|
+
results.push "OK #{self[:path]} meta_description"
|
|
76
70
|
else
|
|
77
71
|
self.status = 'NOT_OK'
|
|
78
|
-
|
|
72
|
+
results.push "NOT OK [meta-description-no-contain] #{self[:path]}" # .red
|
|
79
73
|
end
|
|
80
74
|
end
|
|
81
75
|
|
|
@@ -83,10 +77,10 @@ class Wco::SitemapPath
|
|
|
83
77
|
self[:selectors].each do |selector|
|
|
84
78
|
out = doc.search selector
|
|
85
79
|
if out.present?
|
|
86
|
-
|
|
80
|
+
results.push "OK #{self[:path]} selectors:#{selector}"
|
|
87
81
|
else
|
|
88
82
|
self.status = 'NOT_OK'
|
|
89
|
-
|
|
83
|
+
results.push "NOT OK [selectors-missing:#{selector}] #{self[:path]}" # .red
|
|
90
84
|
end
|
|
91
85
|
end
|
|
92
86
|
end
|
|
@@ -94,10 +88,10 @@ class Wco::SitemapPath
|
|
|
94
88
|
if self[:title].present?
|
|
95
89
|
out = doc.search( 'head title' )[0].text
|
|
96
90
|
if out.include?( self[:title] )
|
|
97
|
-
|
|
91
|
+
results.push "OK #{self[:path]} title"
|
|
98
92
|
else
|
|
99
93
|
self.status = 'NOT_OK'
|
|
100
|
-
|
|
94
|
+
results.push "NOT OK [title-no-contain] #{self[:path]}" # .red
|
|
101
95
|
end
|
|
102
96
|
end
|
|
103
97
|
|
data/app/models/wco/tag.rb
CHANGED
|
@@ -5,21 +5,19 @@ class Wco::Tag
|
|
|
5
5
|
store_in collection: 'wco_tags'
|
|
6
6
|
|
|
7
7
|
field :slug
|
|
8
|
-
validates :slug, presence: true, uniqueness:
|
|
8
|
+
validates :slug, presence: true, uniqueness: true
|
|
9
9
|
index({ slug: -1 })
|
|
10
10
|
|
|
11
11
|
field :weight, type: :string, default: 'jjj'
|
|
12
|
-
field :external_id, type: :string
|
|
13
|
-
def eid; external_id; end
|
|
14
12
|
|
|
15
13
|
belongs_to :parent, class_name: '::Wco::Tag', inverse_of: :sons, optional: true
|
|
16
14
|
has_many :sons, class_name: '::Wco::Tag', inverse_of: :parent
|
|
17
15
|
|
|
18
|
-
belongs_to :site,
|
|
19
|
-
belongs_to :sidebar_profile, class_name: 'Wco::Profile',
|
|
20
|
-
has_many :email_filters,
|
|
21
|
-
has_many :email_templates,
|
|
22
|
-
has_many :ajects,
|
|
16
|
+
belongs_to :site, class_name: '::Wco::Site', optional: true
|
|
17
|
+
belongs_to :sidebar_profile, class_name: 'Wco::Profile', optional: true
|
|
18
|
+
has_many :email_filters, class_name: '::WcoEmail::EmailFilter', inverse_of: :tag
|
|
19
|
+
has_many :email_templates, class_name: '::WcoEmail::EmailTemplate', inverse_of: :tag
|
|
20
|
+
has_many :ajects, class_name: '::WcoEmail::EmailFilterAction', inverse_of: :aject
|
|
23
21
|
|
|
24
22
|
has_and_belongs_to_many :conversations, class_name: '::WcoEmail::Conversation', index: true
|
|
25
23
|
has_and_belongs_to_many :galleries, class_name: '::Wco::Gallery'
|
|
@@ -29,7 +27,6 @@ class Wco::Tag
|
|
|
29
27
|
has_and_belongs_to_many :message_stubs, class_name: '::WcoEmail::MessageStub'
|
|
30
28
|
has_and_belongs_to_many :newsvideos, class_name: '::Wco::Newsvideo'
|
|
31
29
|
has_and_belongs_to_many :reports, class_name: '::Wco::Report'
|
|
32
|
-
has_and_belongs_to_many :publishers, class_name: '::Wco::Publisher'
|
|
33
30
|
has_and_belongs_to_many :videos, class_name: '::Wco::Video'
|
|
34
31
|
|
|
35
32
|
|
|
@@ -74,13 +71,9 @@ class Wco::Tag
|
|
|
74
71
|
|
|
75
72
|
|
|
76
73
|
def to_s
|
|
77
|
-
|
|
78
|
-
"#{slug}@#{site}"
|
|
79
|
-
else
|
|
80
|
-
slug
|
|
81
|
-
end
|
|
74
|
+
slug
|
|
82
75
|
end
|
|
83
76
|
def self.list
|
|
84
|
-
[[nil,nil]] + all.
|
|
77
|
+
[[nil,nil]] + all.order_by( slug: :asc ).map { |p| [ p.slug, p.id ] }
|
|
85
78
|
end
|
|
86
79
|
end
|
|
@@ -10,9 +10,8 @@ const logg = (a, b="", c=null) => {
|
|
|
10
10
|
console.log(`+++ ${b}:`, a) // eslint-disable-line no-console
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const MODELS_ROOT = 'https://
|
|
14
|
-
|
|
15
|
-
const AVATARS_ROOT = 'https://localhost/vendor/models/avatars';
|
|
13
|
+
const MODELS_ROOT = 'https://cdn.jsdelivr.net/gh/wasya-co/ishlib3js@v0.4.14/public/vendor/models'
|
|
14
|
+
const AVATARS_ROOT = `${MODELS_ROOT}/avatars`
|
|
16
15
|
const avatars = {
|
|
17
16
|
brunette: { type: 'F', url: `${AVATARS_ROOT}/brunette/model.glb` },
|
|
18
17
|
cara: { type: 'F', url: `${AVATARS_ROOT}/cara/model.glb` }, // short hair
|
|
@@ -38,36 +37,7 @@ $('select.avatar').each((_idx, el) => {
|
|
|
38
37
|
}
|
|
39
38
|
})
|
|
40
39
|
|
|
41
|
-
let scenes = {
|
|
42
|
-
skybox_1: {
|
|
43
|
-
url: `${MODELS_ROOT}/scenes/000mb skybox_1/scene.glb`,
|
|
44
|
-
height: 30,
|
|
45
|
-
},
|
|
46
|
-
studio_tron: {
|
|
47
|
-
height: 10,
|
|
48
|
-
url: `${MODELS_ROOT}/scenes/003mb studio_tron/scene.glb`,
|
|
49
|
-
},
|
|
50
|
-
room_1: {
|
|
51
|
-
height: 6,
|
|
52
|
-
url: `${MODELS_ROOT}/scenes/000mb room-1/scene.glb`,
|
|
53
|
-
},
|
|
54
|
-
studio_blue: {
|
|
55
|
-
height: 4.3,
|
|
56
|
-
url: `${MODELS_ROOT}/scenes/000mb studio_blue/scene.glb`,
|
|
57
|
-
},
|
|
58
|
-
purple_stage: {
|
|
59
|
-
height: 10,
|
|
60
|
-
url: `${MODELS_ROOT}/scenes/000mb purple_stage/scene.glb`,
|
|
61
|
-
},
|
|
62
|
-
red_stage: {
|
|
63
|
-
height: 10,
|
|
64
|
-
url: `${MODELS_ROOT}/scenes/000mb red_stage/scene.glb`,
|
|
65
|
-
},
|
|
66
|
-
// skybox_1: `${MODELS_ROOT}/scenes//scene.glb`,
|
|
67
|
-
|
|
68
|
-
newsroom_green: `${MODELS_ROOT}/scenes/001mb newsroom_green/scene.glb`,
|
|
69
|
-
rick_and_morty_garage: `${MODELS_ROOT}/scenes/003mb rick-and-morty-garage/scene.glb`,
|
|
70
|
-
}
|
|
40
|
+
let scenes = await fetch(`${MODELS_ROOT}/scenes/index.json`).then(r => r.json())
|
|
71
41
|
const SCENE_STOR = 'studio'
|
|
72
42
|
$.each(scenes, (name) => {
|
|
73
43
|
$('<option>', { value: name, text: name }).appendTo($('select.studio'))
|
|
@@ -439,6 +409,8 @@ function tickEvents(elapsedMs) {
|
|
|
439
409
|
/*
|
|
440
410
|
**/
|
|
441
411
|
async function init() {
|
|
412
|
+
logg(null, 'init()')
|
|
413
|
+
|
|
442
414
|
if (newspartial_id) {
|
|
443
415
|
try {
|
|
444
416
|
const url = wco_origin + '/wco/api/newspartials/' + newspartial_id + '/config.json?api_key=' + api_key + '&api_secret=' + api_secret
|
|
@@ -496,10 +468,10 @@ async function init() {
|
|
|
496
468
|
|
|
497
469
|
|
|
498
470
|
let studio
|
|
499
|
-
async function load_studio(
|
|
500
|
-
|
|
471
|
+
async function load_studio(cfg) {
|
|
472
|
+
logg(cfg, 'load_studio()')
|
|
501
473
|
if (studio && studio.parent) studio.parent.remove(studio)
|
|
502
|
-
studio = (await gltfLoader.loadAsync(cfg.
|
|
474
|
+
studio = (await gltfLoader.loadAsync(`${cfg.path}/scene.glb`)).scene
|
|
503
475
|
rescale(studio, { height: cfg.height })
|
|
504
476
|
set_shadows(studio, false, true)
|
|
505
477
|
scene.add(studio)
|
|
@@ -659,6 +631,7 @@ async function init() {
|
|
|
659
631
|
renderer.setAnimationLoop(animate)
|
|
660
632
|
}
|
|
661
633
|
|
|
634
|
+
/*
|
|
662
635
|
let semafore = false
|
|
663
636
|
document.addEventListener('DOMContentLoaded', async function(e) {
|
|
664
637
|
if (!semafore) {
|
|
@@ -666,6 +639,12 @@ document.addEventListener('DOMContentLoaded', async function(e) {
|
|
|
666
639
|
await init()
|
|
667
640
|
}
|
|
668
641
|
})
|
|
642
|
+
*/
|
|
643
|
+
if (document.readyState === 'loading') {
|
|
644
|
+
document.addEventListener('DOMContentLoaded', init)
|
|
645
|
+
} else {
|
|
646
|
+
init()
|
|
647
|
+
}
|
|
669
648
|
|
|
670
649
|
function cameras_fn(which) {
|
|
671
650
|
switch (which) {
|
|
@@ -909,4 +888,4 @@ $('#jesture').on('click', async () => {
|
|
|
909
888
|
}
|
|
910
889
|
})
|
|
911
890
|
|
|
912
|
-
console.log('+++ loaded wco_models :: newsproducer ::
|
|
891
|
+
console.log('+++ loaded wco_models :: newsproducer :: studio_blue2.js')
|
|
@@ -14,10 +14,12 @@ document.addEventListener("keydown", e => {
|
|
|
14
14
|
}
|
|
15
15
|
})
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const ISH_VERSION = 'v0.4.14'
|
|
18
|
+
const MODELS_ROOT = `https://cdn.jsdelivr.net/gh/wasya-co/ishlib3js@${ISH_VERSION}/public/vendor/models`
|
|
19
|
+
|
|
19
20
|
const SCENE_STOR = 'studio'
|
|
20
|
-
const scenes = await fetch(
|
|
21
|
+
const scenes = await fetch(`${MODELS_ROOT}/scenes/index.json`).then(r => r.json())
|
|
22
|
+
logg(scenes, 'scenes13')
|
|
21
23
|
$.each(scenes, (name) => {
|
|
22
24
|
$('<option>', { value: name, text: name }).appendTo($('select.studio'))
|
|
23
25
|
})
|
|
@@ -760,7 +762,7 @@ function scene_cfg(s) {
|
|
|
760
762
|
if (typeof s.url === 'string') {
|
|
761
763
|
return { ...s, url: s.url }
|
|
762
764
|
}
|
|
763
|
-
logg(s, 'out')
|
|
765
|
+
logg(s, 'scene_cfg() out')
|
|
764
766
|
return s
|
|
765
767
|
}
|
|
766
768
|
|
|
@@ -792,14 +794,10 @@ function reset_player() {
|
|
|
792
794
|
|
|
793
795
|
const loader = new GLTFLoader()
|
|
794
796
|
|
|
795
|
-
function
|
|
796
|
-
return glb_url.replace(/[^/]+$/, 'specsheet.json')
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
async function load_specsheet(glb_url) {
|
|
797
|
+
async function load_specsheet(cfg) {
|
|
800
798
|
specsheet = null
|
|
801
799
|
try {
|
|
802
|
-
const res = await fetch(
|
|
800
|
+
const res = await fetch(`${cfg.path}/specsheet.json`)
|
|
803
801
|
if (!res.ok) return
|
|
804
802
|
specsheet = await res.json()
|
|
805
803
|
logg(specsheet, 'specsheet')
|
|
@@ -809,11 +807,13 @@ async function load_specsheet(glb_url) {
|
|
|
809
807
|
}
|
|
810
808
|
|
|
811
809
|
async function load_studio(s) {
|
|
810
|
+
logg(s, 'load_studio')
|
|
811
|
+
|
|
812
812
|
const cfg = scene_cfg(s)
|
|
813
813
|
if (studio && studio.parent) studio.parent.remove(studio)
|
|
814
814
|
if (octree_helper && octree_helper.parent) octree_helper.parent.remove(octree_helper)
|
|
815
|
-
const gltf = await loader.loadAsync(cfg.
|
|
816
|
-
await load_specsheet(cfg
|
|
815
|
+
const gltf = await loader.loadAsync(`${cfg.path}/scene.glb`)
|
|
816
|
+
await load_specsheet(cfg)
|
|
817
817
|
studio = gltf.scene
|
|
818
818
|
if (cfg.height) rescale(studio, { height: cfg.height })
|
|
819
819
|
apply_studio_mesh(studio)
|
|
@@ -14,17 +14,14 @@
|
|
|
14
14
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
|
15
15
|
|
|
16
16
|
<%= stylesheet_link_tag "wco/application", media: "all" %>
|
|
17
|
-
<%= stylesheet_link_tag "wco/studio",
|
|
17
|
+
<%= stylesheet_link_tag "wco/studio", media: "all" %>
|
|
18
18
|
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
21
|
|
|
22
|
-
<style><%= render 'touch_pad.css' %></style>
|
|
22
|
+
<style><%= render 'wco/api/newsproducer/done/touch_pad.css' %></style>
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
|
|
24
|
+
<script src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js" async></script>
|
|
28
25
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
|
29
26
|
<script src="/vendor/javascript/CCapture.all.min.js"></script>
|
|
30
27
|
|
|
@@ -33,7 +30,8 @@
|
|
|
33
30
|
{
|
|
34
31
|
"three": "https://cdn.jsdelivr.net/npm/three@0.180.0/build/three.module.js/+esm",
|
|
35
32
|
"three/addons/": "https://cdn.jsdelivr.net/npm/three@0.180.0/examples/jsm/",
|
|
36
|
-
"talkinghead": "https://cdn.jsdelivr.net/gh/wasya-co/TalkingHead@1.7.1/modules/talkinghead.mjs"
|
|
33
|
+
"talkinghead": "https://cdn.jsdelivr.net/gh/wasya-co/TalkingHead@1.7.1/modules/talkinghead.mjs",
|
|
34
|
+
"TouchControls": "https://cdn.jsdelivr.net/gh/wasya-co/ishlib3js@v0.4.13/public/2026/js/touch_controls.js"
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
37
|
</script>
|
|
@@ -47,7 +45,7 @@
|
|
|
47
45
|
<select class='studio'></select>
|
|
48
46
|
<em>Status:</em><span id='status'>pending</span>
|
|
49
47
|
</div>
|
|
50
|
-
<button id='fullScreen'
|
|
48
|
+
<button id='fullScreen'>fullScrn</button>
|
|
51
49
|
|
|
52
50
|
<div class='item'>
|
|
53
51
|
<label>
|
|
@@ -193,7 +191,7 @@
|
|
|
193
191
|
</div>
|
|
194
192
|
</div>
|
|
195
193
|
|
|
196
|
-
<script type="module"><%= render 'touch_controls.js' %></script>
|
|
194
|
+
<script type="module"><%= render 'wco/api/newsproducer/done/touch_controls.js' %></script>
|
|
197
195
|
<script type="module"><%= render 'studio_fps.js' %></script>
|
|
198
196
|
|
|
199
|
-
</body></html>
|
|
197
|
+
</body></html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
const MODELS_ROOT = '/vendor/models'
|
|
3
|
+
let scenes = {
|
|
4
|
+
collision_world: `${MODELS_ROOT}/scenes/000mb collision-world/collision-world.glb`,
|
|
5
|
+
skybox_1: { height: 30, url: `${MODELS_ROOT}/scenes/000mb skybox_1/scene.glb` },
|
|
6
|
+
room_1: { height: 6, url: `${MODELS_ROOT}/scenes/000mb room-1/scene.glb` },
|
|
7
|
+
mountain_1: { height: 30, url: `${MODELS_ROOT}/scenes/000mb lowpoly-mountain/scene.glb` },
|
|
8
|
+
meshy_3: { height: 30, url: `${MODELS_ROOT}/scenes/004mb meshy-scene-3/scene.glb` },
|
|
9
|
+
newsroom_green: { height: 3.3, url: `${MODELS_ROOT}/scenes/001mb newsroom_green/scene.glb` },
|
|
10
|
+
rick_and_morty_garage: `${MODELS_ROOT}/scenes/003mb rick-and-morty-garage/scene.glb`,
|
|
11
|
+
white_park: { height: 10, name: '003mb h100cm white_park' },
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
<% Dir.glob(Rails.root.join('public/vendor/models/scenes/00*')).each do |file| %>
|
|
15
|
+
<%- basename = File.basename(file) -%>
|
|
16
|
+
<%= basename.split.last -%>: {
|
|
17
|
+
<%= "height: #{$1.to_i / 10.0}," if basename =~ /h(\d{3})cm/ -%>
|
|
18
|
+
name: "<%= File.basename(file) -%>",
|
|
19
|
+
},
|
|
20
|
+
<% end %>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
let MODELS_ROOT = '/vendor/models'
|
|
3
|
+
let scenes = {
|
|
4
|
+
|
|
5
|
+
<% Dir.glob(Rails.root.join('public/vendor/models/scenes/00*')).each do |file| %>
|
|
6
|
+
<%- basename = File.basename(file) -%>
|
|
7
|
+
"<%= basename.split.last -%>": {
|
|
8
|
+
<%= "height: #{$1.to_i / 10.0}," if basename =~ / h(\d+)cm / -%>
|
|
9
|
+
<%= "height: #{$1}," if basename =~ / h(\d+) / -%>
|
|
10
|
+
name: "<%= basename -%>",
|
|
11
|
+
},
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
window.scenes = scenes
|