atome 0.5.6.1.1 → 0.5.6.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -4
  3. data/exe/atome +78 -2
  4. data/lib/atome/genesis/generators/communication.rb +5 -0
  5. data/lib/atome/genesis/sparkle.rb +2 -2
  6. data/lib/atome/helpers/utilities.rb +9 -12
  7. data/lib/atome/version.rb +1 -1
  8. data/vendor/assets/server/atome_server.rb +15 -9
  9. data/vendor/assets/server/atome_server_wasm.rb +2 -2
  10. data/vendor/assets/src/index_server.html +1 -0
  11. data/vendor/assets/src/index_server_wasm.html +1 -0
  12. data/vendor/assets/src/js/atome/atome_helpers/communication.js +2 -0
  13. metadata +2 -33
  14. data/Guardfile +0 -0
  15. data/server/atome_server.rb +0 -293
  16. data/server/atome_server_wasm.rb +0 -112
  17. data/server/capture.rb +0 -10
  18. data/server/config.ru +0 -13
  19. data/src/css/style.css +0 -162
  20. data/src-tauri/.gitignore +0 -4
  21. data/src-tauri/Cargo.toml +0 -27
  22. data/src-tauri/build.rs +0 -3
  23. data/src-tauri/icons/128x128.png +0 -0
  24. data/src-tauri/icons/128x128@2x.png +0 -0
  25. data/src-tauri/icons/32x32.png +0 -0
  26. data/src-tauri/icons/Square107x107Logo.png +0 -0
  27. data/src-tauri/icons/Square142x142Logo.png +0 -0
  28. data/src-tauri/icons/Square150x150Logo.png +0 -0
  29. data/src-tauri/icons/Square284x284Logo.png +0 -0
  30. data/src-tauri/icons/Square30x30Logo.png +0 -0
  31. data/src-tauri/icons/Square310x310Logo.png +0 -0
  32. data/src-tauri/icons/Square44x44Logo.png +0 -0
  33. data/src-tauri/icons/Square71x71Logo.png +0 -0
  34. data/src-tauri/icons/Square89x89Logo.png +0 -0
  35. data/src-tauri/icons/StoreLogo.png +0 -0
  36. data/src-tauri/icons/icon.icns +0 -0
  37. data/src-tauri/icons/icon.ico +0 -0
  38. data/src-tauri/icons/icon.png +0 -0
  39. data/src-tauri/src/main.rs +0 -71
  40. data/src-tauri/tauri.conf.json +0 -70
  41. data/src-wasm/wasm/wasi-vfs-osx_arm +0 -0
  42. data/src-wasm/wasm/wasi-vfs-osx_x86 +0 -0
  43. data/src-wasm/wasm/wasi-vfs-unix +0 -0
  44. data/src-wasm/wasm/wasi-vfs.exe +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b95189cdeb5fd525c61044cb540b3ff487ab48afdaaf162cc8330d5dc01edd5b
4
- data.tar.gz: a7b2cc31314513f94123cf12f9223eb892fd3275c4f0e73d4921775ba1f58e0e
3
+ metadata.gz: 8a515b71a46e24e1b7ea6a668c26ee2ece0c52fb9ddce21bb132b1e115245d35
4
+ data.tar.gz: 59552abb50bb72ac0320f7ea03fa702dfc9b5d65a356937c285ef154f90c342b
5
5
  SHA512:
6
- metadata.gz: ff8cf89846a9b8abf0210356b2fd3b80a084e92bb309ee0ec263ca154d559ac84c8499da7e9161f91785ad46babb45a9c7d2d68f990b2f5a3cc7ca52cf24c0da
7
- data.tar.gz: 98e1d3e237e35adba9c1319b814c0c3c7b04620e513cf9ece38770f21f683b93c3235ff88822bd84c6b3d76c118ed8b6a864067da4afc73686476ea907644334
6
+ metadata.gz: f58521a86e18da6d1313c629dd35d60f03776beee6f2cbcbe9c8676ab6a36986ecfade194814abef3d95407fa8bebbd067ed4d9787059bb0a7ac73ff1363d2f1
7
+ data.tar.gz: 86e9a462e19c7bdb62c834b5a08e98dee89f168cd7cb904cb34cd15a62e38bd385455eced957005f491d5d27f296f4f451a3c5ce6850a705448c46f0cda0b0d5
data/Rakefile CHANGED
@@ -161,7 +161,7 @@ task :test_opal do
161
161
 
162
162
  puts 'atome opal is build and running!'
163
163
  end
164
- task :server_wasm do
164
+ task :test_server_wasm do
165
165
  project_name = :test
166
166
  source = '.'
167
167
  destination = './tmp'
@@ -171,7 +171,7 @@ task :server_wasm do
171
171
  create_application(source, destination, project_name)
172
172
  wasm_common(source, destination, project_name, wasi_file, host_mode, script_source)
173
173
  puts 'atome wasm is build and running!'
174
- build_for_server(destination, project_name, 9292, :production)
174
+ build_for_wasm_server(destination, project_name, 9292, :production)
175
175
 
176
176
  end
177
177
  task :test_server do
@@ -213,7 +213,7 @@ task :test_server do
213
213
  end
214
214
 
215
215
  end
216
- build_for_server(destination, project_name, 9292, :production)
216
+ build_for_opal_server(destination, project_name, 9292, :production)
217
217
  end
