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

remove _global_windows state, add security-token, local file URI helpers #14

Merged
merged 2 commits into from
May 16, 2018

Conversation

vtjnash
Copy link
Contributor

@vtjnash vtjnash commented May 1, 2018

More changes. 🙂

If you need windows(), it can still be defined as foldl(append!, Window[], (windows(app) for app in Electron._global_applications)). Do you want me to add that?

Also, this adds a set of helper function for working with local file URI objects (similar to loadFile that was recently added to Electron in electron/electron#11560)

vtjnash added 2 commits May 1, 2018 15:00
Electron seems to not allow relative URLs. I suppose it is not sure what they are relative to?
Handling them properly is a bit verbose (electron/electron#11560),
so I expect it will be helpful to have a standardized interface provided.
Copy link
Owner

@davidanthoff davidanthoff left a comment

Choose a reason for hiding this comment

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

Great, thanks!

I just think we should move the whole path/URI story into other packages, that seems generally useful and really not specific to this package here.

@@ -4,46 +4,59 @@ module Electron
using JSON, URIParser

export Application, Window, URI, windows, applications
export @LOCAL
Copy link
Owner

Choose a reason for hiding this comment

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

I think I would prefer to not have this in here, but instead just add support for https://github.com/rofinn/FilePaths.jl to this package here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think he's previously stated that he doesn't want this in there (rofinn/FilePaths.jl#18)

But this also doesn't have any analogous functionality to what's provided by that package. This macro is a way of building a URI to a local file relative to the current source file. That package is a way of representing a path to a local file (a slightly more limited concept) relative to the cwd.

connection::IO
proc
sysnotify_connection::IO
secure_cookie::Vector{UInt8}
windows::Vector{T}
Copy link
Owner

Choose a reason for hiding this comment

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

The only reason for T here is that we don't have access to Window yet, right? Or is there some other reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it's a forward declaration

main_pipe_name = generate_pipe_name("juliaelectron-$process_id-$id")
ispath(main_pipe_name) || break
id += 1
end
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe an even less involved way to do this would be to just generate a UUID as the id and use that? Then we don't have to track anything, and also not check whether the pipe already exists?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nah, this is easier, since you generally want to handle collisions anyways. this is basically how tempfile usually is often implemented (although typically now they start from a random number to reduce the search)

# filespec isa String && return URI_file(base, filespec) # can construct eagerly
# return :(URI_file($base, $(esc(filespec))))
return :(URI_file(@__DIR__, $(esc(filespec))))
end
Copy link
Owner

Choose a reason for hiding this comment

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

I think ideally we would just put something like that into FilePaths.jl, right? That would seem like a better home.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm hoping my PR to URIParser will be accepted, and then can later drop this compat code from here. I use this to operate on full URI file:/ objects, not just the subset covered by FilePaths, so it wouldn't fit into the later.

@davidanthoff
Copy link
Owner

I'll merge this for now, but will unexport @LOCAL in a new commit. I see that it is useful to have here until it finds a home in some other package, but I don't want to make it part of the "official" API here. Same for URI_file, I'll leave it in for now, but eventually we should try to move it somewhere else.

@davidanthoff davidanthoff merged commit ae81d25 into davidanthoff:master May 16, 2018
davidanthoff pushed a commit that referenced this pull request May 16, 2018
@vtjnash vtjnash deleted the jn/patch-4 branch June 1, 2018 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants