Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set webapp roles that are max 12 characters long. #30

Open
wants to merge 1 commit into
base: @6.agl.icefish
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/agl/WebRuntimeAGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ int WebAppLauncherRuntime::run(int argc, const char** argv) {
bool isWaitHostService = isWaitForHostService(args);
m_id = getAppId(args);
m_url = getAppUrl(args);
m_role = "WebApp";

if(isWaitHostService) {
while(!WebAppManagerServiceAGL::instance()->isHostServiceRunning()) {
Expand Down Expand Up @@ -220,15 +219,9 @@ bool WebAppLauncherRuntime::init() {
if (n != std::string::npos) {
std::string sport = authority.substr(n+1);
m_host = authority.substr(0, n);
m_role.push_back('-');
m_role.append(m_host);
m_role.push_back('-');
m_role.append(sport);
m_port = stringTo<int>(sport);
} else {
m_host = authority;
m_role.push_back('-');
m_role.append(m_host);
}
}

Expand Down Expand Up @@ -265,6 +258,9 @@ bool WebAppLauncherRuntime::init() {
m_role = "homescreen";
else if (m_id.rfind("webapps-homescreen", 0) == 0)
m_role = "homescreen";
else {
m_role = m_id.substr(0,12);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Application ID is a bad idea for this purpose, as with the typical naming it is still easy to see duplicates. I.e. com.webos.app. will alll have the same role.

I think we can take a different solution, that is just applying a hash algorithm. I.e. wapp-XXXXXXX (where XXXXXXX is calculated from the application ID, that is expected to be unique).

Another possibility is requiring apps to expose their roles somehow in config.xml.

And another possibility is fixing the platform to not fail with a role that is bigger than 12 characters. Do we know where this limit comes from?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...
I think we can take a different solution, that is just applying a hash algorithm. I.e. wapp-XXXXXXX (where XXXXXXX is calculated from the application ID, that is expected to be unique).

Thanks, will try this.

Another possibility is requiring apps to expose their roles somehow in config.xml.

In further versions of AGL, a new Wayland compositor will be used that replaces current homescreen and windowmanager APIs. Role names as they are now are expected to disappear, so it's not worth proposing changes in the application manifest, IMHO.

And another possibility is fixing the platform to not fail with a role that is bigger than 12 characters. Do we know where this limit comes from?

This patch is intended as a workaround while the actual problem is not fixed, to reach the release date.

}

LOG_DEBUG("id=[%s], name=[%s], role=[%s], url=[%s], host=[%s], port=%d, token=[%s]",
m_id.c_str(), m_name.c_str(), m_role.c_str(), m_url.c_str(),
Expand Down