mikifus / padland

Padland is a tool to manage, share, remember and read collaborative documents based on the Etherpad technology in Android.
Apache License 2.0
62 stars 15 forks source link

Custom Server #2

Closed smichel17 closed 7 years ago

smichel17 commented 8 years ago

If we could add our own etherpad instance, it would make this app very much more useful.

mikifus commented 8 years ago

This feature is a must. Back in the time I started this app I didn't know much about how to deal with the issue, so the app relies on intent filters to detect the shared links, which are not

Later I learned this can be achieved with broadcasts, so it might come up in a next release.

nicorikken commented 8 years ago

I agree, the Etherpad server i use is not listed either. Somewhat related, maybe a sharing feature can be introduced, so that when you navigate to an etherpad, you can use the share option to add it to the total list.

bvolkmer commented 8 years ago

+1 This makes the APP pretty useless to me at the moment

Bubu commented 8 years ago

Our university runs an etherpad server, I'd very much like to add it to the app.

mikifus commented 8 years ago

This feature is on its way, check this branch: https://github.com/mikifus/padland/tree/custom_servers

It still needs some implementation, testing, documentation, etc. that will take a while, it is going to be part of a future update. I don't have a deadline, but I am thinking of making an alpha tag release so you can test if it needs some more tweaking.

Bubu commented 8 years ago

Yay, sounds good!

I can try to compile and test that branch tomorrow or so, if that already makes sense.

smichel17 commented 8 years ago

If you push an alpha to f-droid (via the "unstable updates" feature), I'd love to test.

tpeg5stan commented 8 years ago

I would enjoy this feature too. As smichel17 said, you can upload unstable/beta/alpha versions to F-DROID, I would 100% test it

mikifus commented 8 years ago

I made an alpha pre-release that you can download. It should appear in F-Droid in a day or two. https://github.com/mikifus/padland/releases/tag/v1.2-alpha

I made a bit of documentation so you can test it better. There are no known bugs at the moment. No other translation than English has been added as the strings may change.

Custom servers

This features allows the user to add a custom server like "something.titanpad.com" or "pad.myserver.com". It doesn't replace the default servers, it adds customization.

The feature is found in the settings menu as "Server list". The New server dialog will promp when the button is pressed. The server name is just an arbitrary name for the user. The url must be something like "https://examplehost.com". No more and no less info than the protocol and the host. The user will be requested to choose whether the server runs Etherpad Lite or not. Most servers do, but titanpad.com doesn't, for example. Use the Advanced Options combined with the Etherpad Lite checkbox to understand them.

The servers can't be edited. They can be deleted by selecting them in the list.

To try your new server create a new pad and choose it. You can make it the default option in the settings menu.

Note: The server hosts the user adds and their subdomains are now considered part of the whitelist. This means that http connections to these domains are allowed. It also means that Padland will try to open these links if receives them.

Note 2: When istalling this app, it will allow you to open any url with it. I found no other way to make it work.

Other new features

The user can now share urls to the app in order to open them.

rugk commented 8 years ago

It would be nice to also be able to use URLs this way:

https://example.com/customserver

Because not all servers are hosted on an own domain, so please make this work too. Technically it should make no difference whether you use such a domain or another one.

mikifus commented 8 years ago

Have you tried to see what happens? Can you provide me a working instance under those conditions to try?

rugk commented 8 years ago

Yes, I tried it. At first it seems as if everything would be working (you can enter the URL without problems and you can also access it in the list of servers), but in the end I noticed that Padland just dropped everything after the domain name: www.example.com/mySubDir -> www.example.com

Could I get your mail address to send you a link to an instance? (You can also just drop me a mail)

mikifus commented 8 years ago

I just uploaded a new release that allows you to use those kind of urls and even more. Please report any error you may find with this feature.

You can download the apk file from here: https://github.com/mikifus/padland/releases/tag/v1.2.1-alpha

It will come up in F-droid after a day or two.

rugk commented 8 years ago

I wait until it gets to FDroid.

rugk commented 8 years ago

BTW what does "and even more" mean exactly? :smile:

mikifus commented 8 years ago

Any valid url includes login data and ports apart from 80. Examples:

rugk commented 8 years ago

Nice! That's indeed useful.

rugk commented 8 years ago

Okay. I can confirm it works basically. I only tried the non-jQuery version, but I was a little surprised it must shows me the website (in WebKit as I assume). I thought it would make use of an Etherpad API somehow.

