Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 10-26-2013, 12:36 PM   #1
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Exploit custom dialog function: searching for help/hints

I've noticed between lipc commands this interesting one:

com.lab126.pillow customDialog

where Dialog is a writable string. I found then an html file that seems to be inherent to this command:

Filepath: /usr/share/webkit-1.0/pillow/sample_custom_dialog.html

And two javascript files too...

First: /usr/share/webkit-1.0/pillow/javascript/sample_custom_dialog.js:

And second: usr/share/webkit-1.0/pillow/strings/sample_custom_dialog_strings.js

Can somebody help me to exploit this and understand how to invoke properly the lipc command? If possible...

It would be cool to popup custom native dialogs in our programs

Thank you!

Last edited by Aeris; 10-27-2013 at 05:18 PM.
Aeris is offline   Reply With Quote
Old 10-27-2013, 01:41 AM   #2
aditya3098
Guru
aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.
 
Posts: 608
Karma: 1588610
Join Date: Jan 2012
Device: Kindle Scribe
It looks boolean...
aditya3098 is offline   Reply With Quote
Old 10-27-2013, 01:44 AM   #3
aditya3098
Guru
aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.aditya3098 ought to be getting tired of karma fortunes by now.
 
Posts: 608
Karma: 1588610
Join Date: Jan 2012
Device: Kindle Scribe
com.lab126.pillow
w Str keyboardGetSurround
w Str dismissChrome
w Str keyboardCommit
w Str disableEnablePillow
w Str searchResults
w Str customDialog
w Str keyboardReplace
w Str keyboardSetPreeditString
w Str keyboardDelete
rw Str logLevel
w Str activityIndicator
w Str debugInfo
rw Str logMask
w Str displayChrome
w Str interrogatePillow
w Str configureChrome
w Str pillowAlert
aditya3098 is offline   Reply With Quote
Old 10-27-2013, 02:47 AM   #4
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Don't know... maybe it could receive some parameters through "interrogatePillow" etc... And also strings doesn't seem to mean always true or false value values
Aeris is offline   Reply With Quote
Old 10-27-2013, 07:41 AM   #5
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Pure guess, but it works. I didn't look at its internals and don't know anything about possible additional parameters, except dialog's name.
Code:
lipc-set-prop com.lab126.pillow customDialog '{"name": "sample_custom_dialog"}'
To hide it:
Code:
lipc-set-prop com.lab126.pillow interrogatePillow '{"pillowId": "sample_custom_dialog", "function": "nativeBridge.dismissMe()"}'
(There should be another, official way to close Pillow windows from shell prompt, but it's all I can come to ATM.) I believe, I was wrong. There is no common method to close Pillow windows via LIPC (except nativeBridge.dismissMe function).

I don't know how about PW, but KT's pillow looks for HTML files, dialogs included, also at /usr/local/tests/pillow (tested on 5.3.2.1).

UPD: ha, I've just found my old notes about Pillow regarding customDialog property:
Code:
/usr/local/tests/pillow (fallback of /usr/share/webkit-1.0/pillow)

To load stock Pillow scripts from HTML placed in fallback location:
<script src="///usr/share/webkit-1.0/pillow/javascripts/sample_custom_dialog.js">

To show example.html:
lipc-set-prop com.lab126.pillow customDialog '{"name": "example"}'

To show example/index.html
lipc-set-prop com.lab126.pillow customDialog '{"name": "example/index"}'

To set parameters:
lipc-set-prop com.lab126.pillow customDialog '{"name": "sample_custom_dialog", "clientParams": {"dismiss": true}}'
sample_custom_dialog handles dismiss parameter and closes itself on receiving it.

Last edited by eureka; 10-27-2013 at 08:11 AM.
eureka is offline   Reply With Quote
Old 10-27-2013, 09:42 AM   #6
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
I knew I could count on you, Eureka! Thank you so much! Last command tested and work beautifully

Now I've just to play with it for a while to discover the best way to exploit it.

The simplest one could be to use it in a unconventional manner, i.e. for blocking user input on eips full screen prints (just invoke lipc-set-prop com.lab126.pillow customDialog '{"name": "sample_custom_dialog", "clientParams": {"dismiss": true}}' before and after executing your eips script).

For example in Midori splash animation...

EDIT: It doesn't work well unless you manage to open a very little custom dialog, lets say 1x1 px... otherwise if the user clicks in the popup area it will appear cleaning the eipsed area

Then I'll see how to use it in a proper manner, as custom dialogs displayer
Attached Thumbnails
Click image for larger version

Name:	screenshot_2013_10_27T15_41_01+0200.png
Views:	345
Size:	24.4 KB
ID:	114060  

Last edited by Aeris; 10-27-2013 at 10:21 AM.
Aeris is offline   Reply With Quote
Old 10-27-2013, 09:51 AM   #7
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Work fine on PW. just to give feedback.
twobob is offline   Reply With Quote
Old 10-27-2013, 10:06 AM   #8
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
The simplest use could be maybe to inject javascript as Eureka did for the battery widget into sample_custom_dialog, overriding the original html test with the one we need. Maybe could be added some buttons too in this way...

Just creating a simple Yes/no statement window would be a nice point to start


Quote:
I don't know how about PW, but KT's pillow looks for HTML files, dialogs included, also at /usr/local/tests/pillow (tested on 5.3.2.1).
I've tried to copy sample_custom_dialog.html into sample_custom_dialog2.html in that folder but doesn't seems to work on paperwhite (I invoked it with lipc-set-prop com.lab126.pillow customDialog '{"name": "sample_custom_dialog2.html"}')

Last edited by Aeris; 10-27-2013 at 10:11 AM.
Aeris is offline   Reply With Quote
Old 10-27-2013, 11:17 AM   #9
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Pay attention to examples, you did it wrong.
eureka is offline   Reply With Quote
Old 10-27-2013, 11:37 AM   #10
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Ok, I will! I wrote an html where not needed... but I've tried also without .html and still not detected

I'm watching a lot to your examples, this one and battery one... now I'm trying to find a way to set "display:visible" instead of "none" by javascript, to an element without id...

I managed to achive this only by hand, editing the value in the original sample_custom_dialog file... results seem pretty promising:

If well understood maybe this could be used to set up many bash scripts for KUAL

Anyway, if custom dialogs aren't used from any system app, editing this file should be safe too I think
Attached Thumbnails
Click image for larger version

Name:	screenshot_2013_10_27T17_32_28+0200.png
Views:	265
Size:	13.4 KB
ID:	114064  

Last edited by Aeris; 10-27-2013 at 11:44 AM.
Aeris is offline   Reply With Quote
Old 10-27-2013, 12:02 PM   #11
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
You shouldn't edit this concrete file or use interrogatePillow to get something useful to display with customDialog property.

Pillow concatenates /usr/share/webkit-1.0/pillow/ string with name string and then the result is concatenated again with .html string. Then Pillow tries to load file by resulting path. Do you understand how it works now?

Does
Code:
strings /usr/lib/libpillow.so | grep local
command output contain /usr/local/tests/pillow/?
eureka is offline   Reply With Quote
Old 10-27-2013, 12:05 PM   #12
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
[root@kindle root]# strings /usr/lib/libpillow.so | grep local
Quote:
setlocale
/usr/local/tests/pillow/
enable-html5-local-storage
localeChange
com.lab126.locale
Aye Captain
twobob is offline   Reply With Quote
Old 10-27-2013, 12:08 PM   #13
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Yes, it does... but I tought it tried to search html in /usr/local/tests/pillow/ when it could not find them in /usr/share/webkit-1.0/pillow/

Code:
You shouldn't edit this concrete file or use interrogatePillow to get something useful to display with customDialog property.
Is there any other choice?
Aeris is offline   Reply With Quote
Old 10-27-2013, 12:11 PM   #14
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
possibly stracing it's ACTUAL searched execution pathS would be illuminating?

Last edited by twobob; 10-27-2013 at 12:40 PM.
twobob is offline   Reply With Quote
Old 10-27-2013, 12:20 PM   #15
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by Aeris View Post
Yes, it does... but I tought it tried to search html in /usr/local/tests/pillow/ when it could not find them in /usr/share/webkit-1.0/pillow/
If it outputs /usr/local/tests/pillow, then it uses it. Probably, for searching of HTML files to display. At least, on KT it does. And yes, Pillow uses this directory as fallback choice. /usr/share/webkit-1.0/pillow/ is the default location.

Quote:
Originally Posted by Aeris View Post
Code:
You shouldn't edit this concrete file or use interrogatePillow to get something useful to display with customDialog property.
Is there any other choice?
Yes. On setting customDialog property, put anything you want into name key. What file Pillow will load then?
eureka is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nesting Function arguments in custom columns da_jane Calibre 1 11-21-2012 02:48 PM
Can plugins have a custom UI dialog? kiwidude Plugins 9 01-03-2011 07:15 PM
Kindle Searching Function Question keegon Amazon Kindle 4 01-09-2010 01:19 PM
Will the web searching function always be available for free? raztaztwo Amazon Kindle 5 12-17-2007 09:31 AM
Serious exploit in Greasemonkey 0.4 Alexander Turcic Lounge 2 07-19-2005 04:59 AM


All times are GMT -4. The time now is 05:48 AM.


MobileRead.com is a privately owned, operated and funded community.