1

Default Yourls doesn't allow url to be shorten in other scheme than http or https. But I want it to accept them, too. I am going to implement by adding custom plugin.

there is a function evaluating url input by users as bellow.

includes\functions.php

function yourls_add_new_link( $url, $keyword = '', $title = '' ) {
    // Allow plugins to short-circuit the whole function
    $pre = yourls_apply_filter( 'shunt_add_new_link', false, $url, $keyword, $title );
    if ( false !== $pre )
        return $pre;

    $url = yourls_encodeURI( $url );
    $url = yourls_sanitize_url( $url );
    if ( !$url || $url == 'http://' || $url == 'https://' ) {
        $return['status']    = 'fail';
        $return['code']      = 'error:nourl';
        $return['message']   = yourls__( 'Missing or malformed URL' );
        $return['errorCode'] = '400';
        return yourls_apply_filter( 'add_new_link_fail_nourl', $return, $url, $keyword, $title );
    }

I just don't know whether I can make it to allow other url scheme by adding plugin or not. Do you have any idea?

Herbert
  • 540
  • 1
  • 6
  • 18
  • I've never heard about Yourls but [read this](https://github.com/YOURLS/YOURLS/wiki/Custom-protocols), it looks relevant - They say you need to add something like `$yourls_allowedprotocols = array( 'http://', 'https://', 'facetime://' );` to your `config.php` file – Alon Eitan Sep 30 '20 at 15:20

0 Answers0