Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: pastebin #329

Merged
merged 3 commits into from Apr 13, 2017
Merged

Feature: pastebin #329

merged 3 commits into from Apr 13, 2017

Conversation

jhthorsen
Copy link
Collaborator

@jhthorsen jhthorsen commented Apr 3, 2017

This PR implements a pastebin internally to Convos. It is implemented in the backend, meaning that a given connection class can detect a long message and dispatch it to the "paste-service". This is done automatically, without asking the user.

The nice thing is that it's implemented as a plugin, so if someone wants to make a "gist" backend, then it shouldn't be too hard.

This is how you enter a paste:

screen shot 2017-04-04 at 09 19 33

This is how it looks to a Convos user: (The paste is embedded using LinkEmbedder.pm)

170404-convos-pastebin-linkembedder

This is how it looks if you open the link in a browser: (The link is available from the public)

Note also that the paste support syntax highlighting, using https://highlightjs.org/

170404-convos-pastebin-public

@@ -8,4 +8,6 @@ $t->get_ok('/x/request/base')->status_is(200)->content_is('/foo');
$t->get_ok('/x/request/base', {'X-Request-Base' => 'http://example.com/sub'})->status_is(200)
->content_is('/sub/foo');

like $t->app->core->base_url, qr{^http://example\.com}, 'core base_url';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should check that path is /sub for base_url

sub {
my ($backend, $err, $file) = @_;
return $self->$cb($err) if $err;
my $url = $self->user->core->base_url->clone->path($file->uri);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to use base_url as base, not basis for created url.

}

package # \
Convos::Plugin::Paste::File;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ugly 👎

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest making this a public class.

@jhthorsen jhthorsen dismissed marcusramberg’s stale review April 13, 2017 10:14

I don't understand why it's not resolved after I pushed the new changes.

@jhthorsen jhthorsen merged commit 8d5be29 into master Apr 13, 2017
@jhthorsen jhthorsen deleted the feature/pastebin branch April 13, 2017 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants