Commit Graph

40 Commits

Author SHA1 Message Date
adbenitez e7ab6fefca Merge remote-tracking branch 'upstream/master' 2023-07-21 23:06:54 +02:00
B. Petersen fd212aed03 webxdc: allow media from blob: and data: 2023-07-21 22:46:32 +02:00
adbenitez 35b081b046 fix bug in WebxdcActivity
* allow to open external links
* add window.webxdc.deltalab variable, set to true
* update version number
2023-07-06 20:15:31 +02:00
adbenitez 35b483e79e fix bug due to removed iframe wrapper 2023-07-04 13:56:58 +02:00
adbenitez d5441bd6ad add support for message type in webxdc.sendToChat() 2023-06-25 23:35:07 +02:00
adbenitez 0cebf1a3a7 disable loading progress bar (500FILL WebRTC protection) 2023-06-25 21:28:08 +02:00
adbenitez b6638cbefe add back check to onShowFileChooser() 2023-06-08 15:26:37 +02:00
adbenitez da7346b07d move the file chooser implementation to WebxdcActivity class 2023-06-08 13:33:55 +02:00
adbenitez d51fef5318 add extra checks on the Java side and improve check in the JavaScript side 2023-05-30 23:43:54 +02:00
adbenitez d100397530 update to recent changes in sendToChat API specs 2023-05-30 21:22:32 +02:00
adbenitez 3588c074f1 add webxdc.sendToChat() API 2023-05-29 17:03:44 +02:00
link2xt 66a2878a60 Set "X-DNS-Prefetch-Control: off" header 2023-04-09 17:21:27 +00:00
bjoern aae4e337cd fix receiving updates during runtime (#2471) 2023-02-09 22:38:18 +01:00
bjoern 01ebb166d7 add CSP to webxdc (#2466) 2023-02-05 15:23:24 +01:00
bjoern 563c0296fa Combined webxdc patches (#2465)
* re-applying patch from @Hocuri from #2458

* apply sandbox isolation patch from @WofWca

* wait for gc as suggested by @WofWca, @Simon-Laux and others

* Update res/raw/sandboxed_iframe_rtcpeerconnection_check.html

Co-authored-by: WofWca <wofwca@protonmail.com>

* Update res/raw/sandboxed_iframe_rtcpeerconnection_check.html

Co-authored-by: WofWca <wofwca@protonmail.com>

* improve progress bar, inspired by @Simon-Laux and @WofWca

* comment about the gist of setNetworkAvailable()

* unify url-loading; this cleans up things and makes adding CSP more straight-forward

---------

Co-authored-by: WofWca <wofwca@protonmail.com>
2023-02-05 14:45:45 +01:00
B. Petersen 4ba6daae21 Revert "Webxdc fixes"
This reverts commit 6afddd84fff659fa6d8f727f2bf388d0c504058d.
2023-02-03 13:18:05 +01:00
Hocuri 8281bf9489 Webxdc fixes (#2458)
This now fixes all the checks in the `test webxdc`, see the
Delta Chat group
2023-01-31 18:30:53 +01:00
bjoern 33a543328f Revert "create adaptive shortcuts" (#2379)
* Revert "create adaptive shortcuts"

This reverts commit 35dd8c905b.

The cut out is not the largets possible circle inside the square icon
(as for group images or avatars, diameter==height)
but a much smaller circle (diameter==~0.6*height),
resulting in too many information being left out.

Therefore, it is better to leave icon layout to the OS.

(to get an idea about the amount of cut out, see a circular logo,
eg. the hextris one)

* add comment why not to use createWithAdaptiveBitmap()
2022-09-08 17:46:34 +02:00
bjoern e39842c692 restricted webxdc internet access (#2378)
* allow webxdc internet access if the corresponding flag is set by core

* do not intercept requests when internetAccess is granted
2022-09-06 11:22:08 +02:00
adbenitez 35dd8c905b create adaptive shortcuts 2022-08-20 18:57:11 -04:00
bjoern 853000f8dc option to add webxdc apps to home screen (#2353)
* add 'Add to Home Screen' menus for webxdc apps

* make adding shortcut basically work

* avoid starting webxdc from foreign accounts

* recreate back stack, if possible

according to
https://developer.android.com/training/notify-user/navigation :
"When you start an activity from a notification,
you must preserve the user's expected navigation experience.
Tapping Back should take the user
back through the app's normal work flow to the Home screen [...]"

same seems to be true for shortcuts using the same class for constructing
the back stack.

the back stack is reconstructed for API 26 (Oreo, 2017) or newer,
for oder API `requestPinShortcut()`
only uses the top-level activity for the shortcut.
working around that is probably possible, but would be quite some effort in an
already complicated area and would result in bugs that are not so easy to see.

also, on these old androids, users are probably used to the no-back-stack
behaviour.

* show a warning if app was deleted

* add 'Add to Home Screen' also to gallery

beside chat- and webxdc-activity,
this is the third place where the webxdc is listed.

as adding may result in dialogs from the launcher,
we allow the option only for a single selected webxdc,
as otherwise a series of dialogs would pop up.

* show 'Done' toast short, this is what we are doing at all the other places when showing 'Done'
2022-08-15 11:30:14 +02:00
Asiel Díaz Benítez 8fc1f3b060 Merge pull request #2333 from deltachat/adb/webxdc-allow-mailto
allow to open mailto links inside webxdc documents
2022-07-06 07:08:27 -04:00
Hocuri 057fabc1a6 Also identify media type if there are unknown characters in the filename (#2329)
fix #2306
2022-07-06 12:58:49 +02:00
adbenitez bdefbe0055 allow to open mailto links inside webxdc documents 2022-07-06 06:31:39 -04:00
B. Petersen 22a5c0a448 directly remember source_code_url instead of a flag that it is available 2022-05-18 22:58:20 +02:00
B. Petersen 3aa30899a5 add 'Source Code' item to webxdc menu
the code is a tiny bit more complicated
as we keep the call to get_webxdc_info() in background
and also avoid a second call to get_webxdc_info().
2022-05-18 22:58:20 +02:00
B. Petersen 7d98aa066f update title when it might be changed 2022-05-17 11:15:58 +02:00
B. Petersen b7472982a5 show document name instead of webxdc name in title 2022-05-17 11:15:58 +02:00
B. Petersen 88b2acb69d swap order to 'WebxdcName - ChatName' 2022-05-14 12:56:48 +02:00
B. Petersen 8c88ea3bfb show context of Webxdc window
show the chat name in front of the webxdc name to
- prevent phishing (the window will not show just the name of your bank)
- give the user an idea about where the webxdc sends messages to
  (important eg. when using the same webxdc from different chats)
2022-05-14 12:56:48 +02:00
adbenitez e24a72de61 set baseURL 2022-05-03 07:21:49 -04:00
Asiel Díaz Benítez 35a535705b Update src/org/thoughtcrime/securesms/WebxdcActivity.java
Co-authored-by: bjoern <r10s@b44t.com>
2022-05-03 06:53:16 -04:00
adbenitez 47190896d2 webxdc: allow internal pages and open some known schemes externally 2022-05-03 06:36:23 -04:00
Asiel Díaz Benítez e1379e41aa add account id to webxdc-fake-url (#2243) 2022-03-23 11:16:38 +01:00
bjoern eb2c06cd25 enable Window.sessionStorage, Window.localStorage and IndexedDB APIs (#2221)
* enable Window.sessionStorage, Window.localStorage and IndexedDB APIs

* scope localStorage per message

when using a custom scheme as `webxdc`,
different messages will share the same localStorage,
even though different domains are in use.

not sure if that is an Android bug, however,
using `https` as the scheme scopes messages correctly,
so we are just using that.
2022-03-04 20:37:43 +01:00
bjoern adf02b50e5 adapt js to new webxdc-update-api (#2223)
* adapt js to new webxdc-update-api

* the stub implementation of getAllUpdates() must still return a Promise

* reword parameters of getStatusUpdates()
2022-03-04 20:23:56 +01:00
bjoern ee47563f3d avoid caching resources between webxdc apps (#2205) 2022-01-27 12:07:34 +01:00
bjoern c205a1692e webxdc: warn when the app tries sendUpdate() and the user cannot send (#2199)
* show a warning when trying to sendUpdate() for contact requests or other chats the user cannot send to

* add missing 'Start...' translation
2022-01-22 22:11:29 +01:00
Asiel Díaz Benítez eb25a5e78c add "developer mode" preference (#2196)
* add "developer mode" preference

* activate WebContentsDebugging also after restart

as the preference option is persisted,
we should call setWebContentsDebuggingEnabled() not only on flag changes.

* capitalize option name, shorter description

* prefer 'can' over 'may'; the latter is very formal

* add Prefs.isDeveloperModeEnabled()

Co-authored-by: B. Petersen <r10s@b44t.com>
2022-01-22 11:01:48 +01:00
bjoern 9e70aa7cad webxdc (#2174)
* add new w30 APIs

* create the webview,
disable internet access,
inject deltachat.js

* connect deltachat to the webview

* promisify api

* use msgActionButton to start the w30 apps

* cleanup

- create observers in onCreate() to avoid memory leak,
- derive from WebViewActivity to easier deal with particularities
  and to saves >100 loc
- reorder some methods to reflect lifetimes

* make it more clear, which uri-part is 'domain' and which one is 'path'

* unify logging

* it is 'statusUpdate' not 'stateUpdate'; not sure if promise is needed at the end, we can readd that as needed, simple code for now

* use core implementation for status updates

* disable debugging enabled by default, streamline code

* use same name for InternalJSApi for both, js and java

* getStatusUpdates() always return an array

* call JSON.stringify() on payload

* fix typo, fix equal operator

* use shorter function names in js land

* adapt to new zipped w30 format

* load any file from w30 archives

* add fallback if getMimeTypeFromExtension() fails

* rename w30 to webxdc

* add selfName()

* return selfAddr() if selfName() is empty

* rename deltachat.js to webxdc.js

* observer correct event

* rename getBlobFromArchive() to getWebxdcBlob()

* show webxdc app name in title bar

* swap payload and descr in sendUpdate() (adapt to new core api)

* allow user-defined-texts for webxdc apps, make room for icon+name

* show webxdc icon and name in chats

* render webxdc drafts accordingly

* allow configuring drafts

* do not destroy webxdc-message to be sent out by removing it via setDraft(null)

* fix crash when replying to webxdc messages

* add webxdc messages to profile's document tab

* hide 'search menu' for webxdc apps

* show app summary beside app icon

* remove outdated comment

* add precautious WebView restrictions

* Update src/org/thoughtcrime/securesms/ConversationItem.java

Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>

* Update src/org/thoughtcrime/securesms/ConversationItem.java

Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>

* Update src/org/thoughtcrime/securesms/ConversationActivity.java

Co-authored-by: Hocuri <hocuri@gmx.de>

* Webxdc requires at least Android 5 Lollipop

see https://github.com/deltachat/deltachat-android/pull/2174#discussion_r785436874

* recognize .xdc files on android10

based on @Hocuri's findings in #2188

Co-authored-by: Simon Laux <mobile.info@simonlaux.de>
Co-authored-by: adbenitez <asieldbenitez@gmail.com>
Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>
Co-authored-by: Hocuri <hocuri@gmx.de>
2022-01-18 10:52:09 +01:00