-
Notifications
You must be signed in to change notification settings - Fork 19
Issue 171 rev1 (team 4) #190
base: master
Are you sure you want to change the base?
Conversation
Please update to new code from main repository. As described in #171, there is a placeholder for this code. |
Just to make sure, I am waiting for you here, no? |
// TODO: Remove stub. | ||
if (Math.random() < 0.5) | ||
return false; | ||
var randomNode = nodes[Math.floor(Math.random() * nodes.length)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modify this to return assigned node?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, no. We will use HTML5 geolocation to send this information to the server, which will then based on that find closest node and then other parts of the portal will work as expected. So this should be done only on /outside/
view.
What and how shall we do (things) here? |
Check |
Is this the only way how to assign node to a user? If I understand things correctly there is some other mechanism (not part of piplmesh) that assigns node to user if user is connected on internet through that node. |
Don't forget to update this from main repository before you start working. Currently it is not. You never assign node to the user manually. This is done by out nodes API. You just provide API with additional data (latitude and longitude), so that it can fallback to search for closest node if user is not connected directly to the node. Currently, for development, we just pick node at random. In reality, we will use user's IP to see if it is internal IP and from which node, or not. And in the later case we will search for closest node. |
I get this. I will try to be more careful with wording. What is unclear is do we send HTML5 geolocation regardless if it is already known what node is user assigned to? The script I wrote only sends HTML5 data if user is not connected on internet via node. Scenarios:
|
I saw outside code. I can implement it the way it is imagined. Would not it be better if location gets sent without user interaction? |
I would do it like that:
Can you determine if we are allowed to use geolocation without triggering permission check popup? So scenario 2. above is: user is not connected to the node, there is nothing in session, so she is redirected to So server does not respond with anything when sending it geolocation, simply redirects to home. Later on we could use that to update the node, if user moved to new node. |
The answer to the first question is no. That is why I asked, because this way, user is asked to confirm (practically) same thing twice. Location permission however gets stored in local storage I think so she will not get bothered once she sets allow geolocation + remember. That said, this is per-browser setting. Is it important that user is redirected to My vision of scenarion 2: User is notified that she is assigned to the closest node. No redirections, no confirmations beyond necessary ones. By respond I meant probably the same as you - server sets nearest node. |
Yes, redirecting to I don't understand why would user confirm same thing twice? There would be only one confirmation (at If she chooses to not allow, she stays at Moving between nodes is a problem on itself and will be solved some other time (after 1.0). The problem of your scenario 2: once request comes in and you discover that it is not from user connected to any node in the network, you do not have time anymore to request HTML5 geolocation. And you simply cannot find closest node. So you have to do something: you redirect to the site where you request this. Look at this similar to how Facebook is if you are not logged in. Open it, you will see, it is empty. ;-) |
Hmmm... I would discuss this further on wednesday but you are absent. Yes, confirmation is per-site. HTML 5 geolocation cannot be resolved at HTTP level as it requires callback. Will reread and reconsider your thought tomorrow. |
I will be on Wednesday, so we can discuss it in person. |
Ping. Please finish. Update from the main repository, too. |
Location API #171
HTML5 location #172