This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Zudo's profile picture

"Open Link" function

Started by Zudo, 21 June 2014 - 08:27 AM
Zudo #1
Posted 21 June 2014 - 10:27 AM
So my idea is that a function, maybe os.openURL() could exist, allowing programs to open links in the user's default web browser. This would work like the "clicking links in chat" feature in Minecraft, where clicking on a link prompts the user to open the URL. However, it is called from a function.
Lyqyd #2
Posted 21 June 2014 - 11:01 AM
That would almost certainly be used more for abusive/griefing purposes than anything else.
Saldor010 #3
Posted 21 June 2014 - 03:28 PM

while true do
  os.openURL(MaliciousSite)
end
awsmazinggenius #4
Posted 21 June 2014 - 04:46 PM
By default, in Minecraft, you are prompted before opening links, allowing the user to decide whether they want to open the link. This feature could be useful for many things, like a link to email or Skype chat with the program author, so I support it.
Xfel #5
Posted 21 June 2014 - 04:56 PM
Yes, but in normal minecraft, you have to explicitly click on the link in the chat window, it's solely a client side thing. The server shouldn't be able to do such stuff.
H4X0RZ #6
Posted 21 June 2014 - 05:32 PM
Maybe CC can close the GUI and "whisper" the URL to the player.
Bomb Bloke #7
Posted 21 June 2014 - 06:24 PM
Assuming the user is prompted before opening the link (by ComputerCraft itself, as opposed to the script), and the prompt includes an option to terminate the script instead, I don't see any problems. Assuming common sense is incorporated into the implementation, this strikes me as a reasonable idea.
Sebra #8
Posted 21 June 2014 - 07:09 PM
1. Which user's browser you want to use? All around?
2. Computer cannot even beep now, how would it "whisper"? Special device?
3. Launching any external program without explicit user demand is quite bad. Especially inet access.
Bomb Bloke #9
Posted 21 June 2014 - 07:23 PM
1. Which user's browser you want to use? All around?

The default browser of the user that clicks the link.

3. Launching any external program without explicit user demand is quite bad. Especially inet access.

The idea is that the user is prompted - by ComputerCraft / MineCraft, as opposed to the script - as to whether or not the link should be opened.
Cranium #10
Posted 21 June 2014 - 08:19 PM
Again, this opens a whole can of worms, where someone could spam links constantly with an infinite loop, and hide the computer. This is just a bad idea.
Symmetryc #11
Posted 21 June 2014 - 08:34 PM
Again, this opens a whole can of worms, where someone could spam links constantly with an infinite loop, and hide the computer. This is just a bad idea.
What could happen is, as Bomb Bloke said, it could open up a prompt that allows you to either follow the link, not follow the link, or terminate the program. That way, if the program is simply spamming link prompts, you could just terminate it.

I think this idea would be quite nice.
Bomb Bloke #12
Posted 21 June 2014 - 08:43 PM
Though really, users would need to trigger even that prompt manually - it's no good if malicious users could simply restart the script over and over until someone mis-clicked and opened a webpage they didn't want to.

The way to go would be to define areas of an advanced system/monitor's display to act like a link. Some sort of special "print" function would be required, one that drew a line under the rendered text and flagged it as a URL.

It's certainly do-able, but a fair bit of work would be involved. The question is whether it's worth it.
Cranium #13
Posted 21 June 2014 - 08:54 PM
I think the only proper way to do it would be only from the gui, and the user MUST click on the url to visit the page, rather than a popup. That way, even if it's spammed, the person must click it to open it up, otherwise it's just a bit of text in the computer, and you can safely esc out of it.
Slash0mega #14
Posted 22 June 2014 - 03:19 PM
while i doubt that this will make it into computercraft, i think i got a solution to the loop worry

allow users to disable the promt from appering on there client with a "stop showing prompts this session" showing in the prompt. that way if a user loops the promt, you can click that and no matter how many times the script requests the promt, it wont effect you.

now, here is another problem, how would the computer know who to show the prompt too? whoever has the gui open at the time? if that was the the case another solution to prompt spam is just to not open that terminal again after it kicks you out of the cc interface for the prompt the second or third time.
apemanzilla #15
Posted 22 June 2014 - 03:53 PM
This feels like it would break the fourth wall too much and also allow too many malicious uses with the current system in place for links. Sorry.
Sebra #16
Posted 22 June 2014 - 07:17 PM
The way to go would be to define areas of an advanced system/monitor's display to act like a link. Some sort of special "print" function would be required, one that drew a line under the rendered text and flagged it as a URL.
This is even worse. You turn Computer into device_to_show_urls.

How about special button it GUI? Player can click on it, then any string on the screen to try to open it in default browser.
This way no special function needed, player initiate browser launch himself, no screen change needed.
apemanzilla #17
Posted 25 June 2014 - 01:48 AM
The way to go would be to define areas of an advanced system/monitor's display to act like a link. Some sort of special "print" function would be required, one that drew a line under the rendered text and flagged it as a URL.
This is even worse. You turn Computer into device_to_show_urls.

How about special button it GUI? Player can click on it, then any string on the screen to try to open it in default browser.
This way no special function needed, player initiate browser launch himself, no screen change needed.
How would you identify the entire string from the point where the player clicked? You could only accurately get a single character based on their click without havig to guess at what is and isn't part of what they tried to click.
Saldor010 #18
Posted 25 June 2014 - 03:53 PM
I vote that we don't do this at all. I don't think CC computers should be allowed to access your real computers program (in this case, a web browser), no matter what method. It breaks the fourth wall way too much.
Bomb Bloke #19
Posted 25 June 2014 - 03:59 PM
*cough*paste event*cough*http API*cough*
Sebra #20
Posted 25 June 2014 - 10:11 PM
How would you identify the entire string from the point where the player clicked? You could only accurately get a single character based on their click without havig to guess at what is and isn't part of what they tried to click.
Space separated.
I vote that we don't do this at all. I don't think CC computers should be allowed to access your real computers program (in this case, a web browser), no matter what method. It breaks the fourth wall way too much.
I'm agree.