Skip to content

Commit 295693d

Browse files
committed
check for dev host
1 parent 782fa59 commit 295693d

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

backend_utils.lua

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function explode_and_trim(d,p)
202202
ll = l + 1 -- save just after where we found it for searching next time.
203203
else
204204
s = string.sub(p,ll)
205-
s = s:gsub("^%s+", ""):gsub("%s+$", "")
205+
s = s:gsub("^%s+", ""):gsub("%s+$", "")
206206
table.insert(t, s) -- Save what's left in our array.
207207
break -- Break at end, as it should be, according to the lua manual.
208208
end
@@ -230,7 +230,7 @@ function trim_tag_str(d,p)
230230
o = o .. s .. d
231231
else
232232
s = string.sub(p,ll)
233-
s = s:gsub("^%s+", ""):gsub("%s+$", "")
233+
s = s:gsub("^%s+", ""):gsub("%s+$", "")
234234
o = o .. s .. d
235235
break -- Break at end, as it should be, according to the lua manual.
236236
end
@@ -245,7 +245,7 @@ function remove_dups(a)
245245

246246
for _,v in ipairs(a) do
247247
if (not hash[v]) then
248-
res[#res+1] = v
248+
res[#res+1] = v
249249
hash[v] = true
250250
end
251251
end
@@ -259,7 +259,7 @@ function filter_tags(s)
259259
local tag_str = ''
260260
if tags then
261261
tags = remove_dups(tags)
262-
for i, p in pairs(tags) do
262+
for i, p in pairs(tags) do
263263
if p ~= '' then
264264
tag_str = tag_str .. p
265265
if i < table.getn(tags) then
@@ -270,4 +270,21 @@ function filter_tags(s)
270270
end
271271
return tag_str
272272
end
273-
273+
274+
function is_dev_server(req)
275+
if req.parsed_url.host == 'turtlestitch.backface.io' then
276+
return true
277+
end
278+
if req.parsed_url.host == 'dev.turtlestitch.org' then
279+
return true
280+
end
281+
return false
282+
end
283+
284+
function is_localhost(req)
285+
if req.parsed_url.host == 'localhost' then
286+
return true
287+
else
288+
return false
289+
end
290+
end

views/index.etlua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
<h1 style="text-align:center">Turtlestitch - Coded Embroidery</h1>
33

4-
<% if req.parsed_url.host == 'turtlestitch.backface.io' then %>
4+
<% if is_dev_server(req) then %>
55
<div style="text-align:center; color: red">
66
DEVELOPMENT/STAGING VERSION!<br>
77
<br>

0 commit comments

Comments
 (0)