Added manpage
All checks were successful
the build was successful

This commit is contained in:
tastytea 2019-01-31 18:01:15 +01:00
parent 32fbdf7375
commit 1ba5d4e444
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
5 changed files with 117 additions and 43 deletions

View File

@ -17,7 +17,7 @@ pipeline:
- echo "deb http://deb.debian.org/debian sid main" >> /etc/apt/sources.list.d/sid.list
- apt-get update -q
- apt-get install -qy build-essential cmake pkg-config
- apt-get install -qy libjsoncpp-dev libcurl4-openssl-dev libxdg-basedir-dev
- apt-get install -qy libjsoncpp-dev libcurl4-openssl-dev libxdg-basedir-dev asciidoc
- apt-get install -qy -t sid libcurlpp-dev
- dpkg -i mastodon-cpp.deb
- rm -rf build && mkdir -p build && cd build
@ -43,7 +43,7 @@ pipeline:
- apt-get update -q
- apt-get install -qy build-essential cmake pkg-config
- apt-get install -qy -t xenial g++-7
- apt-get install -qy libjsoncpp-dev libcurl4-openssl-dev libxdg-basedir-dev
- apt-get install -qy libjsoncpp-dev libcurl4-openssl-dev libxdg-basedir-dev asciidoc
- apt-get install -qy -t sid libcurlpp-dev
- dpkg -i mastodon-cpp.deb
- rm -rf build && mkdir -p build && cd build
@ -69,7 +69,7 @@ pipeline:
- apt-get update -q
- apt-get install -qy build-essential cmake pkg-config
- apt-get install -qy -t xenial g++-8
- apt-get install -qy libjsoncpp-dev libcurl4-openssl-dev libxdg-basedir-dev
- apt-get install -qy libjsoncpp-dev libcurl4-openssl-dev libxdg-basedir-dev asciidoc
- apt-get install -qy -t sid libcurlpp-dev
- dpkg -i mastodon-cpp.deb
- rm -rf build && mkdir -p build && cd build

View File

@ -47,3 +47,16 @@ target_link_libraries(expandurl-mastodon
${CURLPP_LIBRARIES} ${JSONCPP_LIBRARIES}
${LIBXDG_BASEDIR_LIBRARIES} mastodon-cpp pthread stdc++fs)
install(TARGETS expandurl-mastodon DESTINATION ${CMAKE_INSTALL_BINDIR})
set(WITH_MAN "YES" CACHE STRING "WITH_MAN defaults to \"YES\"")
if (WITH_MANPAGE)
add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.1"
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
DEPENDS "${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.1.adoc"
COMMAND ${CMAKE_SOURCE_DIR}/build_manpage.sh
ARGS ${PROJECT_VERSION})
add_custom_target(run ALL
DEPENDS "${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.1")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
endif()

View File

@ -21,13 +21,15 @@ or to [@tastytea@soc.ialis.me](https://soc.ialis.me/@tastytea).
## Dependencies
* Tested OS: Linux
* C++ compiler (tested: gcc 6/7/8)
* [cmake](https://cmake.org/) (tested: 3.9 / 3.11)
* [curlpp](http://www.curlpp.org/) (tested: 0.8)
* [mastodon-cpp](https://schlomp.space/tastytea/mastodon-cpp) (at least: 0.30)
* [jsoncpp](https://github.com/open-source-parsers/jsoncpp) (tested: 1.8 / 1.7)
* [libxdg-basedir](http://repo.or.cz/w/libxdg-basedir.git) (tested: 1.2)
* Tested OS: Linux
* C++ compiler (tested: gcc 6/7/8)
* [cmake](https://cmake.org/) (tested: 3.9 / 3.11)
* [curlpp](http://www.curlpp.org/) (tested: 0.8)
* [mastodon-cpp](https://schlomp.space/tastytea/mastodon-cpp) (at least: 0.30)
* [jsoncpp](https://github.com/open-source-parsers/jsoncpp) (tested: 1.8 / 1.7)
* [libxdg-basedir](http://repo.or.cz/w/libxdg-basedir.git) (tested: 1.2)
* Optional:
* Manpage: [asciidoc](http://asciidoc.org/) (tested: 8.6)
## Get sourcecode
@ -54,39 +56,7 @@ Install with `make install`.
# Usage
**The config file has changed from cfg to JSON in 0.4.0.**
Start expandurl-mastodon without parameters.
If no config file is found, you will be asked to provide your account address
and an access token is generated. The config file can be found in
`${HOME}/.config/expandurl-mastodon.json` and looks like this:
```JSON
{
"account": "expandurl@example.social",
"access_token": "abc123",
"proxy":
{
"url": "socks5h://[::1]:1080/",
"user": "user23",
"password": "supersecure"
},
"replace" :
{
"//amp\\." : "//",
"[\\?&]__twitter_impression=[^&]+" : "",
"[\\?&]utm_[^&]+" : "",
"[\\?&]wt_zmc=[^&]+" : "",
"[\\?&]wtmc=[^&]+" : ""
}
}
```
If you want to use a proxy or define your own replacements, you have to edit the
configuration file manually. After the configuration file is generated, you can
start expandurl-mastodon as
daemon.
Have a look at the [manpage](https://schlomp.space/tastytea/expandurl-mastodon/src/branch/master/expandurl-mastodon.1.adoc).
# Copyright

12
build_manpage.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
name="expandurl-mastodon"
if [ -n "${1}" ]; then
dir="$(dirname ${0})"
cp -vf "${dir}/${name}.1.adoc" .
sed -Ei "s/(Revision: +)[0-9]+\.[0-9]\.[0-9]/\1${1}/" "${name}.1.adoc"
a2x --doctype manpage --format manpage --no-xmllint "${name}.1.adoc"
else
echo "usage: ${0} VERSION" >&2
fi

79
expandurl-mastodon.1.adoc Normal file
View File

@ -0,0 +1,79 @@
= expandurl-mastodon(1)
:Author: tastytea
:Email: tastytea@tastytea.de
:Date: 2019-01-31
:Revision: 0.0.0
:man source: expandurl-mastodon
:man version: {revision}
:man manual: General Commands Manual
== NAME
expandurl-mastodon - Mastodon bot that expands shortened URLs.
== SYNOPSIS
*expandurl-mastodon*
== DESCRIPTION
If you want the bot to expand an URL, reply to the post with the URL in it and
mention the bot account.
This bot uses the same visibility as you, but posts unlisted instead of public.
It retains the sensitive flag and spoiler warnings.
Some tracking parameters, like those beginning with
https://en.wikipedia.org/wiki/UTM_parameters[utm_] are stripped. It also tries
to rewrite https://en.wikipedia.org/wiki/Accelerated_Mobile_Pages[AMP] URLs to
point at the real webpages.
== CONFIGURATION
If no config file is found, you will be asked to provide your account address
and an access token is generated. The config file can be found in
`${XDG_CONFIG_HOME}/expandurl-mastodon.json` and looks like this:
[source,json]
----
{
"account": "expandurl@example.social",
"access_token": "abc123",
"proxy":
{
"url": "socks5h://[::1]:1080/",
"user": "user23",
"password": "supersecure"
},
"replace" :
{
"//amp\\." : "//",
"[\\?&]__twitter_impression=[^&]+" : "",
"[\\?&]utm_[^&]+" : "",
"[\\?&]wt_zmc=[^&]+" : "",
"[\\?&]wtmc=[^&]+" : ""
}
}
----
If you want to use a proxy or define your own replacements, you have to edit the
configuration file manually. After the configuration file is generated, you can
start expandurl-mastodon as daemon.
== FILES
[format="csv",frame="none",grid="none",cols=">,<"]
|======
Configuration file:,`${XDG_CONFIG_HOME}/expandurl-mastodon.json`
|======
`${XDG_CONFIG_HOME}` is usually `~/.config`.
== REPORTING BUGS
[format="csv",frame="none",grid="none",cols=">,<"]
|======
Bugtracker:,https://schlomp.space/tastytea/expandurl-mastodon/issues
E-mail:,tastytea@tastytea.de
Fediverse:,https://soc.ialis.me/@tastytea
|======