nocin.eu

Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[Mint] Installing KDE Plasma Desktop on Linux Mint 19.2 Cinnamon

sudo add-apt-repository ppa:kubuntu-ppa/backports
sudo apt upgrade
sudo aptitude install --with-recommends kubuntu-desktop

Without the “recommends” you’ll get some errors about missing dependencies like here:

The following packages have unmet dependencies:  kubuntu-desktop : Depends: software-properties-kde but it is not going to be installed

Because Linux Mint 19.2 is based on Ubuntu 18.04., the Kubuntu backports only provides Plasma Version 5.12.19.
Ubuntu 18.04 contains Qt Version 5.9.5 and Plasma 5.13 will need at least Qt 5.10.
You can check the current Qt and Plasma version with

kinfocenter

[ABAP] Radiobutton with label (comment) and input field

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-b01.

* Schnittstelle
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: p_server RADIOBUTTON GROUP rad1.
SELECTION-SCREEN COMMENT 6(26) text-t01 FOR FIELD p_server.
PARAMETERS: p_sname(8) TYPE c DEFAULT ''. 
SELECTION-SCREEN END OF LINE.

* Filename (optional)
PARAMETERS: p_fname TYPE j_3sdsn.

* Lokale Datei
PARAMETERS: p_local  RADIOBUTTON GROUP rad1 DEFAULT 'X'.
* Dateiauswahl
PARAMETERS: p_up     TYPE dxfile-filename DEFAULT ''.

SELECTION-SCREEN END OF BLOCK b1.

[Mint] Install Bitwarden-CLI on Linux Mint 19.2 Cinnamon

Find their Github here and their Documentation here. They recommend to install via NPM. So first we have to install the Node.js runtime if you have not yet.
If you follow the Node.js installation guide you would use:

sudo apt-get install curl python-software-properties
curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -

But this will lead into the following, since 19.2 Tina is not yet support (on 19.1 Tara it will run fine).

## Confirming "tina" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_12.x/dists/tina/Release'

## Your distribution, identified as "tina", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support

So we have to do it manually. I used this little how-to i found on Github:

# Add missing signature
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 1655A0AB68576280

# Replace misconfigured  sources file. Change version of node you like to have. 8/10/12
echo -e "deb https://deb.nodesource.com/node_10.x bionic main" | sudo tee /etc/apt/sources.list.d/nodesource.list
echo -e "deb-src https://deb.nodesource.com/node_10.x bionic main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list

# Update packages and install
sudo apt update
sudo apt install nodejs

Finally install Bitwarden-CLI with a single line.

sudo npm install -g @bitwarden/cli

Now you can login into Bitwarden. If you have enabled any two-step login method, you have to add the parameter “–method” and a specific value for the login in method you can find here. In my case “0”, as I’m using TOTP.

bw login --method 0

If you successfully logged in, you will get your session key and are able to read your passwords:

To unlock your vault, set your session key to the `BW_SESSION` environment variable. ex:
$ export BW_SESSION="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
> $env:BW_SESSION="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
You can also pass the session key to any command with the `--session` option. ex:
$ bw list items --session xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

[ABAP] Read SO10 Standard Text with Textsymbol replacement

METHOD read_text.

    DATA: lines   TYPE TABLE OF tline,
          header  TYPE THEAD,
          lt_text TYPE soli_tab.

    CALL FUNCTION 'READ_TEXT'
      EXPORTING
        id                      = 'ST'
        language                = sy-langu
        name                    = "Textname"
        object                  = 'TEXT'
      IMPORTING
        header                  = header
      TABLES
        lines                   = lines
      EXCEPTIONS
        id                      = 1
        language                = 2
        name                    = 3
        not_found               = 4
        object                  = 5
        reference_check         = 6
        wrong_access_to_archive = 7
        OTHERS                  = 8.
    IF sy-subrc <> 0.
    ENDIF.

   CALL FUNCTION 'INIT_TEXTSYMBOL'.

   CALL FUNCTION 'SET_TEXTSYMBOL'
      EXPORTING
        name    = '&MATNR&'
        value   = '00000001'
        replace = 'X'.

    CALL FUNCTION 'REPLACE_TEXTSYMBOL'
      EXPORTING
        endline   = lines( lines )
        startline = 1
      TABLES
        lines     = lines.

    CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
      EXPORTING
        language    = sy-langu
      TABLES
        itf_text    = lines
        text_stream = lt_text.

  ENDMETHOD.

