Skip Navigation

Posts
0
Comments
198
Joined
2 yr. ago

  • Your example was probably not a real case, but I checked with my swiftkey and after "Roman" it suggested "reigns" "catholic" and "Empire"

  • I meant to communicate that the Redirector addon uses the given pattern to see if the entire URL string matches, not part of it. So the malicious URL does not match.

    I'm wondering if there's a real URL for which the Redirector approach will not work.

  • I'm not trying to be combative, I'm trying to understand. I'd like to see the failure in action so I can appreciate and pursue the proposed solution.

    But when I added the community bit to the first URL, the browser resolved it and stripped the credentials, so the resulting URL matched. But the example credentials weren't real so it's not a great test; if there's an real example I can test, please share it. Though I don't see why I'd auth to an instance just to view it from a different instance.

    When I added the community bit to the second URL, it was not a match, as it shouldn't be. The pattern must match the entire URL.

  • HtTpS://user:pw@lemdro.id:443 is a valid url to lemdro.id and should match but will not

    Well that one:

    • technically shouldn't match, because it's not a community URL
    • is not the form I expect and want to be using for this case
    • may actually work (if it were a real community link, which again, it's not), because after authentication I think the browser strips the credentials

    Http://maliciouswebsite.to/?q=http://lemdro.id will match but should not

    No, it does not match.


    AFAICT, this solution is working properly, but if you can find a URL that breaks it, please let me know.

  • Can you provide an example URL that breaks this solution?

  • I just posted this on the post you linked, but yeah I am hardcoding a list of instances into my solution. Here's my comment, copied:


    I'm using the Firefox addon Redirector, and one of my rules there redirects community links using regex. I keep adding to the pattern as I encounter more instances. Currently it's:

     
        
    Pattern: https://(lemdro\.id|lemmy\.run|beehaw\.org|lemmy\.ml|sh\.itjust\.works|lemmy\.fmhy\.ml|lemmy\.dbzer0\.com|lemmy\.world|sopuli\.xyz|lemmy\.kde\.social|lemmygrad\.ml|mander\.xyz|lemmy\.ca|zerobytes\.monster)/c/(.*)
    
      
     
        
    Redirect to: https://programming.dev/c/$2@$1
    
      
  • I'm using the Firefox addon Redirector, and one of my rules there redirects community links using regex. I keep adding to the pattern as I encounter more instances. Currently it's:

     
        
    Pattern: https://(lemdro\.id|lemmy\.run|beehaw\.org|lemmy\.ml|sh\.itjust\.works|lemmy\.fmhy\.ml|lemmy\.dbzer0\.com|lemmy\.world|sopuli\.xyz|lemmy\.kde\.social|lemmygrad\.ml|mander\.xyz|lemmy\.ca|zerobytes\.monster)/c/(.*)
    
      
     
        
    Redirect to: https://programming.dev/c/$2@$1
    
      
  • Note that the tag functionality only works if you also use Baloo, their file indexer.

  • Thanks again for posting your improvements! I will have them!

    The idea here, checking for newline characters rather than counting lines, is to prevent it treating one line that is so long it wraps to the next as counting as a multiline input, right? So now I'm looking like

    EDIT: lemmy is at least mangling ampersands here. Hard to believe it doesn't have proper code blocks yet...

     
        
    # -- Run input if single line, otherwise insert newline --
    # Key: enter
    # Assumes: setopt interactivecomments
    # Credit: https://programming.dev/comment/2479198
    .zle_accept-except-multiline () {
      if [[ $BUFFER != *$'\n'* ]] {
        zle accept-line
        return
      } else {
        zle self-insert-unmeta
        if [[ $BUFFER == *$'\n'*$'\n'* ]] {
          local hint="# Use alt+enter to submit this multiline input"
          if [[ $BUFFER != *${hint}* ]] {
            LBUFFER+=$hint
            zle self-insert-unmeta
          }
        }
      }
    }
    zle -N .zle_accept-except-multiline
    bindkey '^M' .zle_accept-except-multiline  # Enter
    
    # -- Run input if multiline, otherwise insert newline --
    # Key: alt+enter
    # Credit: https://programming.dev/comment/2479198
    .zle_accept_only_multiline () {
      if [[ $BUFFER == *$'\n'* ]] {
        zle accept-line
      } else {
        zle self-insert-unmeta
      }
    }
    zle -N .zle_accept_only_multiline
    bindkey '^[^M' .zle_accept_only_multiline  # Enter
    
      

    For pushing the line/multiline, I combine it with my clear function (ctrl+l):

     
        
    # -- Refresh prompt, rerunning any hooks --
    # Credit: romkatv/z4h
    .zle_redraw-prompt () {
      for 1 ( chpwd $chpwd_functions precmd $precmd_functions ) {
        if (( $+functions[$1] ))  $1 &>/dev/null
      }
      zle .reset-prompt
      zle -R
    }
    
    # -- Better Screen Clearing --
    # Clear line and redraw prompt, restore line at next prompt
    # Key: ctrl+l
    # Depends: .zle_redraw-prompt
    .zle_push-line-and-clear () { zle push-input; zle clear-screen; .zle_redraw-prompt }
    zle -N       .zle_push-line-and-clear
    bindkey '^L' .zle_push-line-and-clear  # ctrl+l
    
      
  • PSA: As is commonly recommended, watch the director's cut if you can, especially if it's your first time. The main difference is that the regular release has a voice over in the beginning explaining a lot (too much).

  • I started using this, it makes a lot of sense and I like it, thanks!

    I can imagine myself forgetting how to accept multiline input with alt+enter, so I added a help message to _zle_ml_enter in the multiline case after the second line. It assumes setopt interactivecomments is already set:

    EDIT: note that lemmy mangles the less-than symbol

     
        
    # -- Run input if single line, otherwise insert newline --
    # Key: enter
    # Assumes: setopt interactivecomments
    # Credit: https://programming.dev/comment/2479198
    .zle_accept-except-multiline () {
      if (( BUFFERLINES <= 1 )) {
        zle accept-line
      } else {
        zle self-insert-unmeta
        if (( BUFFERLINES == 2 )) {
          LBUFFER+="# Use alt+enter to submit this multiline input"
          zle self-insert-unmeta
        }
      }
    }
    zle -N .zle_accept-except-multiline
    bindkey '^M' .zle_accept-except-multiline  # Enter
    
      
  • I think that title's unfair, and that the approaches advocated by Strong Towns are probably closer to small-government Georgism, or Georgist municipalism.

    The fact that the folks behind it identify as conservative is indeed a reason to, well, stay sharp and skeptical, but I think their flavor of conservatism is actually in direct conflict with most Americans who identify as such. Sort of like these folks actually believe what's commonly used as distracting rhetoric.

    Then again, I'm probably outside the main demographic of this community, I'm critical of big centralized power, and I'm a fan of both urbanism and land value taxation, so I get it if you judge that I've been had here.

  • Do you know why it wasn't deemed a gatekeeper?

  • Does the law apply to Telegram the same way? If not, why not?

  • Wezterm, which does everything, with a great developer behind it.

    Second choice is Konsole: super solid and great rendering.

    Aaand tmux with either of those.