iniquity 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/iniquity +85 -19
  3. metadata +4 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a0139dbf695e4309aff9c4cd4d9f9b2258faf04
4
- data.tar.gz: 3da6662296bf35e1e17056192aefe41c51b823a8
3
+ metadata.gz: 68911b879d4b7ef47ea9e1821a4f932514291821
4
+ data.tar.gz: ade9c48c3ea882765e6aa0a4cf1f73b65b2becff
5
5
  SHA512:
6
- metadata.gz: 0f41ace575d50834b279848706d50412098fbdba383a70c3831f7fb7dc477fffdbbacf211ff3e4c28d4be638afa52f4d409ea08783db8247be67155c25896a8f
7
- data.tar.gz: fee8f313775f23737e57ec6ec1050ce7ea7185366b065cef32e91a6579db17780e164026be3940099f28094c88a1bb266e71f315981b7b47acce0e9eadc9db66
6
+ metadata.gz: c53f05b75f6f707c24f8aa3d4e637dc69d36377e04aa1ae5d88116f884ac53439872182f71b647881b25199ad4c4a9adb7a122cc226b7d2dc62de70922a2548f
7
+ data.tar.gz: bde980d8dbad9becadc5f412410495319f786aedbea8af12ca25841129bd4d44b87427e6bb1e998ce0548f2d352f61f885813e6be49fa1b71413ea822f629058
@@ -2,48 +2,114 @@
2
2
  # encoding: UTF-8
3
3
 
4
4
  BEGIN {
5
- unless ARGV[0] || ENV["INIQUITY_HOME"]
6
- abort "Please set the INIQUITY_HOME environment variable."
5
+ unless ARGV[0] || ENV["INIQUITY_SYSTEM"]
6
+ abort "Please set the INIQUITY_SYSTEM environment variable."
7
7
  end
8
8
  }
9
9
 
10
- HOME = ARGV[0] || ENV["INIQUITY_HOME"] || "."
11
- ENV["INIQUITY_HOME"] = HOME
10
+ HOME = ARGV[0] || ENV["INIQUITY_SYSTEM"]
11
+ ENV["INIQUITY_SYSTEM"] = HOME
12
12
 
13
- require "iniquity"
14
13
  require "inifile"
15
14
  require "thin"
15
+ require "socksify"
16
16
 
17
- trap("INT") {exit}
17
+ if File.exists?(HOME+ "/iniquity.ini")
18
+ CONFIG = IniFile.load(HOME+ "/iniquity.ini")
19
+ else
20
+ abort "An Iniquity system must have an iniquity.ini file."
21
+
22
+ if CONFIG["tor"]["enabled"] == "yes"
23
+ TCPSocket::socks_server = CONFIG["tor"]["address"]
24
+ TCPSocket::socks_port = CONFIG["tor"]["port"]
25
+ end
26
+
27
+ class Telnet < EM::Connection
28
+
29
+ def initialize
30
+ super
31
+ send_data "\nIniquity BBS 0.0.3 - Telnet/UTF_8\n"
32
+ end
33
+
34
+ def post_init
35
+
36
+ puts "-- Someone connected to the Iniquity Telnet service."
37
+
38
+ #IO.readlines("./modules/welcome.ans").each do |line|
39
+ # send_data line.force_encoding(Encoding::IBM437).encode(Encoding::UTF_8)
40
+ #end
41
+
42
+ #def wrap(s, width=78)
43
+ # s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
44
+ #end
45
+
46
+ #send_data wrap("Eu duis consequat laborum sunt incididunt deserunt dolor nisi eu occaecat commodo ad. Reprehenderit aute laboris Lorem ex cillum ipsum laborum irure excepteur sint do pariatur Lorem sit. Aliqua ipsum dolor quis ea. Tempor non ipsum consequat proident fugiat ad id laboris aliquip amet magna.\n", 78)
47
+ end
48
+
49
+ def receive_data data
50
+ #send_data ">>>you sent: #{data}"
51
+ close_connection if data =~ /quit|q|goodbye|g|logoff|l/i
52
+ end
53
+
54
+ def unbind
55
+ puts "-- Someone disconnected from the Iniquity Telnet service."
56
+ end
57
+ end
58
+
59
+ class Http < EM::Connection
60
+ def initialize
61
+ super
62
+ end
63
+ def post_init
64
+ end
65
+ def receive_data
66
+ end
67
+ def unbind
68
+ end
69
+ end
70
+
71
+ class Rest < EM::Connection
72
+ def initialize
73
+ super
74
+ end
75
+ def post_init
76
+ end
77
+ def receive_data
78
+ end
79
+ def unbind
80
+ end
81
+ end
18
82
 
19
83
  EM.run do
20
84
 
21
- ### WFC Screen
85
+ ### Events
22
86
 
23
87
  EM.add_periodic_timer(15) do
24
- puts "Iniquity: WFC Coming Soon!"
88
+ puts "Event: Nothing to see here..."
25
89
  end
26
90
 
27
- config = IniFile.load(HOME+ "/iniquity.ini")
91
+ ### Services
28
92
 
29
- config.each_section do |section|
93
+ CONFIG.each_section do |section|
30
94
 
31
- if section == "terminal"
32
- if config[section]["enabled"] == "yes"
33
- EM.start_server "0.0.0.0", config[section]["port"], Terminal
95
+ if section == "telnet"
96
+ if CONFIG[section]["enabled"] == "yes"
97
+ EM.start_server "0.0.0.0", CONFIG[section]["port"], Telnet
34
98
  end
35
99
  end
36
100
 
37
- if section == "web"
38
- if config[section]["enabled"] == "yes"
39
- EM.start_server "0.0.0.0", config[section]["port"], Web
101
+ if section == "http"
102
+ if CONFIG[section]["enabled"] == "yes"
103
+ EM.start_server "0.0.0.0", CONFIG[section]["port"], Http
40
104
  end
41
105
  end
42
106
 
43
- if section == "api"
44
- if config[section]["enabled"] == "yes"
45
- EM.start_server "0.0.0.0", config[section]["port"], API
107
+ if section == "rest"
108
+ if CONFIG[section]["enabled"] == "yes"
109
+ EM.start_server "0.0.0.0", CONFIG[section]["port"], Rest
46
110
  end
47
111
  end
48
112
  end
49
113
  end
114
+
115
+ trap("INT") {exit}
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iniquity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Stephenson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-31 00:00:00.000000000 Z
11
+ date: 2017-11-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Iniquity is a bulletin board software package written in Ruby.
13
+ description: A re-imagining of the iconic BBS software.
14
14
  email: ispyhumanfly@gmail.com
15
15
  executables:
16
16
  - iniquity
@@ -26,8 +26,6 @@ metadata:
26
26
  post_install_message:
27
27
  rdoc_options: []
28
28
  require_paths:
29
- - "./bin"
30
- - "./lib"
31
29
  - "./examples"
32
30
  - "./docs"
33
31
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -45,5 +43,5 @@ rubyforge_project:
45
43
  rubygems_version: 2.6.14
46
44
  signing_key:
47
45
  specification_version: 4
48
- summary: A re-imagining of the iconic BBS software.
46
+ summary: Iniquity BBS
49
47
  test_files: []