218
218
 
219
219
  task :test_osx do
@@ -292,7 +292,7 @@ task :osx_server do
292
292
  destination = './tmp'
293
293
  threads = []
294
294
  threads << Thread.new do
295
- build_for_server(destination, project_name, 9292, :production)
295
+ build_for_opal_server(destination, project_name, 9292, :production)
296
296
  end
297
297
  build_for_osx(destination)
298
298
 
data/exe/atome CHANGED
@@ -353,7 +353,7 @@ def build_for_osx(destination, mode = :dev)
353
353
 
354
354
  end
355
355
 
356
- def build_for_server(destination, project_name, port, production)
356
+ def build_for_opal_server(destination, project_name, port, production)
357
357
  if production
358
358
  prod = '--env production'
359
359
  ru_file = <<STR
@@ -383,7 +383,9 @@ STR
383
383
  File.open("#{destination}/#{project_name}/server/config.ru", "w") do |f|
384
384
  f.write(ru_file)
385
385
  end
386
+ puts 'o-a'
386
387
  `cd #{destination}/#{project_name}/server;puma --port #{port} #{prod}`
388
+ puts 'o-b'
387
389
  else
388
390
  # code to exec with Unix/Linux
389
391
  File.open("#{destination}/#{project_name}/server/config.ru", "w") do |f|
@@ -394,6 +396,55 @@ STR
394
396
 
395
397
  end
396
398
 
399
+
400
+ def build_for_wasm_server(destination, project_name, port, production)
401
+ if production
402
+ prod = '--env production'
403
+ ru_file = <<STR
404
+ require 'roda'
405
+ require './atome_server_wasm.rb'
406
+ run App.app.freeze
407
+ STR
408
+ else
409
+ ru_file = <<STR
410
+ require 'roda'
411
+ require 'rack/unreloader'
412
+ Unreloader = Rack::Unreloader.new(subclasses: %w[Roda]) { App }
413
+ Unreloader.require './atome_server_wasm.rb'
414
+ run Unreloader
415
+ require './atome_server.rb'
416
+ STR
417
+ end
418
+
419
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
420
+
421
+ # code to exec with Windows
422
+ File.open("#{destination}\\#{project_name}\\server\\config.ru", "w") do |f|
423
+ f.write(ru_file)
424
+ end
425
+ `cd /d #{destination}\\#{project_name}\\server && puma --port #{port} #{prod}`
426
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
427
+ # code to exec with MacOS
428
+ File.open("#{destination}/#{project_name}/server/config.ru", "w") do |f|
429
+ f.write(ru_file)
430
+ end
431
+ puts 'w-a'
432
+
433
+ `cd #{destination}/#{project_name}/server;puma --port #{port} #{prod}`
434
+ puts 'w-b'
435
+
436
+ else
437
+ puts 'e'
438
+ # code to exec with Unix/Linux
439
+ File.open("#{destination}/#{project_name}/server/config.ru", "w") do |f|
440
+ f.write(ru_file)
441
+ end
442
+ `cd #{destination}/#{project_name}/server;puma --port #{port} #{prod}`
443
+ end
444
+ puts 'f'
445
+
446
+ end
447
+
397
448
  # utils
398
449
  def ensure_rb_extension(filename)
399
450
  filename.end_with?('.rb') ? filename : "#{filename}.rb"
@@ -703,13 +754,38 @@ else
703
754
  # end
704
755
  end
705
756
  threads << Thread.new do
706
- build_for_server(destination, project_name, 9292, false)
757
+ build_for_opal_server(destination, project_name, 9292, false)
707
758
  end
708
759
 
709
760
  threads.each(&:join)
710
761
 
711
762
  end
712
763
 
764
+ if ARGV.include?('wasm_server')
765
+ puts 'building Server'
766
+ build_opal_application(nil, destination, project_name)
767
+ build_host_mode(destination, project_name, 'web-opal')
768
+ threads = []
769
+ # threads << Thread.new do
770
+ # # sleep 1
771
+ # # if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
772
+ # # # code to exec with Windows
773
+ # # `start "" "#{destination}\\#{project_name}\\src\\index_server.html`
774
+ # # elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
775
+ # # # code to exec with MacOS
776
+ # # `open http://localhost:9292`
777
+ # # else
778
+ # # # code to exec with Unix/Linux
779
+ # # `open http://localhost:9292`
780
+ # # end
781
+ # end
782
+ threads << Thread.new do
783
+ build_for_wasm_server(destination, project_name, 9292, false)
784
+ end
785
+ threads.each(&:join)
786
+ puts 'wasm server is running'
787
+ end
788
+
713
789
  if ARGV.include?('server_refresh')
714
790
  puts 're building Server'
715
791
  build_opal_application(nil, destination, project_name)
@@ -7,7 +7,12 @@ new({ particle: :connection }) do |params, bloc|
7
7
  params[:pass] = Black_matter.password
8
8
  params[:atomes] = Universe.atome_list
9
9
  params[:particles] = Universe.particle_list
10
+ # FIXME : html method shouldn't be here
10
11
  html.connect(params, &bloc)
12
+ # test below
13
+ # wait 1 do
14
+ # message({message: 'cd ..;cd server;ls; pwd', action: :terminal })
15
+ # end
11
16
  end
12
17
 
13
18
  new({ particle: :message }) do |params, bloc|
@@ -139,5 +139,5 @@ STR
139
139
  end
