-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:foundpatterns/lighttouch-base int…
…o contentdb-rename
- Loading branch information
Showing
59 changed files
with
265 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
function _G.get_place () | ||
--[[ | ||
-- Doesn't work for https stuff | ||
local response = send_request({ | ||
method = "GET", | ||
uri = "https://ifconfig.me/", | ||
headers = { | ||
["accept"] = "text/plain", | ||
}, | ||
body = "" | ||
}) | ||
local place = response.body | ||
]] | ||
|
||
-- Ideally, this would be a raw request, like above | ||
local cmd = "curl ifconfig.me" | ||
local file = assert(io.popen(cmd, 'r')) | ||
local place = assert(file:read('*a')) | ||
file:close() | ||
|
||
log.info("Current place: " .. place) | ||
|
||
return place | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function _G.render (file, data) | ||
return tera.instance:render(file, data) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function _G.send_request (request) | ||
|
||
if type(request) == "string" then | ||
request = {uri = request} | ||
end | ||
|
||
request.uuid = uuid.v4() | ||
events["outgoing_request_about_to_be_sent"]:trigger({ request = request }) | ||
|
||
local response = client_request.send(request) | ||
response.uuid = uuid.v4() | ||
events["incoming_response_received"]:trigger({ response = response }) | ||
|
||
return response | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
function keys.connect_profile (data) | ||
|
||
local result = {} | ||
|
||
local profile_uuid = data.uuid | ||
result.profile = profile_uuid | ||
|
||
content.write_file(profile_uuid, profile_uuid, { | ||
type = "profile", | ||
name = data.name | ||
}) | ||
|
||
if data.sign_public_key then | ||
local sign_pub_id = uuid.v4() | ||
|
||
content.write_file(profile_uuid, uuid.v4(), { | ||
type = "key", | ||
kind = "sign_public", | ||
}, data.sign_public_key) | ||
|
||
result.sign_public_key = sign_pub_id | ||
end | ||
|
||
if data.place then | ||
local place_id = uuid.v4() | ||
|
||
content.write_file(profile_uuid, uuid.v4(), { | ||
type = "place", | ||
host = data.place, | ||
}) | ||
|
||
result.place = place_id | ||
end | ||
|
||
return result | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
function keys.get_profile_data () | ||
|
||
local data = {} | ||
local uuid, name = keys.get_profile() | ||
log.debug("UUID: " .. tostring(uuid)) | ||
|
||
data.sign_public_key = content.walk_documents(uuid, | ||
function (file_uuid, header, body) | ||
if header.model == "key" | ||
and header.kind == "sign_private" | ||
then return body end | ||
end | ||
) | ||
|
||
data.place = content.walk_documents(uuid, | ||
function (file_uuid, header, body) | ||
if header.model == "place" then | ||
return header.host | ||
end | ||
end | ||
) | ||
|
||
return data | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,3 @@ function actions_loader.custom_require(name) | |
return default_package_searchers2(name) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
function actions_loader.loop_over_actions(action_files, package_name) | ||
log.trace("[loading] " .. ansicolors('%{underline}' .. package_name) .. " package's actions") | ||
for _, file_name in ipairs(action_files) do | ||
log.trace("[patching] action " .. ansicolors('%{underline}' .. file_name)) | ||
|
||
local action_require_name = "packages." .. package_name .. ".actions." .. string.sub( file_name, 0, string.len( file_name ) - 4 ) | ||
local action_require = require(action_require_name) | ||
actions_loader.assign_action_to_event(action_require, file_name) | ||
|
||
log.trace("[loaded] action " .. ansicolors('%{underline}' .. file_name)) | ||
end | ||
log.trace("[patched] actions for package " .. ansicolors('%{underline}' .. package_name)) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
function actions_loader.set_priority (created_file, header) | ||
created_file:write("\nlocal priority = " .. header.priority .. " \n\n") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ function actions_loader.write_events (created_file, header) | |
end | ||
end | ||
created_file:write(" }") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,3 @@ function actions_loader.write_function (created_file, header, modulepath) | |
end | ||
created_file:write("\nend") | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ function actions_loader.write_input_parameters (created_file, header) | |
end | ||
created_file:write("}\n") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
function actions_loader.write_return (created_file, header) | ||
created_file:write("\n\nreturn{\n\tevent = event,\n\taction = action,\n\tpriority = priority,\n\tinput_parameters = input_parameters\n}") -- ending return | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.