So there are just two issues:

com.mikifus.padland/.SplashActivity: +740ms
I/ActivityManager(  615): START u0 {cmp=com.mikifus.padland/.PadListActivity} from uid 10259 on display 0
D/PadLandDataActivity(26225): Data activity started running
I/ActivityManager(  615): Displayed com.mikifus.padland/.PadListActivity: +478ms
I/ActivityManager(  615): START u0 {cmp=com.mikifus.padland/.SettingsActivity} from uid 10259 on display 0
I/ActivityManager(  615): Displayed com.mikifus.padland/.SettingsActivity: +395ms
I/ActivityManager(  615): START u0 {cmp=com.mikifus.padland/.ServerListActivity} from uid 10259 on display 0
D/PadLandDataActivity(26225): Data activity started running
I/ActivityManager(  615): Displayed com.mikifus.padland/.ServerListActivity: +278ms
I/ActivityManager(  615): START u0 {cmp=com.mikifus.padland/.SettingsActivity} from uid 10259 on display 0
I/ActivityManager(  615): Displayed com.mikifus.padland/.SettingsActivity: +234ms
I/ActivityManager(  615): START u0 {cmp=com.mikifus.padland/.NewPadActivity} from uid 10259 on display 0
I/ActivityManager(  615): Displayed com.mikifus.padland/.NewPadActivity: +309ms
D/CREATENEW(26225): padlandfftest
I/ActivityManager(  615): START u0 {cmp=com.mikifus.padland/.PadViewActivity (has extras)} from uid 10259 on display 0
D/PadLandDataActivity(26225): Data activity started running
W/SysUtils(26225):  at com.mikifus.padland.PadViewActivity.onCreate(Unknown Source)
D/INSERT  (26225): Contents = server=https://rugk.dedyn.ii/etherpad name=padlandfftest url=https://rugk.dedyn.ii/etherpad/p/padlandfftest
D/PAD_UPDATE(26225): content://com.mikifus.padland.padlandcontentprovider/padlist
I/ActivityManager(  615): Displayed com.mikifus.padland/.PadViewActivity: +801ms
I/ActivityManager(  615): START u0 {cmp=com.mikifus.padland/.PadListActivity (has extras)} from uid 10259 on display 0
D/PadLandDataActivity(26225): Data activity started running
I/ActivityManager(  615): Displayed com.mikifus.padland/.PadListActivity: +301ms
E/AndroidRuntime(26225): Process: com.mikifus.padland, PID: 26225
E/AndroidRuntime(26225):    at com.mikifus.padland.c.onClick(Unknown Source)
W/ActivityManager(  615):   Force finishing activity com.mikifus.padland/.PadListActivity
W/ActivityManager(  615): Activity pause timeout for ActivityRecord{8440e59 u0 com.mikifus.padland/.PadListActivity t5749 f}
W/InputDispatcher(  615): channel '4d54449 com.mikifus.padland/com.mikifus.padland.PadListActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
E/InputDispatcher(  615): channel '4d54449 com.mikifus.padland/com.mikifus.padland.PadListActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
W/InputDispatcher(  615): channel 'b794564 com.mikifus.padland/com.mikifus.padland.PadListActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
E/InputDispatcher(  615): channel 'b794564 com.mikifus.padland/com.mikifus.padland.PadListActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
W/InputDispatcher(  615): channel 'a1e3715 com.mikifus.padland/com.mikifus.padland.PadListActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
E/InputDispatcher(  615): channel 'a1e3715 com.mikifus.padland/com.mikifus.padland.PadListActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
I/WindowState(  615): WIN DEATH: Window{a1e3715 u0 com.mikifus.padland/com.mikifus.padland.PadListActivity}
W/InputDispatcher(  615): Attempted to unregister already unregistered input channel 'a1e3715 com.mikifus.padland/com.mikifus.padland.PadListActivity (server)'
I/WindowState(  615): WIN DEATH: Window{b794564 u0 com.mikifus.padland/com.mikifus.padland.PadListActivity}
W/InputDispatcher(  615): Attempted to unregister already unregistered input channel 'b794564 com.mikifus.padland/com.mikifus.padland.PadListActivity (server)'
I/ActivityManager(  615): Process com.mikifus.padland (pid 26225) has died
I/WindowState(  615): WIN DEATH: Window{4d54449 u0 com.mikifus.padland/com.mikifus.padland.PadListActivity}
W/InputDispatcher(  615): Attempted to unregister already unregistered input channel '4d54449 com.mikifus.padland/com.mikifus.padland.PadListActivity (server)'
I/ActivityManager(  615): Start proc 27133:com.mikifus.padland/u0a259 for activity com.mikifus.padland/.PadListActivity
W/System  (27133): ClassLoader referenced unknown path: /data/app/com.mikifus.padland-2/lib/arm
W/XPrivacy(27133): Hooking package=com.mikifus.padland
D/PadLandDataActivity(27133): Data activity started running
I/ActivityManager(  615): Displayed com.mikifus.padland/.PadListActivity: +809ms
I/ActivityManager(  615): START u0 {cmp=com.mikifus.padland/.SettingsActivity} from uid 10259 on display 0
I/ActivityManager(  615): Displayed com.mikifus.padland/.SettingsActivity: +356ms
I/ActivityManager(  615): START u0 {cmp=com.mikifus.padland/.ServerListActivity} from uid 10259 on display 0
D/PadLandDataActivity(27133): Data activity started running
I/ActivityManager(  615): Displayed com.mikifus.padland/.ServerListActivity: +294ms
W/SQLiteConnectionPool(27133): A SQLiteConnection object for database '/data/user/0/com.mikifus.padland/databases/commments.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
I/ActivityManager(  615): START u0 {cmp=com.mikifus.padland/.NewPadActivity} from uid 10259 on display 0
I/ActivityManager(  615): Displayed com.mikifus.padland/.NewPadActivity: +316ms
I/ActivityManager(  615): START u0 {cmp=com.mikifus.padland/.PadViewActivity (has extras)} from uid 10259 on display 0
D/PadLandDataActivity(27133): Data activity started running
W/SysUtils(27133):  at com.mikifus.padland.PadViewActivity.onCreate(Unknown Source)
D/PAD_UPDATE(27133): content://com.mikifus.padland.padlandcontentprovider/padlist
I/ActivityManager(  615): Displayed com.mikifus.padland/.PadViewActivity: +1s136ms
I/ActivityManager(  615): START u0 {cmp=com.mikifus.padland/.PadListActivity (has extras)} from uid 10259 on display 0
D/PadLandDataActivity(27133): Data activity started running
I/ActivityManager(  615): Displayed com.mikifus.padland/.PadListActivity: +357ms
E/AndroidRuntime(27133): Process: com.mikifus.padland, PID: 27133
E/AndroidRuntime(27133):    at com.mikifus.padland.c.onClick(Unknown Source)
W/ActivityManager(  615):   Force finishing activity com.mikifus.padland/.PadListActivity
W/ActivityManager(  615): Activity pause timeout for ActivityRecord{68fc78c u0 com.mikifus.padland/.PadListActivity t5749 f}
I/WindowState(  615): WIN DEATH: Window{f37d078 u0 com.mikifus.padland/com.mikifus.padland.PadListActivity}
I/WindowState(  615): WIN DEATH: Window{ea7ddaf u0 com.mikifus.padland/com.mikifus.padland.PadListActivity}
I/WindowState(  615): WIN DEATH: Window{4335d53 u0 com.mikifus.padland/com.mikifus.padland.PadListActivity}
I/ActivityManager(  615): Process com.mikifus.padland (pid 27133) has died
I/ActivityManager(  615): Start proc 29973:com.mikifus.padland/u0a259 for activity com.mikifus.padland/.PadListActivity
W/System  (29973): ClassLoader referenced unknown path: /data/app/com.mikifus.padland-2/lib/arm
W/XPrivacy(29973): Hooking package=com.mikifus.padland
D/PadLandDataActivity(29973): Data activity started running
I/ActivityManager(  615): Killing 29973:com.mikifus.padland/u0a259 (adj 9): remove task
I/WindowState(  615): WIN DEATH: Window{5a05714 u0 com.mikifus.padland/com.mikifus.padland.PadListActivity}
rugk commented 8 years ago