[Nextcloud] Restrict access to your ONLYOFFICE Document Service to the users of your Nextcloud instance

Enable JWT token

Add a Token in you local.json file. If your running ONLYOFFICE on linux you will find the file here:

/etc/onlyoffice/documentserver/local.json

Set inbox, outbox and browser to true and add you token in the secret part for inbox, outbox and session. I just generated a random string via Bitwarden.

   "token": {
        "enable": {
          "request": {
            "inbox": true,
            "outbox": true
          },
          "browser": true
        },
        "inbox": {
          "header": "Authorization"
        },
        "outbox": {
          "header": "Authorization"
        }
      },
      "secret": {
        "inbox": {
          "string": "token_string"
        },
        "outbox": {
          "string": "token_string"
        },
        "session": {
          "string": "token_string"
        }

Save the file and run:

supervisorctl restart all

Go to your Nextcloud web interface, open your ONLYOFFICE App and add your token beneath your server url.

Configure IP Filter

Search in the following file for “ipfilter”:

/etc/onlyoffice/documentserver/default.json

Add you domain or IP to the IP rules. Disallow everything else. Use * as wildcard. Also set useforrequest to true.

"ipfilter": {
              "rules": [{"address": "url_or_ip", "allowed": true},
                        {"address": "*",         "allowed": false}],
              "useforrequest": true,
              "errorcode": 403
            },

Now run again:

supervisorctl restart all

And test if the service is reachable.

[ABAP] Read smartform textmodule

Oldschool:

    DATA(ls_languages) = VALUE ssfrlang( langu1 = sy-langu ).
    DATA(lt_text_stream) = VALUE soli_tab( ).

    CALL FUNCTION 'SSFRT_READ_TEXTMODULE'
      EXPORTING
        i_textmodule       = 'Z_SMARTFORM_TEXT'
        i_languages        = ls_languages
      IMPORTING
        o_text             = lt_text
      EXCEPTIONS
        error              = 1
        language_not_found = 2
        OTHERS             = 3.

    IF lt_text IS NOT INITIAL.

      CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
        EXPORTING
          language    = sy-langu
        TABLES
          itf_text    = lt_text
          text_stream = lt_object_content.

    ENDIF.

Newschool:

    TRY.
        DATA(lr_form) = NEW cl_ssf_fb_smart_form( ).
        lr_form->load( im_formname = 'ZECOS_GM_ERROR' ).

        DATA(ls_varheader) = lr_form->varheader[ 1 ].
        DATA(lr_node) = CAST cl_ssf_fb_node( ls_varheader-pagetree ).
        DATA(lr_text) = CAST cl_ssf_fb_text_item( lr_node->obj ).

        LOOP AT lr_text->text INTO DATA(ls_text).
          WRITE:/ ls_text-tdline.
        ENDLOOP.

      CATCH cx_ssf_fb.
      CATCH cx_sy_itab_line_not_found.
    ENDTRY.

[Jellyfin] Deleting files on a mounted dataset inside LXC

If you have installed Jellyfin inside LXC and have all your media mounted from a ZFS dataset inside your container, it’s possible that you are not able to delete files directly from the Jellyfin WebUi. In this case, you have to add the user “jellyfin” to a group with write access on your dataset. In my case, the group “nocin”.

usermod -a -G nocin jellyfin

[Shell] zsh-autosuggestions

Simple plugin to get autosuggestions from your history while typing in your Zsh shell. If you are using Oh My Zsh, the installtion is done in 3 steps. Look here.
Just grab the plugin:

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Add it in your ~/.zshrc (zsh config):

plugins=(zsh-autosuggestions)

And restart the terminal. Done.