procon_bypass_man 0.1.13 → 0.1.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +33 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +26 -6
- data/README.md +27 -3
- data/docs/setup_raspi.md +2 -0
- data/docs/setup_raspi.mitamae.rb +7 -8
- data/docs/setup_raspi_by_mitamae.md +37 -1
- data/lib/ext/em_pure_ruby.rb +25 -0
- data/lib/procon_bypass_man/background/jobs/base_job.rb +1 -6
- data/lib/procon_bypass_man/background/jobs/concerns/has_external_api_setting.rb +5 -0
- data/lib/procon_bypass_man/background/jobs/concerns/has_internal_api_setting.rb +5 -0
- data/lib/procon_bypass_man/background/{job_runnable.rb → jobs/concerns/job_runnable.rb} +0 -0
- data/lib/procon_bypass_man/background/jobs/report_boot_job.rb +5 -3
- data/lib/procon_bypass_man/background/jobs/report_error_job.rb +6 -5
- data/lib/procon_bypass_man/background/jobs/report_event_base_job.rb +5 -0
- data/lib/procon_bypass_man/background/jobs/report_load_config_job.rb +5 -4
- data/lib/procon_bypass_man/background/jobs/report_pressed_buttons_job.rb +7 -10
- data/lib/procon_bypass_man/background/jobs/report_reload_config_job.rb +5 -4
- data/lib/procon_bypass_man/background/jobs/sync_device_stats_job.rb +16 -0
- data/lib/procon_bypass_man/background.rb +5 -4
- data/lib/procon_bypass_man/buttons_setting_configuration/layer.rb +2 -6
- data/lib/procon_bypass_man/bypass/usb_hid_logger.rb +6 -8
- data/lib/procon_bypass_man/bypass.rb +13 -6
- data/lib/procon_bypass_man/commands/connect_device_command.rb +6 -1
- data/lib/procon_bypass_man/commands/print_boot_message_command.rb +50 -1
- data/lib/procon_bypass_man/commands/print_message_command.rb +8 -0
- data/lib/procon_bypass_man/commands/run_remote_pbm_action_dispatch_command.rb +21 -0
- data/lib/procon_bypass_man/commands/send_error_command.rb +1 -1
- data/lib/procon_bypass_man/commands/send_reload_config_event_command.rb +1 -2
- data/lib/procon_bypass_man/commands/write_session_id_command.rb +1 -7
- data/lib/procon_bypass_man/commands.rb +2 -0
- data/lib/procon_bypass_man/configuration.rb +49 -2
- data/lib/procon_bypass_man/device_connector.rb +2 -1
- data/lib/procon_bypass_man/device_status.rb +44 -0
- data/lib/procon_bypass_man/domains/binary/base.rb +11 -0
- data/lib/procon_bypass_man/domains/binary/has_immutable_binary.rb +5 -0
- data/lib/procon_bypass_man/domains/binary/has_mutable_binary.rb +5 -0
- data/lib/procon_bypass_man/domains/binary/inbound_procon_binary.rb +23 -0
- data/lib/procon_bypass_man/domains/binary/processing_procon_binary.rb +80 -0
- data/lib/procon_bypass_man/domains.rb +11 -0
- data/lib/procon_bypass_man/plugin/splatoon2/macro/fast_return.rb +17 -0
- data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb +17 -0
- data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_right_key.rb +17 -0
- data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_up_key.rb +17 -0
- data/lib/procon_bypass_man/plugin/splatoon2/mode/guruguru.rb +59 -0
- data/lib/procon_bypass_man/plugin/splatoon2/version.rb +9 -0
- data/lib/procon_bypass_man/plugins.rb +11 -0
- data/lib/procon_bypass_man/processor.rb +4 -5
- data/lib/procon_bypass_man/procon/button.rb +11 -0
- data/lib/procon_bypass_man/procon/button_collection.rb +2 -12
- data/lib/procon_bypass_man/procon/layer_changer.rb +3 -2
- data/lib/procon_bypass_man/procon/press_button_aware.rb +5 -4
- data/lib/procon_bypass_man/procon/user_operation.rb +46 -63
- data/lib/procon_bypass_man/procon/{analog_stick.rb → value_objects/analog_stick.rb} +3 -4
- data/lib/procon_bypass_man/procon/value_objects/procon_reader.rb +34 -0
- data/lib/procon_bypass_man/procon.rb +16 -14
- data/lib/procon_bypass_man/remote_pbm_action/base_action.rb +53 -0
- data/lib/procon_bypass_man/remote_pbm_action/change_pbm_version_action.rb +25 -0
- data/lib/procon_bypass_man/remote_pbm_action/commands/update_remote_pbm_action_status_command.rb +24 -0
- data/lib/procon_bypass_man/remote_pbm_action/reboot_os_action.rb +21 -0
- data/lib/procon_bypass_man/remote_pbm_action/restore_pbm_setting.rb +28 -0
- data/lib/procon_bypass_man/remote_pbm_action/stop_pbm_action.rb +21 -0
- data/lib/procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object.rb +38 -0
- data/lib/procon_bypass_man/remote_pbm_action.rb +32 -0
- data/lib/procon_bypass_man/runner.rb +4 -4
- data/lib/procon_bypass_man/scheduler.rb +85 -0
- data/lib/procon_bypass_man/support/http_client.rb +102 -0
- data/lib/procon_bypass_man/support/report_http_client.rb +19 -0
- data/lib/procon_bypass_man/support/send_device_stats_http_client.rb +9 -0
- data/lib/procon_bypass_man/{background/has_server_pool.rb → support/server_pool.rb} +3 -15
- data/lib/procon_bypass_man/support/update_remote_pbm_action_status_http_client.rb +9 -0
- data/lib/procon_bypass_man/version.rb +1 -1
- data/lib/procon_bypass_man/websocket/pbm_job_client.rb +79 -0
- data/lib/procon_bypass_man.rb +60 -31
- data/procon_bypass_man.gemspec +3 -1
- data/project_template/README.md +10 -5
- data/project_template/app.rb +1 -1
- data/project_template/setting.yml +8 -8
- data/sig/main.rbs +16 -1
- metadata +90 -21
- data/lib/procon_bypass_man/background/http_client.rb +0 -67
- data/lib/procon_bypass_man/background/jobs/report_heartbeat_job.rb +0 -10
- data/lib/procon_bypass_man/boot_message.rb +0 -44
- data/lib/procon_bypass_man/procon_reader.rb +0 -31
- data/lib/procon_bypass_man/splatoon2/macro/fast_return.rb +0 -15
- data/lib/procon_bypass_man/splatoon2/macro/jump_to_left_key.rb +0 -15
- data/lib/procon_bypass_man/splatoon2/macro/jump_to_right_key.rb +0 -15
- data/lib/procon_bypass_man/splatoon2/macro/jump_to_up_key.rb +0 -15
- data/lib/procon_bypass_man/splatoon2/mode/guruguru.rb +0 -57
- data/lib/procon_bypass_man/splatoon2/version.rb +0 -7
- data/lib/procon_bypass_man/splatoon2.rb +0 -11
@@ -0,0 +1,102 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
class HttpClient
|
3
|
+
class HttpRequest
|
4
|
+
class Get
|
5
|
+
def self.request!(uri: )
|
6
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
7
|
+
http.use_ssl = uri.scheme === "https"
|
8
|
+
http.get(uri.path, { "Content-Type" => "application/json" })
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Post
|
13
|
+
def self.request!(uri: , request_body: {})
|
14
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
15
|
+
http.use_ssl = uri.scheme === "https"
|
16
|
+
http.post(uri.path, request_body.to_json, { "Content-Type" => "application/json" })
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Put
|
21
|
+
def self.request!(uri: , request_body: {})
|
22
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
23
|
+
http.use_ssl = uri.scheme === "https"
|
24
|
+
http.put(uri.path, request_body.to_json, { "Content-Type" => "application/json" })
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize(path: , server_pool: , retry_on_connection_error: false)
|
30
|
+
@server_pool = server_pool
|
31
|
+
@uri = URI.parse("#{server_pool.server}#{path}")
|
32
|
+
@retry_on_connection_error = retry_on_connection_error
|
33
|
+
end
|
34
|
+
|
35
|
+
def get
|
36
|
+
handle_request do
|
37
|
+
response = HttpRequest::Get.request!(
|
38
|
+
uri: @uri,
|
39
|
+
)
|
40
|
+
break process_response(response)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def post(request_body: )
|
45
|
+
handle_request do
|
46
|
+
body = {}.merge!(request_body)
|
47
|
+
response = HttpRequest::Post.request!(
|
48
|
+
uri: @uri,
|
49
|
+
request_body: body,
|
50
|
+
)
|
51
|
+
break process_response(response)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def put(request_body: )
|
56
|
+
handle_request do
|
57
|
+
body = {
|
58
|
+
hostname: `hostname`.chomp,
|
59
|
+
}.merge!(request_body)
|
60
|
+
response = HttpRequest::Put.request!(
|
61
|
+
uri: @uri,
|
62
|
+
request_body: body,
|
63
|
+
)
|
64
|
+
break process_response(response)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def process_response(response)
|
71
|
+
case response.code
|
72
|
+
when /^200/
|
73
|
+
begin
|
74
|
+
return JSON.parse(response.body)
|
75
|
+
rescue JSON::ParserError
|
76
|
+
return response.body
|
77
|
+
end
|
78
|
+
else
|
79
|
+
@server_pool.next!
|
80
|
+
ProconBypassMan.logger.error("#{@uri}から200以外(#{response.code})が帰ってきました. #{response.body}")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def handle_request
|
85
|
+
raise "need block" unless block_given?
|
86
|
+
if @server_pool.server.nil?
|
87
|
+
ProconBypassMan.logger.info('送信先が未設定なのでスキップしました')
|
88
|
+
return
|
89
|
+
end
|
90
|
+
return yield
|
91
|
+
rescue SocketError => e
|
92
|
+
ProconBypassMan.logger.error(e)
|
93
|
+
if @retry_on_connection_error
|
94
|
+
sleep(10)
|
95
|
+
retry
|
96
|
+
end
|
97
|
+
rescue => e
|
98
|
+
puts e
|
99
|
+
ProconBypassMan.logger.error(e)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
class ReportHttpClient < HttpClient
|
3
|
+
def post(body: , event_type: )
|
4
|
+
if body.is_a?(Hash)
|
5
|
+
b = body
|
6
|
+
else
|
7
|
+
b = { text: body }
|
8
|
+
end
|
9
|
+
|
10
|
+
super(request_body: {
|
11
|
+
session_id: ProconBypassMan.session_id,
|
12
|
+
device_id: ProconBypassMan.device_id,
|
13
|
+
hostname: `hostname`.chomp,
|
14
|
+
event_type: event_type,
|
15
|
+
body: b,
|
16
|
+
})
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module ProconBypassMan
|
1
|
+
module ProconBypassMan
|
2
2
|
class ServerPool
|
3
3
|
def initialize(servers: )
|
4
4
|
if servers.nil? || servers.empty?
|
@@ -29,6 +29,8 @@ module ProconBypassMan::Background::HasServerPool
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
private
|
33
|
+
|
32
34
|
def reset
|
33
35
|
@index = 0
|
34
36
|
end
|
@@ -37,18 +39,4 @@ module ProconBypassMan::Background::HasServerPool
|
|
37
39
|
@index = @index + 1
|
38
40
|
end
|
39
41
|
end
|
40
|
-
|
41
|
-
def reset_server_pool!
|
42
|
-
@pool_server = nil
|
43
|
-
end
|
44
|
-
|
45
|
-
def pool_server
|
46
|
-
@pool_server ||= ServerPool.new(
|
47
|
-
servers: servers
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
def servers
|
52
|
-
raise NotImplementedError, nil
|
53
|
-
end
|
54
42
|
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
module Websocket
|
3
|
+
module PbmJobClient
|
4
|
+
CHANNEL = 'PbmJobChannel'
|
5
|
+
|
6
|
+
def self.start!
|
7
|
+
return unless ProconBypassMan.config.enable_ws?
|
8
|
+
|
9
|
+
Thread.start do
|
10
|
+
loop do
|
11
|
+
run
|
12
|
+
rescue
|
13
|
+
retry
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.run
|
19
|
+
EventMachine.run do
|
20
|
+
client = ActionCableClient.new(
|
21
|
+
ProconBypassMan.config.current_ws_server_url, {
|
22
|
+
channel: CHANNEL, device_id: ProconBypassMan.device_id,
|
23
|
+
}
|
24
|
+
)
|
25
|
+
|
26
|
+
client.connected {
|
27
|
+
ProconBypassMan.logger.info('successfully connected in ProconBypassMan::Websocket::PbmJobClient')
|
28
|
+
}
|
29
|
+
client.subscribed { |msg|
|
30
|
+
puts({ event: :subscribed, msg: msg })
|
31
|
+
ProconBypassMan::SyncDeviceStatsJob.perform(ProconBypassMan::DeviceStatus.current)
|
32
|
+
}
|
33
|
+
|
34
|
+
client.received do |data|
|
35
|
+
validate_and_run(data: data)
|
36
|
+
rescue => e
|
37
|
+
ProconBypassMan::SendErrorCommand.execute(error: e)
|
38
|
+
end
|
39
|
+
|
40
|
+
client.disconnected {
|
41
|
+
puts :disconnected
|
42
|
+
client.reconnect!
|
43
|
+
sleep 2
|
44
|
+
}
|
45
|
+
client.errored { |msg| puts :errored; puts msg }
|
46
|
+
client.pinged { |msg|
|
47
|
+
ProconBypassMan.cache.fetch key: 'ws_pinged', expires_in: 10 do
|
48
|
+
ProconBypassMan.logger.info(msg)
|
49
|
+
end
|
50
|
+
}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# @raise [ProconBypassMan::RemotePbmActionObject::ValidationError]
|
55
|
+
# @param [Hash] data
|
56
|
+
# @return [Void]
|
57
|
+
def self.validate_and_run(data: )
|
58
|
+
ProconBypassMan.logger.debug { data }
|
59
|
+
pbm_job_hash = data.dig("message")
|
60
|
+
begin
|
61
|
+
pbm_job_object = ProconBypassMan::RemotePbmActionObject.new(action: pbm_job_hash["action"],
|
62
|
+
status: pbm_job_hash["status"],
|
63
|
+
uuid: pbm_job_hash["uuid"],
|
64
|
+
created_at: pbm_job_hash["created_at"],
|
65
|
+
job_args: pbm_job_hash["args"])
|
66
|
+
pbm_job_object.validate!
|
67
|
+
rescue ProconBypassMan::RemotePbmActionObject::ValidationError => e
|
68
|
+
raise
|
69
|
+
end
|
70
|
+
|
71
|
+
ProconBypassMan::RunRemotePbmActionDispatchCommand.execute(
|
72
|
+
action: pbm_job_object.action,
|
73
|
+
uuid: pbm_job_object.uuid,
|
74
|
+
job_args: pbm_job_object.job_args
|
75
|
+
)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/lib/procon_bypass_man.rb
CHANGED
@@ -4,27 +4,42 @@ require "json"
|
|
4
4
|
require "net/http"
|
5
5
|
require "fileutils"
|
6
6
|
require "securerandom"
|
7
|
+
require 'em/pure_ruby'
|
8
|
+
require "action_cable_client"
|
9
|
+
require "ext/em_pure_ruby"
|
7
10
|
|
8
11
|
require_relative "procon_bypass_man/version"
|
12
|
+
require_relative "procon_bypass_man/remote_pbm_action"
|
9
13
|
require_relative "procon_bypass_man/support/signal_handler"
|
10
14
|
require_relative "procon_bypass_man/support/callbacks"
|
11
15
|
require_relative "procon_bypass_man/support/safe_timeout"
|
12
16
|
require_relative "procon_bypass_man/support/compress_array"
|
13
17
|
require_relative "procon_bypass_man/support/uptime"
|
14
18
|
require_relative "procon_bypass_man/support/on_memory_cache"
|
19
|
+
require_relative "procon_bypass_man/support/http_client"
|
20
|
+
require_relative "procon_bypass_man/support/report_http_client"
|
21
|
+
require_relative "procon_bypass_man/support/update_remote_pbm_action_status_http_client"
|
22
|
+
require_relative "procon_bypass_man/support/send_device_stats_http_client"
|
23
|
+
require_relative "procon_bypass_man/support/server_pool"
|
15
24
|
require_relative "procon_bypass_man/background"
|
16
25
|
require_relative "procon_bypass_man/commands"
|
17
26
|
require_relative "procon_bypass_man/bypass"
|
27
|
+
require_relative "procon_bypass_man/domains"
|
18
28
|
require_relative "procon_bypass_man/device_connector"
|
29
|
+
require_relative "procon_bypass_man/device_status"
|
19
30
|
require_relative "procon_bypass_man/runner"
|
20
31
|
require_relative "procon_bypass_man/processor"
|
21
32
|
require_relative "procon_bypass_man/configuration"
|
22
33
|
require_relative "procon_bypass_man/buttons_setting_configuration"
|
23
34
|
require_relative "procon_bypass_man/procon"
|
24
|
-
require_relative "procon_bypass_man/
|
25
|
-
require_relative "procon_bypass_man/procon/analog_stick"
|
35
|
+
require_relative "procon_bypass_man/procon/button"
|
36
|
+
require_relative "procon_bypass_man/procon/value_objects/analog_stick"
|
37
|
+
require_relative "procon_bypass_man/procon/value_objects/procon_reader"
|
26
38
|
require_relative "procon_bypass_man/procon/analog_stick_cap"
|
27
|
-
require_relative "procon_bypass_man/
|
39
|
+
require_relative "procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object"
|
40
|
+
require_relative "procon_bypass_man/scheduler"
|
41
|
+
require_relative "procon_bypass_man/plugins"
|
42
|
+
require_relative "procon_bypass_man/websocket/pbm_job_client"
|
28
43
|
|
29
44
|
STDOUT.sync = true
|
30
45
|
Thread.abort_on_exception = true
|
@@ -33,44 +48,46 @@ module ProconBypassMan
|
|
33
48
|
extend ProconBypassMan::Configuration::ClassMethods
|
34
49
|
|
35
50
|
class CouldNotLoadConfigError < StandardError; end
|
36
|
-
class
|
37
|
-
class
|
38
|
-
|
39
|
-
|
40
|
-
unless setting_path
|
41
|
-
logger.warn "setting_pathが未設定です。設定ファイルのライブリロードが使えません。"
|
42
|
-
end
|
43
|
-
|
44
|
-
if block_given?
|
45
|
-
ProconBypassMan::ButtonsSettingConfiguration.instance.instance_eval(&block)
|
46
|
-
else
|
47
|
-
ProconBypassMan::ButtonsSettingConfiguration::Loader.load(setting_path: setting_path)
|
48
|
-
end
|
49
|
-
end
|
51
|
+
class NotFoundProconError < StandardError; end
|
52
|
+
class ConnectionError < StandardError; end
|
53
|
+
class FirstConnectionError < ConnectionError; end
|
54
|
+
class EternalConnectionError < ConnectionError; end
|
50
55
|
|
51
56
|
# @return [void]
|
52
|
-
def self.run(setting_path: nil
|
53
|
-
ProconBypassMan.
|
54
|
-
puts "PBMを起動しています"
|
55
|
-
buttons_setting_configure(setting_path: setting_path, &block)
|
56
|
-
initialize_pbm
|
57
|
-
File.write(pid_path, $$)
|
58
|
-
ProconBypassMan::WriteSessionIdCommand.execute
|
57
|
+
def self.run(setting_path: nil)
|
58
|
+
ProconBypassMan::Scheduler.start!
|
59
59
|
ProconBypassMan::Background::JobRunner.start!
|
60
|
+
ProconBypassMan::Websocket::PbmJobClient.start!
|
61
|
+
|
62
|
+
ProconBypassMan::PrintMessageCommand.execute(text: "PBMを起動しています")
|
63
|
+
ProconBypassMan::ButtonsSettingConfiguration::Loader.load(setting_path: setting_path)
|
64
|
+
initialize_pbm
|
60
65
|
gadget, procon = ProconBypassMan::ConnectDeviceCommand.execute!
|
61
66
|
Runner.new(gadget: gadget, procon: procon).run
|
62
|
-
rescue CouldNotLoadConfigError
|
67
|
+
rescue ProconBypassMan::CouldNotLoadConfigError
|
63
68
|
ProconBypassMan::SendErrorCommand.execute(error: "設定ファイルが不正です。設定ファイルの読み込みに失敗しました")
|
69
|
+
ProconBypassMan::DeviceStatus.change_to_setting_syntax_error_and_shutdown!
|
64
70
|
FileUtils.rm_rf(ProconBypassMan.pid_path)
|
65
71
|
FileUtils.rm_rf(ProconBypassMan.digest_path)
|
66
72
|
exit 1
|
67
|
-
rescue
|
68
|
-
ProconBypassMan::SendErrorCommand.execute(error: "
|
73
|
+
rescue ProconBypassMan::NotFoundProconError
|
74
|
+
ProconBypassMan::SendErrorCommand.execute(error: "プロコンが見つかりませんでした。終了します。")
|
75
|
+
ProconBypassMan::DeviceStatus.change_to_procon_not_found_error!
|
69
76
|
FileUtils.rm_rf(ProconBypassMan.pid_path)
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
77
|
+
FileUtils.rm_rf(ProconBypassMan.digest_path)
|
78
|
+
exit 1
|
79
|
+
rescue ProconBypassMan::ConnectionError
|
80
|
+
begin
|
81
|
+
raise
|
82
|
+
rescue ProconBypassMan::EternalConnectionError
|
83
|
+
ProconBypassMan::SendErrorCommand.execute(error: "接続の見込みがないのでsleepしまくります")
|
84
|
+
ProconBypassMan::DeviceStatus.change_to_connected_but_sleeping!
|
85
|
+
FileUtils.rm_rf(ProconBypassMan.pid_path)
|
86
|
+
eternal_sleep
|
87
|
+
rescue ProconBypassMan::FirstConnectionError
|
88
|
+
ProconBypassMan::SendErrorCommand.execute(error: "接続を確立できませんでした。やりなおします。")
|
89
|
+
retry
|
90
|
+
end
|
74
91
|
end
|
75
92
|
|
76
93
|
def self.configure(&block)
|
@@ -95,5 +112,17 @@ module ProconBypassMan
|
|
95
112
|
|
96
113
|
def self.initialize_pbm
|
97
114
|
ProconBypassMan::WriteDeviceIdCommand.execute
|
115
|
+
ProconBypassMan::WriteSessionIdCommand.execute
|
116
|
+
File.write(pid_path, $$)
|
117
|
+
ProconBypassMan::DeviceStatus.change_to_running!
|
118
|
+
end
|
119
|
+
|
120
|
+
def self.eternal_sleep
|
121
|
+
sleep(999999999)
|
122
|
+
end
|
123
|
+
|
124
|
+
# @return [Void]
|
125
|
+
def self.hot_reload!
|
126
|
+
Process.kill(:USR2, pid)
|
98
127
|
end
|
99
128
|
end
|
data/procon_bypass_man.gemspec
CHANGED
@@ -28,7 +28,9 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
30
|
# Uncomment to register a new dependency of your gem
|
31
|
-
|
31
|
+
spec.add_dependency "pbmenv"
|
32
|
+
spec.add_dependency "action_cable_client"
|
33
|
+
spec.add_dependency "sorted_set"
|
32
34
|
|
33
35
|
# For more information and examples about making a new gem, checkout our
|
34
36
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/project_template/README.md
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
# Project Template
|
2
|
-
これらは https://github.com/splaplapla/pbmenv がinstallするときに配備するファイルです
|
2
|
+
* これらは https://github.com/splaplapla/pbmenv がinstallするときに配備するファイルです
|
3
|
+
* pbm_webはオプショナルです
|
3
4
|
|
4
5
|
## systemdを使ってサービスに登録する方法
|
5
|
-
|
6
|
-
|
7
|
-
*
|
8
|
-
* sudo systemctl
|
6
|
+
systemctl enableした後は、次回のOS起動時にserviceも自動起動します
|
7
|
+
|
8
|
+
* pbm
|
9
|
+
* sudo systemctl link /usr/share/pbm/current/systemd_units/pbm.service
|
10
|
+
* sudo systemctl enable pbm.service
|
11
|
+
* pbm_web
|
12
|
+
* sudo systemctl link /usr/share/pbm/current/systemd_units/pbm_web.service
|
13
|
+
* sudo systemctl enable pbm_web.service
|
9
14
|
|
10
15
|
## systemdを使ってサービスから解除する方法
|
11
16
|
* sudo systemctl disable pbm.service
|
data/project_template/app.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
version: 1.0
|
2
2
|
setting: |-
|
3
|
-
fast_return = ProconBypassMan::Splatoon2::Macro::FastReturn
|
4
|
-
guruguru = ProconBypassMan::Splatoon2::Mode::Guruguru
|
3
|
+
fast_return = ProconBypassMan::Plugin::Splatoon2::Macro::FastReturn
|
4
|
+
guruguru = ProconBypassMan::Plugin::Splatoon2::Mode::Guruguru
|
5
5
|
|
6
6
|
install_macro_plugin fast_return
|
7
|
-
install_macro_plugin ProconBypassMan::Splatoon2::Macro::JumpToUpKey
|
8
|
-
install_macro_plugin ProconBypassMan::Splatoon2::Macro::JumpToRightKey
|
9
|
-
install_macro_plugin ProconBypassMan::Splatoon2::Macro::JumpToLeftKey
|
7
|
+
install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::JumpToUpKey
|
8
|
+
install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::JumpToRightKey
|
9
|
+
install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::JumpToLeftKey
|
10
10
|
install_mode_plugin guruguru
|
11
11
|
|
12
12
|
prefix_keys_for_changing_layer [:zr, :zl, :l]
|
@@ -18,9 +18,9 @@ setting: |-
|
|
18
18
|
flip :a, if_pressed: [:a]
|
19
19
|
flip :down, if_pressed: :down
|
20
20
|
macro fast_return.name, if_pressed: [:y, :b, :down]
|
21
|
-
macro ProconBypassMan::Splatoon2::Macro::JumpToUpKey, if_pressed: [:y, :b, :up]
|
22
|
-
macro ProconBypassMan::Splatoon2::Macro::JumpToRightKey, if_pressed: [:y, :b, :right]
|
23
|
-
macro ProconBypassMan::Splatoon2::Macro::JumpToLeftKey, if_pressed: [:y, :b, :left]
|
21
|
+
macro ProconBypassMan::Plugin::Splatoon2::Macro::JumpToUpKey, if_pressed: [:y, :b, :up]
|
22
|
+
macro ProconBypassMan::Plugin::Splatoon2::Macro::JumpToRightKey, if_pressed: [:y, :b, :right]
|
23
|
+
macro ProconBypassMan::Plugin::Splatoon2::Macro::JumpToLeftKey, if_pressed: [:y, :b, :left]
|
24
24
|
remap :l, to: :zr
|
25
25
|
end
|
26
26
|
layer :right, mode: guruguru.name
|
data/sig/main.rbs
CHANGED
@@ -182,6 +182,7 @@ class ProconBypassMan::Configuration
|
|
182
182
|
end
|
183
183
|
|
184
184
|
attr_reader api_server: untyped
|
185
|
+
attr_reader api_servers: untyped
|
185
186
|
|
186
187
|
attr_accessor enable_critical_error_logging: untyped
|
187
188
|
|
@@ -200,7 +201,21 @@ class ProconBypassMan::Configuration
|
|
200
201
|
def digest_path: () -> ::String
|
201
202
|
|
202
203
|
# @return [String] pbm-webの接続先
|
203
|
-
def
|
204
|
+
def current_server: () -> ::String
|
205
|
+
|
206
|
+
def current_ws_server: () -> (::String | nil)
|
207
|
+
|
208
|
+
def current_ws_server_url: () -> ::String
|
209
|
+
|
210
|
+
def enable_ws?: () -> bool
|
211
|
+
|
212
|
+
def server_pool: () -> untyped
|
213
|
+
|
214
|
+
def internal_server_pool: () -> untyped
|
215
|
+
|
216
|
+
def internal_servers: () -> ::Array[string | nil]
|
217
|
+
|
218
|
+
def internal_api_servers: () -> ::Array[untyped]
|
204
219
|
end
|
205
220
|
|
206
221
|
|