Additionally this option is strange: "Check this if the server runs on Etherpad Lite (or you can ignore this option)"

"(or you can ignore this option"?? This is like saying "Hey, click this button - or just don't do it!". You cannot confuse a user more than like this... Additionally the text is unnecessarily long. A simple "This server uses Etherpad Lite" or - if it makes sense - "I know this server uses Etherpad Lite" (which would imply this "ignoring") is enough. That checkboxes need to be checked is known by all everyone. :smiley:

The same applies to the jQuery option. It also begins with "Check this...". Yes, of course users check this if the statement is true - what else should they do: Tick it? Delete it? Strike it through? :laughing: I hope you get my point. :smiley: In this case the heading ("Supports jQuery") is also useless as it only covers one option. (Why a heading for one thing? In a written text you also would not make a heading for one headword.)

mikifus commented 8 years ago

Yeah, I get your point, I'll try to make it clear. I am used to communicate with databases rather than users.

:P

smichel17 commented 8 years ago

Right now when I open url of any kind via broadcast intent, Padland is an option. I think this should only be true if the url is a known etherpad server. Otherwise you should have to share the link to padland.

I don't know exactly how to do this but I know that Forkhub does it (only prompts for Github links).

aside @mikifus: this page of the material design guidelines about settings is reasonably short & the two bottom sections have recommendations on phrasing etc.