140
140
  end
141
141
 
142
- # we init server default address
143
- A.server({ address: 'localhost:9292' , type: 'ws'})
142
+ # we init server default address now initialise in index.html for server
143
+ # A.server({ address: 'localhost:9292' , type: 'ws'})
@@ -10,8 +10,6 @@ class Atome
10
10
  grab(parent).instance_exec(content, &bloc)
11
11
  end
12
12
 
13
-
14
-
15
13
  def controller_sender(message)
16
14
  return if $host == :html
17
15
 
@@ -21,9 +19,6 @@ class Atome
21
19
  JS.eval(js_command)
22
20
  end
23
21
 
24
-
25
-
26
-
27
22
  # def global_monitoring(instance, methods_to_monitor, variables_to_monitor)
28
23
  # methods_to_monitor.each do |methode|
29
24
  # original_method = instance.method(methode)
@@ -55,7 +50,6 @@ class Atome
55
50
 
56
51
  end
57
52
 
58
-
59
53
  def help(particle, &doc)
60
54
  if doc
61
55
  Universe.set_help(particle, &doc)
@@ -74,7 +68,6 @@ class Atome
74
68
  end
75
69
  end
76
70
 
77
-
78
71
  # local server messaging
79
72
  def file_for_opal(parent, bloc)
80
73
  JS.eval("fileForOpal('#{parent}', #{bloc})")
@@ -286,10 +279,10 @@ class Atome
286
279
  end
287
280
 
288
281
  def each_with_index(&proc)
289
- index=0
282
+ index = 0
290
283
  collect.each do |val|
291
- instance_exec(val,index, &proc) if proc.is_a?(Proc)
292
- index+=1
284
+ instance_exec(val, index, &proc) if proc.is_a?(Proc)
285
+ index += 1
293
286
  end
294
287
  end
295
288
 
@@ -341,9 +334,10 @@ class Atome
341
334
  parent_found.delete(true)
342
335
  end
343
336
  end
344
- def server(server_params=nil)
337
+
338
+ def server(server_params = nil)
345
339
  if server_params
346
- @current_server= server_params
340
+ @current_server = server_params
347
341
  else
348
342
  @current_server
349
343
  end
@@ -354,6 +348,9 @@ class Atome
354
348
  connection(server)
355
349
  end
356
350
 
351
+ def init_database # this method is call from JS (atome/communication)
352
+ message({action: :init_db, value: {atome: {}, particles: {}} })
353
+ end
357
354
  end
358
355
 
359
356
 
data/lib/atome/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  # return atome version
4
4
  class Atome
5
- VERSION = '0.5.6.1.1'
5
+ VERSION = '0.5.6.1.4'
6
6
  end
7
7
 
@@ -16,15 +16,20 @@ require 'securerandom'
16
16
  require 'sequel'
17
17
 
18
18
  class EDen
19
- def self.terminal(cmd,option,ws,value, user, pass)
19
+ def self.terminal(cmd, option, ws, value, user, pass)
20
20
  `#{cmd}`
21
21
  end
22
22
 
23
- def self.file(source, operation,ws,value,user, pass)
24
- file_content= File.send(operation, source, value).to_s
23
+ def self.init_db(cmd, option, ws, value, user, pass)
24
+ "the value is : #{value}"
25
+ end
26
+
27
+ def self.file(source, operation, ws, value, user, pass)
28
+ file_content = File.send(operation, source, value).to_s
25
29
  file_content = file_content.gsub("'", "\"")
26
30
  "=> operation: #{operation}, source: #{source} , content : #{file_content},"
27
31
  end
32
+
28
33
  # return_message = EDen.safe_send(action_requested, message,option, current_user, user_pass)
29
34
 
30
35
  def self.safe_send(method_name, *args)
@@ -50,6 +55,8 @@ class String
50
55
  end
51
56
  end
52
57
 
58
+ puts "kjhj"
59
+
53
60
  class Database
54
61
  def self.connect_database
55
62
  if File.exist?("eden.sqlite3")
@@ -235,7 +242,6 @@ class Database
235
242
 
236
243
  end
237
244
 
238
-
239
245
  class App < Roda
240
246
 
241
247
  # comment below when test will be done
@@ -248,7 +254,7 @@ class App < Roda
248
254
  items.insert(creator: 'toi')
249
255
  items.insert(creator: 'vous')
250
256
  puts "Item count: #{items.count}"
251
- test= "Item count: #{items.count}"
257
+ test = "Item count: #{items.count}"
252
258
  # puts "My name is: #{items(:creator)}"
253
259
  index_content = File.read("../src/index_server.html")
254
260
  opts[:root] = '../src'
@@ -259,7 +265,7 @@ class App < Roda
259
265
  ws = Faye::WebSocket.new(r.env)
260
266
  ws.on :open do |event|
261
267
  ws.send('server ready'.to_json)
262
- ws.send('asking for synchro data'.to_json)
268
+ # ws.send('asking for synchro data'.to_json)
263
269
  end
264
270
 
265
271
  ws.on(:message) do |event|
@@ -267,12 +273,12 @@ class App < Roda
267
273
  full_data = JSON.parse(json_string)
268
274
  message = full_data['message']
269
275
  action_requested = full_data['action']
270
- value= full_data['value']
271
- option= full_data['option']
276
+ value = full_data['value']
277
+ option = full_data['option']
272
278
  current_user = full_data['user']
