-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from yougotwill/feat/ses-2243/constantsWrapper
Export libsession constants
- Loading branch information
Showing
13 changed files
with
680 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
/build/ | ||
/.vscode/ | ||
# ide files | ||
/.vscrof/ | ||
/.vscode/ | ||
/.idea/ | ||
|
||
/build/ | ||
/node_modules/ | ||
/*.tar.gz | ||
/package-lock.json | ||
|
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
Submodule libsession-util
updated
21 files
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "constants.hpp" | ||
|
||
#include "session/config/contacts.hpp" | ||
#include "session/config/groups/info.hpp" | ||
#include "session/config/user_groups.hpp" | ||
|
||
namespace session::nodeapi { | ||
ConstantsWrapper::ConstantsWrapper(const Napi::CallbackInfo& info) : | ||
Napi::ObjectWrap<ConstantsWrapper>(info) {} | ||
|
||
Napi::Object ConstantsWrapper::Init(Napi::Env env, Napi::Object exports) { | ||
const char* class_name = "CONSTANTS"; | ||
|
||
// construct javascript constants object | ||
Napi::Function cls = DefineClass( | ||
env, | ||
class_name, | ||
{ObjectWrap::StaticValue( | ||
"CONTACT_MAX_NAME_LENGTH", | ||
Napi::Number::New(env, session::config::contact_info::MAX_NAME_LENGTH), | ||
napi_enumerable), | ||
ObjectWrap::StaticValue( | ||
"BASE_GROUP_MAX_NAME_LENGTH", | ||
Napi::Number::New(env, session::config::base_group_info::NAME_MAX_LENGTH), | ||
napi_enumerable), | ||
ObjectWrap::StaticValue( | ||
"GROUP_INFO_MAX_NAME_LENGTH", | ||
Napi::Number::New(env, session::config::groups::Info::NAME_MAX_LENGTH), | ||
napi_enumerable), | ||
ObjectWrap::StaticValue( | ||
"COMMUNITY_FULL_URL_MAX_LENGTH", | ||
Napi::Number::New(env, session::config::community::FULL_URL_MAX_LENGTH), | ||
napi_enumerable)}); | ||
|
||
// export object as javascript module | ||
exports.Set(class_name, cls); | ||
return exports; | ||
} | ||
|
||
} // namespace session::nodeapi |
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,12 @@ | ||
#pragma once | ||
|
||
#include <napi.h> | ||
|
||
namespace session::nodeapi { | ||
class ConstantsWrapper : public Napi::ObjectWrap<ConstantsWrapper> { | ||
public: | ||
ConstantsWrapper(const Napi::CallbackInfo& info); | ||
|
||
static Napi::Object Init(Napi::Env env, Napi::Object exports); | ||
}; | ||
} // namespace session::nodeapi |
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
Oops, something went wrong.