Skip to content
PeGaSuS edited this page Dec 25, 2021 · 7 revisions

You can share images, videos, and other files in three ways:

  • By tapping (or pressing and holding to take a photo 📷) the paperclip button in the app
  • By tapping share buttons in other apps and choosing Weechat-Android
  • By choosing media such as gifs using your software keyboard

When you choose files in any of these ways, the app will place the according thumbnails into the input field. When you tap the upload button, it will upload them to a HTTP server of your choice using POST. When the uploads complete, the app will replace the thumbnails with the according HTTP URLs. After all files have been uploaded, you can send the message.

The files are uploaded in parallel. You can minimize the app or continue chatting in other buffers while uploads are running. You can cancel uploads by pressing on the cancel button or by deleting the thumbnails from the input field. If you try to upload the same file several times—at the same time or later on but during the time specified by the setting “Remember uploads for”—the file will only be uploaded once and the resulting URL will be the same.

Configuring client

You can use most services that support uploading using HTTP POST and return results in plaintext or anything that is parsable using regular expressions. At the time parsing JSON or XML responses is not supported.

The settings in the application roughly correspond to the following command:

curl -s --user user:pass \
  --header 'Additional: Header' \
  --form additional=field \
  --form file=@file.ext \
  https://example.com |
  perl -nle 'm#^https://\S+#; print $1//$&'

In this example:

  • Upload URL is https://example.com
  • File field is file
  • Regex is ^https://\S+
  • Additional headers are Additional: Header. You can specify several headers on separate lines; name and value must be separated by :  (that's a colon followed by a space)
  • Additional fields are additional=field. You can specify several headers on separate lines; name and value must be separated by =
  • Authentication is Basic; User and Password are user and pass accordingly

The Regex option can work in three ways:

  • If not set, the whole response body is used as the URL
  • If set and lacks capturing groups, the response body is searched using the regex, and the whole match is used as the URL
  • If set and has capturing groups, the response body is searched using the regex, and the first capturing group is used as the URL

You can also configure the way the paperclip button chooses images in Button settings. Between the different Android versions the action can vastly vary, so you might want to try alternative options to see the one that works best for you!

Setting up your own upload service

If you have a web server on your own, you can use it as an upload service for the app. There are plenty of frameworks that can do this. Some of these are:

Using third-party services

Not all services work with Weechat-Android, but you can find plenty of those that do. You can try looking at compatible services in the list of custom ShareX uploaders, or by searching for pomf clones.

Here are some example configurations for some of the popular services. Please make sure you familiarize yourself with terms of use of the service that you are using!

  • x0.at (uses Single .php Filehost by Rouji)

    • Upload URL: https://x0.at
  • 0x0.st (uses The Null Pointer by mia-0)

    • Upload URL: https://0x0.st
  • ttm.sh

    • Upload URL: https://ttm.sh
  • imgur (only images) (Reference)

    • Upload URL: https://api.imgur.com/3/upload
    • File field: image
    • Regex: https://i.imgur.com/\w+\.\w+
    • Additional headers: Authorization: Client-ID <your client id> (if anonymous) or Authorization: Bearer <access token> (if authenticated)
  • catbox.moe

    • Upload URL: https://catbox.moe/user/api.php
    • File field: fileToUpload
    • Additional fields: reqtype=fileupload
  • litterbox.catbox.moe (temporary uploads)

    • Upload URL: https://litterbox.catbox.moe/resources/internals/api.php
    • File field: fileToUpload
    • Additional fields (you can use 1h, 12h, 24h, 72h):
      reqtype=fileupload
      time=72h
      
Clone this wiki locally