273
279
  user_pass = full_data['pass']['global']
274
280
  if action_requested
275
- return_message = EDen.safe_send(action_requested, message,option,ws,value, current_user, user_pass)
281
+ return_message = EDen.safe_send(action_requested, message, option, ws, value, current_user, user_pass)
276
282
  else
277
283
  return_message = "no action msg: #{test}"
278
284
  end
@@ -79,7 +79,7 @@ class App < Roda
79
79
 
80
80
  puts "The average price is: #{items.avg(:width)}"
81
81
 
82
- index_content = File.read("../src/index_server.html")
82
+ index_content = File.read("../src/index_server_wasm.html")
83
83
 
84
84
  opts[:root] = '../src'
85
85
  plugin :static, %w[/css /js /medias], root: '../src'
@@ -90,7 +90,7 @@ class App < Roda
90
90
 
91
91
  ws.on :open do |event|
92
92
  ws.send('server ready'.to_json)
93
- ws.send('asking for synchro data'.to_json)
93
+ # ws.send('asking for synchro data'.to_json)
94
94
  end
95
95
 
96
96
  ws.on(:message) do |event|
@@ -42,6 +42,7 @@
42
42
  <script>
43
43
  window.addEventListener('load', function () {
44
44
  Opal.eval('atome_infos')
45
+ Opal.eval("A.server({ address: 'localhost:9292' , type: 'ws'})")
45
46
  Opal.eval('A.init_websocket')
46
47
  })
47
48
 
@@ -41,6 +41,7 @@
41
41
  require './index'
42
42
  #puts Universe.host
43
43
  atome_infos
44
+ A.server({ address: 'localhost:9292' , type: 'ws'})
44
45
  A.init_websocket
45
46
  </script>
46
47
  <script defer src="js/atome/specific/wasm.js" type="text/javascript"></script>
