solutus 0.1.1 → 0.1.2
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/lib/solutus.rb +21 -4
- data/resources/editBlog.html +1 -1
- data/resources/index.html +17 -3
- data/resources/login.html +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a476906bf83edc539d3566e7992844d9d2e1438c1c252c8f6a9fcbca376e5526
|
4
|
+
data.tar.gz: 0bc58bdcce19dcfcebc4f5a14020999c44bacccad8bed77afd9ed5f75a92b341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78a2dca0440d97315e4099d2ec5c2d1476492b8461674217dae22de396953ace70bb6aee31016da34c0e8e7422a4e3efe011f20991c243c568b022daa2366ad4
|
7
|
+
data.tar.gz: 102d3a7364083e90c5df5f6348e369bc99e212534755311e6a2f776bbe2fc12cab969b1d4f8919675b08163d07aa8046602021b19402be933d1c66f0f717a080
|
data/lib/solutus.rb
CHANGED
@@ -6,6 +6,7 @@ require 'redcarpet'
|
|
6
6
|
require 'json'
|
7
7
|
require 'nokogiri'
|
8
8
|
require 'digest'
|
9
|
+
require "rubygems"
|
9
10
|
|
10
11
|
#TODO: Add support for tags
|
11
12
|
#TODO: Make stress tests
|
@@ -29,6 +30,8 @@ class Solutus
|
|
29
30
|
PASSWORD_FILE = "password.txt"
|
30
31
|
DAY_ENDINGS = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "st"]
|
31
32
|
|
33
|
+
VERSION = '0.1.2'
|
34
|
+
|
32
35
|
@@blog_urls = Hash.new
|
33
36
|
@@page_urls = Array.new
|
34
37
|
|
@@ -72,6 +75,9 @@ class Solutus
|
|
72
75
|
if !params["password"]
|
73
76
|
return 'no password'
|
74
77
|
end
|
78
|
+
if !File.file?(PASSWORD_FILE)
|
79
|
+
render_login("Please set your password with <code>solutus password *****</code>")
|
80
|
+
end
|
75
81
|
given_password_hash = Digest::MD5.hexdigest params["password"]
|
76
82
|
password = File.read(PASSWORD_FILE)
|
77
83
|
puts given_password_hash.to_s
|
@@ -94,7 +100,7 @@ class Solutus
|
|
94
100
|
|
95
101
|
get "/edit" do
|
96
102
|
if !session[:verified]
|
97
|
-
return render_login()
|
103
|
+
return render_login("Please log in!")
|
98
104
|
end
|
99
105
|
render_index
|
100
106
|
end
|
@@ -108,7 +114,7 @@ class Solutus
|
|
108
114
|
|
109
115
|
post "/savepage" do
|
110
116
|
if !session[:verified]
|
111
|
-
return
|
117
|
+
return "error"
|
112
118
|
end
|
113
119
|
path = params["path"]
|
114
120
|
|
@@ -153,7 +159,7 @@ class Solutus
|
|
153
159
|
|
154
160
|
post "/savepost" do
|
155
161
|
if !session[:verified]
|
156
|
-
return
|
162
|
+
return "error"
|
157
163
|
end
|
158
164
|
path = params["path"]
|
159
165
|
f = File.open(path, "r")
|
@@ -175,6 +181,14 @@ class Solutus
|
|
175
181
|
"saved post @ #{path}"
|
176
182
|
end
|
177
183
|
|
184
|
+
post "/publish" do
|
185
|
+
if !session[:verified]
|
186
|
+
return "error"
|
187
|
+
end
|
188
|
+
Solutus.command("deploy")
|
189
|
+
"deployed"
|
190
|
+
end
|
191
|
+
|
178
192
|
get "/:page" do
|
179
193
|
path = File.join(settings.public_folder, params['page'], 'index.html')
|
180
194
|
if File.file?(path)
|
@@ -334,7 +348,10 @@ class Solutus
|
|
334
348
|
start_time = Time.now
|
335
349
|
|
336
350
|
if args.length >= 1
|
337
|
-
if args[0]
|
351
|
+
if ["-v", "--version"].include?(args[0])
|
352
|
+
puts VERSION
|
353
|
+
return
|
354
|
+
elsif args[0] == "deploy"
|
338
355
|
deploy
|
339
356
|
elsif args[0] == "build"
|
340
357
|
build
|
data/resources/editBlog.html
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
<body>
|
34
34
|
<h1>Editing <span style="border: 1px dotted gray" id="title-input" contenteditable>{{title}}</span></h1>
|
35
|
-
<code>{{path}}</code> ({{date}})
|
35
|
+
<code>{{path}}</code> (Created {{date}})
|
36
36
|
<p>
|
37
37
|
[<a href="/edit">Back to Edit</a>]
|
38
38
|
{{#canview}}
|
data/resources/index.html
CHANGED
@@ -22,15 +22,17 @@
|
|
22
22
|
color: #4286f4;
|
23
23
|
}
|
24
24
|
</style>
|
25
|
+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js"></script>
|
25
26
|
</head>
|
26
27
|
|
27
28
|
<body>
|
28
29
|
<h1>Editing {{name}}</h1>
|
29
30
|
<p>[<a href="/">View Site</a>]</p>
|
31
|
+
<p>[<a href="http://{{domain}}">View Public Site @ {{domain}}</a>]</p>
|
30
32
|
<p>
|
31
33
|
<form method="get" action="/editpage">
|
32
34
|
<fieldset>
|
33
|
-
<legend>Edit Page
|
35
|
+
<legend>Edit Page</legend>
|
34
36
|
{{{pages}}}
|
35
37
|
<p><button type="submit">Edit page</button></fieldset></p>
|
36
38
|
</fieldset>
|
@@ -39,7 +41,7 @@
|
|
39
41
|
<p>
|
40
42
|
<form method="post" action="/newpost">
|
41
43
|
<fieldset>
|
42
|
-
<legend>New Blog Post
|
44
|
+
<legend>New Blog Post</legend>
|
43
45
|
<p><label for="post-title">Title:</label> <input type="text" name="post-title"></p>
|
44
46
|
<p><button type="submit">Create new blog post</button></fieldset></p>
|
45
47
|
</fieldset>
|
@@ -48,14 +50,26 @@
|
|
48
50
|
<p>
|
49
51
|
<form method="get" action="/editpost">
|
50
52
|
<fieldset>
|
51
|
-
<legend>Edit Blog Post
|
53
|
+
<legend>Edit Blog Post</legend>
|
52
54
|
{{{blogs}}}
|
53
55
|
<p><button type="submit">Edit blog post</button></fieldset></p>
|
54
56
|
</fieldset>
|
55
57
|
</form>
|
56
58
|
</p>
|
59
|
+
<p>
|
60
|
+
<button type="button" id="publish">Publish to web</button>
|
61
|
+
<span id="status"></span>
|
62
|
+
</p>
|
63
|
+
|
57
64
|
<p style="text-align: center;">
|
58
65
|
<small>Powered by <a href="https://github.com/jeromew21/solutus">Solutus</a></small>
|
59
66
|
</p>
|
67
|
+
<script>
|
68
|
+
$("#publish").click(function() {
|
69
|
+
$.post("/publish", function(response) {
|
70
|
+
$("#status").text(response);
|
71
|
+
});
|
72
|
+
});
|
73
|
+
</script>
|
60
74
|
</body>
|
61
75
|
</html>
|
data/resources/login.html
CHANGED