mikifus commented 8 years ago

@smichel17 Thanks.

I will explain how intent-filters work: A hardcoded set of domains can be stated on the AndroidManifest.xml file. The app will react to those domains. As they're hardcoded you can't add or remove them without recompiling the app.

The two options are:

Has anyone a better approach on this?

smichel17 commented 8 years ago

If nobody knows of a better approach, I suggest this as a reasonable compromise:

Then you get mostly the best of both worlds. Padland won't ask to open all links by default, and if you add a custom server / send that email, when you update to the next release of Padland, it'll will open your custom server by default.

It's more work for you (@mikifus), because you have to add everybody's custom server. If padland becomes popular to the point where this is a burdensome, you could set up something more sophisticated, like a script that automatically creates a commit based on an email with a certain title. But let's cross that bridge when we get there.

mikifus commented 8 years ago

Thanks for your proposal @smichel17, but the solution doesn't look elegant to me. Not because it makes me update manually the server list, but because it breaks the possibility of easily forking the app. And it is an open source app, so it must be forked.

On the other side, I think it is important that the user adds the server before opening a link. This is, on one side, for security (imagine a phishing link hidden as a pad), and as well so the user can choose the settings for the server. Sharing a link to a pad is weird anyways, it is possible now, it is a good feature, but I guess most people will only click a link.

I'd like to have, at least, some other possibility that solves these questions too. I need to investigate a bit more, I'll appreciate any help.

rugk commented 8 years ago

IMHO that PadLand takes all URLs is pretty annoying as now my default browser is not used but Android just often asks me whether to open this with PadLand. Can't we at least disable this feature (to open custom Etherpad URLs)?

mikifus commented 7 years ago

Hi,

I made a new alpha release with a new feature and, as @rugk asked, I removed the code that asked to open any url. https://github.com/mikifus/padland/releases/tag/v1.2.2-alpha

smichel17 commented 7 years ago

@mikifus Could you elaborate on why my solution makes padland hard to fork? To me it seems like:

rugk commented 7 years ago

IMHO @smichel17 idea is quite well. At least if the servers can be added easily (just an XML or JSON or even TXT file - one entry per line - to edit e.g.). This would be quite similar than the rulesets in HTTPS Everywhere. As in HTTPS Everywhere you could use Travis to check the file if necessary.

mikifus commented 7 years ago

@smichel17 Ok, let's try your way, I couldn't find anything better. If opening a custom server must be done via sharing, the app must notify users about this somehow.

@rugk Actually there is an XML with the info and the app actually requires it. Developers only need to check it out and sync with the AndroidManifest.xml

https://github.com/mikifus/padland/blob/master/app/src/main/res/values/etherpad_servers.xml

Right now, in the lastest alpha, this is the current behavior. Do you think it is adequate that I add some explanations about this all and make a new definitive version release? I'd upload a beta version to try first too.

rugk commented 7 years ago

Yes, explanation is very useful in any case.

mikifus commented 7 years ago

Hi all,

I made a beta release that explains the way to open custom server urls, more or less. I was inspired so I made a whole introduction activity with a simple slideshow. https://github.com/mikifus/padland/releases/tag/v1.3-beta

It still needs some tweaking, but this version is really good, so I ask you to find any small detail I can fix before releasing a new production ready version.

rugk commented 7 years ago

Nice. If you want to make more (or possibly better) intros you can also use this lib: https://github.com/IFTTT/JazzHands Although I have to admit that it may be too much for this app, but well... it's your choice.