@@ -66,6 +66,8 @@ const communication = {
66
66
  this.websocket = new WebSocket(type+'://'+server);
67
67
  this.websocket.onopen = function (event) {
68
68
  rubyVMCallback("puts 'Connected to WebSocket'")
69
+
70
+ Opal.eval('A.init_database');
69
71
  };
70
72
  this.websocket.onmessage = function (event) {
71
73
  rubyVMCallback("puts 'object ruby callback : " + event.data + "'")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6.1.1
4
+ version: 0.5.6.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Eric Godard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-01 00:00:00.000000000 Z
11
+ date: 2024-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: artoo
@@ -371,7 +371,6 @@ files:
371
371
  - CHANGELOG.md
372
372
  - CODE_OF_CONDUCT.md
373
373
  - Gemfile
374
- - Guardfile
375
374
  - LICENSE.txt
376
375
  - README.md
377
376
  - Rakefile
@@ -502,10 +501,6 @@ files:
502
501
  - lib/renderers/server/index.rb
503
502
  - lib/renderers/server/index_relative.rb
504
503
  - lib/renderers/server/utility.rb
505
- - server/atome_server.rb
506
- - server/atome_server_wasm.rb
507
- - server/capture.rb
508
- - server/config.ru
509
504
  - sig/atome.rbs
510
505
  - sig/atome_js.rbs
511
506
  - sig/batch.rbs
@@ -516,32 +511,6 @@ files:
516
511
  - sig/matrix.rbs
517
512
  - sig/object.rbs
518
513
  - sig/universe.rbs
519
- - src-tauri/.gitignore
520
- - src-tauri/Cargo.toml
521
- - src-tauri/build.rs
522
- - src-tauri/icons/128x128.png
523
- - src-tauri/icons/128x128@2x.png
524
- - src-tauri/icons/32x32.png
525
- - src-tauri/icons/Square107x107Logo.png
526
- - src-tauri/icons/Square142x142Logo.png
527
- - src-tauri/icons/Square150x150Logo.png
528
- - src-tauri/icons/Square284x284Logo.png
529
- - src-tauri/icons/Square30x30Logo.png
530
- - src-tauri/icons/Square310x310Logo.png
531
- - src-tauri/icons/Square44x44Logo.png
532
- - src-tauri/icons/Square71x71Logo.png
533
- - src-tauri/icons/Square89x89Logo.png
534
- - src-tauri/icons/StoreLogo.png
535
- - src-tauri/icons/icon.icns
536
- - src-tauri/icons/icon.ico
537
- - src-tauri/icons/icon.png
538
- - src-tauri/src/main.rs
539
- - src-tauri/tauri.conf.json
540
- - src-wasm/wasm/wasi-vfs-osx_arm
541
- - src-wasm/wasm/wasi-vfs-osx_x86
542
- - src-wasm/wasm/wasi-vfs-unix
543
- - src-wasm/wasm/wasi-vfs.exe
544
- - src/css/style.css
545
514
  - src/utilities/host_mode.rb
546
515
  - vendor/assets/Guardfile
547
516
  - vendor/assets/Rakefile
data/Guardfile DELETED
File without changes
@@ -1,293 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # atome server
4
- require 'em/pure_ruby' if RUBY_PLATFORM == 'x64-mingw32'
5
- require 'fileutils'
6
- require '../src/utilities/aui'
7
- require 'digest/sha2'
8
- require 'faye/websocket'
9
- require 'geocoder'
10
- require 'json'
11
- require 'mail'
12
- require 'net/ping'
13
- require 'roda'
14
- require 'rufus-scheduler'
15
- require 'securerandom'
16
- require 'sequel'
17
-
18
- class EDen
19
- def self.terminal(cmd,option,ws,value, user, pass)
20
- `#{cmd}`
21
- end
22
-
23
- def self.file(source, operation,ws,value,user, pass)
24
- file_content= File.send(operation, source, value).to_s
25
- file_content = file_content.gsub("'", "\"")
26
- "=> operation: #{operation}, source: #{source} , content : #{file_content},"
27
- end
28
- # return_message = EDen.safe_send(action_requested, message,option, current_user, user_pass)
29
-
30
- def self.safe_send(method_name, *args)
31
- method_sym = method_name.to_sym
32
- eden_methods = EDen.singleton_methods(false) - Object.singleton_methods
33
- if eden_methods.include?(method_sym)
34
- send(method_sym, *args)
35
- else
36
- "forbidden action: #{method_name}"
37
- end
38
- end
39
- end
40
-
41
- Faye::WebSocket.load_adapter('puma')
42
-
43
- class String
44
- def is_json?
45
- begin
46
- !JSON.parse(self).nil?
47
- rescue
48
- false
49
- end
50
- end
51
- end
52
-
53
- class Database
54
- def self.connect_database
55
- if File.exist?("eden.sqlite3")
56
- eden = Sequel.connect("sqlite://eden.sqlite3")
57
- else
58
- eden = Sequel.connect("sqlite://eden.sqlite3")
59
- eden.create_table :atome do
60
- primary_key :atome_id
61
- String :creator
62
- end
63
-
64
- eden.create_table :communication do
65
- primary_key :communication_id
66
- String :connection
67
- JSON :message
68
- JSON :controller
69
- end
70
-
71
- eden.create_table :effect do
72
- primary_key :effect_id
73
- Int :smooth
74
- Int :blur
75
- end
76
-
77
- eden.create_table :event do
78
- primary_key :event_id
79
- JSON :touch
80
- Boolean :play
81
- Boolean :pause
82
- Int :time
83
- Boolean :on
84
- Boolean :fullscreen
85
- Boolean :mute
86
- Boolean :drag
87
- Boolean :drop
88
- Boolean :over
89
- String :targets
90
- Boolean :start
91
- Boolean :stop
92
- Time :begin
93
- Time :end
94
- Int :duration
95
- Int :mass
96
- Int :damping
97
- Int :stiffness
98
- Int :velocity
99
- Boolean :repeat
100
- Boolean :ease
101
- Boolean :keyboard
102
- Boolean :resize
103
- Boolean :overflow
104
- end
105
-
106
- eden.create_table :geometry do
107
- primary_key :geometry_id
108
- Int :width
109
- Int :height
110
- Int :size
111
- end
112
-
113
- eden.create_table :hierarchy do
114
- primary_key :hierarchy_id
115
- String :attach
116
- String :attached
117
- String :apply
118
- String :affect
119
- String :detached
120
- String :collect
121
- end
122
-
123
- eden.create_table :identity do
124
- primary_key :identity_id
125
- String :real
126
- String :type
127
- Int :id
128
- String :name
129
- Boolean :active
130
- String :markup
131
- String :bundle
132
- String :data
133
- String :category
134
- String :selection
135
- Boolean :selected
136
- String :format
137
- String :alien
138
- end
139
-
140
- eden.create_table :material do
141
- primary_key :material_id
142
- String :component
143
- Boolean :edit
144
- String :style
145
- Boolean :hide
146
- Boolean :remove
147
- JSON :classes
148
- Boolean :remove_classes
149
- Int :opacity
150
- String :definition
151
- Int :gradient
152
- Int :border
153
- end
154
-
155
- eden.create_table :property do
156
- primary_key :property_id
157
- String :red
158
- String :green
159
- String :blue
160
- String :alpha
161
- String :diffusion
162
- Boolean :clean
163
- String :insert
164
- Boolean :remove
165
- Int :sort
166
- end
167
-
168
- eden.create_table :security do
169
- primary_key :security_id
170
- String :password
171
- end
172
-
173
- eden.create_table :spatial do
174
- primary_key :spatial_id
175
- Int :left
176
- Int :right
177
- Int :top
178
- Int :bottom
179
- Int :rotate
180
- String :direction
181
- String :center
182
- Int :depth
183
- Int :position
184
- String :organise
185
- String :spacing
186
- Boolean :display
187
- String :layout
188
- end
189
-
190
- eden.create_table :time do
191
- primary_key :time_id
192
- JSON :markers
193
- end
194
-
195
- eden.create_table :utility do
196
- primary_key :utility_id
197
- String :renderers
198
- String :code
199
- Boolean :run
200
- Boolean :delete
201
- Boolean :clear
202
- String :path
203
- String :schedule
204
- String :read
205
- String :cursor
206
- String :preset
207
- JSON :relations
208
- JSON :tag
209
- String :web
210
- JSON :unit
211
- String :initialize
212
- String :login
213
- String :hypertext
214
- String :hyperedit
215
- String :terminal
216
- String :browse
217
- String :copies
218
- Int :temporary
219
- String :atomes
220
- String :match
221
- Boolean :invert
222
- String :option
223
- String :duplicate
224
- String :copy
225
- String :paste
226
- String :backup
227
- String :import
228
- String :compute
229
- String :get
230
- end
231
-
232
- end
233
- eden
234
- end
235
-
236
- end
237
-
238
-
239
- class App < Roda
240
-
241
- # comment below when test will be done
242
- File.delete("./eden.sqlite3") if File.exist?("./eden.sqlite3")
243
- eden = Database.connect_database
244
- items = eden[:atome]
245
-
246
- # populate the table
247
- items.insert(creator: 'moi')
248
- items.insert(creator: 'toi')
249
- items.insert(creator: 'vous')
250
- puts "Item count: #{items.count}"
251
- test= "Item count: #{items.count}"
252
- # puts "My name is: #{items(:creator)}"
253
- index_content = File.read("../src/index_server.html")
254
- opts[:root] = '../src'
255
- plugin :static, %w[/css /js /medias], root: '../src'
256
- route do |r|
257
- r.root do
258
- if Faye::WebSocket.websocket?(r.env)
259
- ws = Faye::WebSocket.new(r.env)
260
- ws.on :open do |event|
261
- ws.send('server ready'.to_json)
262
- ws.send('asking for synchro data'.to_json)
263
- end
264
-
265
- ws.on(:message) do |event|
266
- json_string = event.data.gsub(/(\w+):/) { "\"#{$1}\":" }.gsub('=>', ':')
267
- full_data = JSON.parse(json_string)
268
- message = full_data['message']
269
- action_requested = full_data['action']
270
- value= full_data['value']
271
- option= full_data['option']
272
- current_user = full_data['user']
273
- user_pass = full_data['pass']['global']
274
- if action_requested
275
- return_message = EDen.safe_send(action_requested, message,option,ws,value, current_user, user_pass)
276
- else
277
- return_message = "no action msg: #{test}"
278
- end
279
- ws.send(return_message.to_json)
280
- end
281
-
282
- ws.on(:close) do |event|
283
- puts "server closed with status #{event.code}"
284
- end
285
- ws.rack_response
286
- end
287
-
288
- index_content
289
- end
290
-
291
- end
292
-
293
- end
@@ -1,112 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # atome server
4
- require 'em/pure_ruby' if RUBY_PLATFORM == 'x64-mingw32'
5
- require '../src/utilities/aui'
6
- require 'digest/sha2'
7
- require 'faye/websocket'
8
- require 'geocoder'
9
- require 'json'
10
- require 'mail'
11
- require 'net/ping'
12
- require 'roda'
13
- require 'rufus-scheduler'
14
- require 'securerandom'
15
- require 'sequel'
16
-
17
- Faye::WebSocket.load_adapter('puma') # Utilisez l'adaptateur 'thin' pour Faye
18
-
19
- class String
20
- def is_json?
21
- begin
22
- !JSON.parse(self).nil?
23
- rescue
24
- false
25
- end
26
- end
27
- end
28
-
29
- class Database
30
- def self.connect_database
31
- if File.exist?("eden.sqlite3")
32
- eden = Sequel.connect("sqlite://eden.sqlite3")
33
- else
34
- eden = Sequel.connect("sqlite://eden.sqlite3")
35
- eden.create_table :atome do
36
- primary_key :atome_id
37
- String :aui
38
- String :id
39
- String :type
40
- String :name
41
- String :content
42
- String :position
43
- String :dimension
44
- String :color
45
- String :right
46
- String :effect
47
- String :shadow
48
- String :border
49
- String :fill
50
- Float :x
51
- Float :xx
52
- Float :y
53
- Float :yy
54
- Float :z
55
- Float :zz
56
- Float :width
57
- Float :height
58
- Float :depth
59
- end
60
-
61
- end
62
- eden
63
- end
64
-
65
- end
66
-
67
- class App < Roda
68
- # comment below when test will be done
69
- File.delete("./eden.sqlite3") if File.exist?("./eden.sqlite3")
70
- eden = Database.connect_database
71
- items = eden[:atome]
72
-
73
- # populate the table
74
- items.insert(name: 'abc', width: rand * 100)
75
- items.insert(name: 'def', width: rand * 100)
76
- items.insert(name: 'ghi', width: rand * 100)
77
-
78
- puts "Item count: #{items.count}"
79
-
80
- puts "The average price is: #{items.avg(:width)}"
81
-
82
- index_content = File.read("../src/index_server.html")
83
-
84
- opts[:root] = '../src'
85
- plugin :static, %w[/css /js /medias], root: '../src'
86
- route do |r|
87
- r.root do
88
- if Faye::WebSocket.websocket?(r.env)
89
- ws = Faye::WebSocket.new(r.env)
90
-
91
- ws.on :open do |event|
92
- ws.send('server ready'.to_json)
93
- ws.send('asking for synchro data'.to_json)
94
- end
95
-
96
- ws.on(:message) do |event|
97
- #TODO : encode event on both client and server
98
- ws.send(event.data.reverse.to_json) # Envoie le message inversé au client
99
- end
100
-
101
- ws.on(:close) do |event|
102
- puts "server closed with status #{event.code}"
103
- end
104
- ws.rack_response
105
- end
106
-
107
- index_content
108
- end
109
-
110
- end
111
-
112
- end
data/server/capture.rb DELETED
@@ -1,10 +0,0 @@
1
- path = ARGV[0]
2
- name = ARGV[1]
3
-
4
- File.open("#{path}#{name}.txt", 'w') do |f|
5
- f.write("Le chemin ; #{path}!\n")
6
- f.write("Le nom du fichier #{name}\n")
7
- end
8
-
9
- # `gphoto2 --capture-image-and-download --filename "../src/medias/images/photos/verif.jpg"`
10
- `gphoto2 --capture-image-and-download --filename "#{path}#{name}.jpg"`
data/server/config.ru DELETED
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'roda'
4
- require 'rack/unreloader'
5
-
6
- # Unreloader = Rack::Unreloader.new(subclasses: %w[Roda]) { App }
7
- # Unreloader.require './atome_server.rb'
8
- # run Unreloader
9
- # uncomment to allow code reloading
10
- # uncomment below for prod or comment to allow code reloading
11
- require './atome_server.rb'
12
- run App.app.freeze
13
-
data/src/css/style.css DELETED
@@ -1,162 +0,0 @@
1
- * {
2
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
3
- }
4
-
5
- html, body {
6
-
7
- font-family: system-ui, -apple-system, -apple-system-font, 'Segoe UI', 'Roboto', sans-serif;
8
- font-size: 12px;
9
- margin: 0;
10
- padding: 0;
11
- background: rgba(39, 39, 39, 1);
12
- overflow: hidden;
13
- -webkit-overflow-scrolling: touch;
14
- width: 100%;
15
- height: 100%;
16
- z-index: 0;
17
- color: lightgray;
18
- }
19
- pre {
20
- min-width: 100px;
21
- margin: 0;
22
- padding: 0;
23
- }
24
-
25
-
26
- .matrix{
27
- background-color: blue;
28
- border-radius: 9px;
29
- display: grid;
30
- grid-template-columns: repeat(4, 1fr);
31
- flex-direction: column;
32
- gap: 12px;
33
- padding: 3px;
34
- }
35
- /*.matrix_element{*/
36
- /* background-color: rebeccapurple;*/
37
- /* width: 100%;*/
38
- /* height: 29px;*/
39
- /* border-radius: 59px;*/
40
- /* display: flex;*/
41
- /* justify-content: center;*/
42
- /* align-items: center;*/
43
- /* flex-direction: column;*/
44
- /* margin-bottom: 20px;*/
45
- /* padding: 0px*/
46
- /*}*/
47
-
48
- #view {
49
- left: 0px;
50
- font-size: 25px;
51
- right: 0px;
52
- top: 0px;
53
- bottom: 0px;
54
- width: auto;
55
- /*display: block;*/
56
- height: auto;
57
- overflow: hidden;
58
- position: absolute;
59
- -webkit-overflow-scrolling: touch;
60
- }
61
-
62
-
63
- .ui-selected {
64
- border: #00bb00 solid 3px;
65
- }
66
-
67
- .ui-selecting {
68
- border: orange solid 3px;
69
- }
70
-
71
- .selected {
72
- outline: 2px dashed white;
73
- background-color: #00bb00;
74
- }
75
-
76
- .atome {
77
- will-change: transform;
78
- cursor: default;
79
- pointer-events: auto;
80
- caret-color: white;
81
- outline: none;
82
- -webkit-user-select: none;
83
- -moz-user-select: none;
84
- user-select: none;
85
- position: absolute;
86
- display: inline-block;
87
- background-size: 100%;
88
- background-repeat: no-repeat;
89
- -webkit-overflow-scrolling: touch;
90
- -webkit-user-drag: none;
91
- caret-shape: bar;
92
- overflow: visible;
93
- }
94
-
95
- .text {
96
- /*-webkit-text-fill-color: transparent;*/
97
- /*-webkit-background-clip: text;*/
98
- word-wrap: break-word;
99
- white-space: pre-wrap;
100
- position: relative;
101
- }
102
-
103
- .center {
104
- display: flex;
105
- justify-content: center;
106
- align-items: center;
107
- position: absolute;
108
- transform: translate(-50%, -50%);
109
- }
110
-
111
- .center_vertical {
112
- display: flex;
113
- align-items: center;
114
- position: absolute;
115
- transform: translateY(-50%);
116
- }
117
-
118
- .center_horizontal{
119
- display: flex;
120
- justify-content: center;
121
- position: absolute;
122
- transform: translateX(-50%);
123
- }
124
-
125
- .e_align_h_left {
126
- text-align: left;
127
- }
128
-
129
- .e_align_h_right {
130
- text-align: right;
131
- }
132
-
133
- .e_align_h_center {
134
- text-align: center;
135
- }
136
-
137
- .el_align_h {
138
- text-align: justify;
139
- }
140
-
141
- .el_align_v {
142
- display: flex;
143
- align-items: center;
144
- }
145
-
146
-
147
- .el_align_v_bottom {
148
- display: flex;
149
- align-items: flex-end;
150
- }
151
-
152
- /*::selection {*/
153
- /* color: transparent;*/
154
- /* background: none;*/
155
- /*}*/
156
- /*!* For Mozilla Firefox *!*/
157
- /*::-moz-selection {*/
158
- /* color: transparent;*/
159
- /* background: none;*/
160
- /*}*/
161
-
162
-
data/src-tauri/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- # Generated by Cargo
2
- # will have compiled files and executables
3
- /target/
4
-
data/src-tauri/Cargo.toml DELETED
@@ -1,27 +0,0 @@
1
- [package]
2
- name = "atome"
3
- version = "0.0.0"
4
- description = "A Tauri App"
5
- authors = ["you"]
6
- license = ""
7
- repository = ""
8
- edition = "2021"
9
- rust-version = "1.57"
10
-
11
- # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
12
-
13
- [build-dependencies]
14
- tauri-build = {version = "1.2", features = [] }
15
-
16
- [dependencies]
17
- serde_json = "1.0"
18
- serde = { version = "1.0", features = ["derive"] }
19
- tauri = {version = "1.5", features = ["api-all"] }
20
-
21
- [features]
22
- # by default Tauri runs in production mode
23
- # when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
24
- default = [ "custom-protocol" ]
25
- # this feature is used used for production builds where `devPath` points to the filesystem
26
- # DO NOT remove this
27
- custom-protocol = [ "tauri/custom-protocol" ]
data/src-tauri/build.rs DELETED
@@ -1,3 +0,0 @@
1
- fn main() {
2
- tauri_build::build()
3
- }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,71 +0,0 @@
1
- use std::process::Command;
2
- use std::str;
3
- use std::fs;
4
-
5
- // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
6
- #[tauri::command]
7
- fn greet(name: &str) -> String {
8
- format!("Hello, {}! You've been greeted from Rust!", name)
9
- }
10
-
11
- #[tauri::command]
12
- fn execute_command(command: &str) -> Result<String, String> {
13
- match Command::new("sh")
14
- .arg("-c")
15
- .arg(command)
16
- .output()
17
- {
18
- Ok(output) => {
19
- if output.status.success() {
20
- Ok(str::from_utf8(&output.stdout).unwrap().to_string())
21
- } else {
22
- Err(str::from_utf8(&output.stderr).unwrap().to_string())
23
- }
24
- }
25
- Err(error) => Err(error.to_string()),
26
- }
27
- }
28
-
29
- #[tauri::command]
30
- fn read_file(file_path: &str) -> Result<String, String> {
31
- let content = match fs::read_to_string(file_path) {
32
- Ok(content) => content,
33
- Err(_) => return Err("Failed to read file.".to_string()),
34
- };
35
- Ok(content)
36
- }
37
-
38
- #[tauri::command]
39
- fn write_file(file_path: &str, content: &str) -> Result<(), String> {
40
- let path = std::path::Path::new(file_path);
41
- match fs::write(path, content) {
42
- Ok(_) => Ok(()),
43
- Err(_) => Err("Failed to write to the file.".to_string()),
44
- }
45
- }
46
-
47
- // Nouvelle commande pour lister le contenu du répertoire
48
- #[tauri::command]
49
- fn list_directory_content(directory_path: String) -> Result<Vec<String>, String> {
50
- let path = std::path::Path::new(&directory_path);
51
- match fs::read_dir(path) {
52
- Ok(entries) => {
53
- let entries: Vec<String> = entries
54
- .filter_map(|entry| {
55
- entry.ok().and_then(|e| {
56
- e.path().file_name().and_then(std::ffi::OsStr::to_str).map(|s| s.to_owned())
57
- })
58
- })
59
- .collect();
60
- Ok(entries)
61
- }
62
- Err(_) => Err("Failed to read directory.".to_string()),
63
- }
64
- }
65
-
66
- fn main() {
67
- tauri::Builder::default()
68
- .invoke_handler(tauri::generate_handler![greet, execute_command, read_file, write_file, list_directory_content])
69
- .run(tauri::generate_context!())
70
- .expect("error while running tauri application");
71
- }
@@ -1,70 +0,0 @@
1
- {
2
- "build": {
3
- "beforeDevCommand": "",
4
- "beforeBuildCommand": "",
5
- "devPath": "../src",
6
- "distDir": "../src",
7
- "withGlobalTauri": true
8
- },
9
- "package": {
10
- "productName": "atome",
11
- "version": "0.0.0"
12
- },
13
- "tauri": {
14
- "allowlist": {
15
- "all": true,
16
- "shell": {
17
- "all": true,
18
- "open": true
19
- }
20
- },
21
- "bundle": {
22
- "active": true,
23
- "category": "DeveloperTool",
24
- "copyright": "",
25
- "deb": {
26
- "depends": []
27
- },
28
- "externalBin": [],
29
- "icon": [
30
- "icons/32x32.png",
31
- "icons/128x128.png",
32
- "icons/128x128@2x.png",
33
- "icons/icon.icns",
34
- "icons/icon.ico"
35
- ],
36
- "identifier": "com.atome.dev",
37
- "longDescription": "",
38
- "macOS": {
39
- "entitlements": null,
40
- "exceptionDomain": "",
41
- "frameworks": [],
42
- "providerShortName": null,
43
- "signingIdentity": null
44
- },
45
- "resources": [],
46
- "shortDescription": "",
47
- "targets": "all",
48
- "windows": {
49
- "certificateThumbprint": null,
50
- "digestAlgorithm": "sha256",
51
- "timestampUrl": ""
52
- }
53
- },
54
- "security": {
55
- "csp": null
56
- },
57
- "updater": {
58
- "active": false
59
- },
60
- "windows": [
61
- {
62
- "fullscreen": false,
63
- "height": 600,
64
- "resizable": true,
65
- "title": "atome",
66
- "width": 800
67
- }
68
- ]
69
- }
70
- }
Binary file
Binary file
Binary file
Binary file