Git Product home page Git Product logo

kilink's Introduction

Kilink

Linkode is the useful pastebin!

It's a kind of "short living collaboration space", a "dynamic pastebin".

It's live right now in http://linkode.org/, give it a try!

Some awesome details:

  • you can create linkodes anywhere, whenever, and effortlessly.
  • editable texts, not static!
  • every new edition creates a child: you have a tree
  • code/text type automatic detection (and coloring!)
  • permanent linkodes (the owner can still remove them)
  • absolutely anonymous (unless you login, which is dead simple)
  • private URLs: because you can not guess UUIDs

There is a Telegram bot!

Try it here.

Note this bot has a project on its own, check it!

Collaboration

Code and issues is in GitHub:

https://github.com/facundobatista/kilink

We also have a mailing list:

http://listas.python.org.ar/mailman/listinfo/kilink

And you can also get help by IRC, in Freenode: #linkode

The API

Get the API details from the HTML file::

kilink/templates/_tools.html

In a future this will be in a Doc file (source of that HTML).

How To Try It In Development

Just using fades:

./run

Or creating the virtualenv by hand:

virtualenv kilink
cd kilink
git clone https://github.com/facundobatista/kilink.git
source bin/activate
pip install -r requirements.txt
PYTHONPATH=. python kilink/main.py

Or if you prefer to use Docker

docker build -t kilink .
docker run -it -p 5000:5000 kilink

To run the tests: in the virtualenv, do:

python -m pytest

How to Translate

When including translatable text in the code, make sure to always wrap it in the gettext function. Within templates it's already available and bound to _, e.g.:

<span>{{ _("Text to translate") }}</span>

In Python files you need to import it from Flask, e.g.:

from flask.ext.base import gettext as _

def views():
    flash( _("Text to translate") )

Later, to produce language catalogs:

  1. Extract the translation texts:

    cd kilink
    pybabel extract -F babel.cfg -o messages.pot translations
    
  2. Generate an individual language message catalog. E.g. for Italian (it) you would do:

    pybabel init -i messages.pot -d translations -l it

    That should leave a messages.po file nested under the directory specified by the given -d argument (e.g.: translations/it/LC_MESSAGES/messages.po);

  3. Open it in your favorite text editor and translate the collected messages;

  4. Repeat steps 1-3 for each target language;

  5. When finished, compile with:

    pybabel compile -d translations

  6. Finally, add the newly available languages to the config.py file, as follows:

    LANGUAGES = {
         ...
         'it': 'Italian',
         ...
     }
    

You'll need to follow again these steps each time you add or change some text in the code. See the Flask-Babel Tutorial for more on this subject.

How To Deploy With Apache

Documentation based in http://flask.pocoo.org/docs/deploying/mod_wsgi/

We use a virtualenv to deploy the project and apache virtual host on Ubuntu 13.04, This configuration es very general, I guess that works in almost all linux OS

Definitions:

  • Project path: /var/linkode_home/
  • Application path: /var/linkode_home/linkode_app
  • VirtualEnv Path: /var/linkode_home/linkode_virtualenv
  • User: www-data

Create virtualenv:

cd /var/linkode_home
virtualenv linkode_virtualenv
cd linkode_virtualenv
source bin/activate

Clone repository:

cd /var/linkode_home/
git clone https://github.com/facundobatista/kilink.git linkode_app

Install the requirements:

cd linkode_app
pip install -r requirements.txt

The WSGI configuration file is already in the project, ready to use; for develop or debugging you can add to it:

application.debug = True
# Needs install paste via pip "pip install paste"
# For More information:
# http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Browser_Based_Debugger
from paste.evalexception.middleware import EvalException
application = EvalException(application)

Create a virtual host configuration file in /etc/apache2/sites-enabled/ with the name that you want, in this case "linkode"

sudo vi /etc/apache2/sites-enabled/linkode

And paste this:

<VirtualHost *>
    ServerName linkode.mydomain

    WSGIDaemonProcess linkode user=www-data group=www-data threads=5
    WSGIScriptAlias / /var/linkode_home/linkode.wsgi
    WSGIScriptReloading On

    <Directory /var/linkode_home/linkode_app/kilink/>
        WSGIProcessGroup linkode
        WSGIApplicationGroup %{GLOBAL}
        Order deny,allow
        Allow from all
    </Directory>

    AddDefaultCharset utf-8
    ServerSignature On
    LogLevel info

    ErrorLog  /var/log/apache2/linkode-error.log
    CustomLog /var/log/apache2/linkode-access.log combined

</VirtualHost>

Restart Apache and enjoy!

Clients

kilink's People

Contributors

abuelodelanada avatar chuna avatar crossnox avatar damianavila avatar dmascialino avatar epochiero avatar ezequielchan avatar facundobatista avatar fisadev avatar hugoruscitti avatar jcarizza avatar juancarlospaco avatar luc- avatar marian-vignau avatar matiasdemarchi avatar matibarriento avatar missfilly avatar rbistolfi avatar ricardokirkner avatar sofide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

kilink's Issues

Allow the user to copy the kilink URL easily

After creation, or editing, an option should add somewhere to easily copy the kilink's URL to the user's clipboard.

Maybe, offer here also something like "copy the kilink's URL already shortened by is.gd".

Create a deployment history

There should be an easy way to rollout. Also, we need to create something like "staging" to try stuff like in production, but not the default service.

Text type autodetection

When code is pasted, it should autodetect the type and change the coloring of the text (and the selection in the combobox) to match the detection. It also needs to re-check the decision after enough text changing (not for every char change), unless the user changes the combobox manually.

Need a combo-box to select the type of text

When autoselection is done, this combobox should be changed automagically. If the user uses the combobox manually, the automagic selection should be interrupted.

Also, on the kilink creation the type of text should be sent to the server, with a flag to indicate that it is a produc of the automagic selection of was overriden by the user.

We should show the timestamp of the shown linkode's revno

Maybe below the text, in a small font, at the left of the page?

Also, with which timezone should we show it? Can we detect somehow the timezone of the user when is viewing the linkode? Is that reliable? Or maybe we can let the user select that from his account page, being UTC the default.

Create a tools page

Here it will go sections for (at least) API documentation, tools, etc

In the API part, we need to put the syntax definition, and also examples of usage for the different languages (pretty much like 0mq docs, see FIXME)

We need an authenticated API

We need a way for the applications that use the API to authenticate, to access private information or actions of the user.

To do this, I like a lot the "token" based stuff. Maybe not even OAuth. but it's an option. Don't forget to check how GitHub is doing this very same thing.

Of course, all is over HTTPS.

The user needs to have a "config" or "account" page

There it will a page where the user can have all her configurations (mail address, preferred key bindings, etc). As this is a secure page, here it will be also other authentication related stuff (for example, the creation of a token to authenticate some application).

Finally, some rare actions should be included in this page. Examples: "delete some specific kilink", "delete all kilinks I ever created", "export all kilinks I ever created", etc.

Diff between kilink tree nodes

Offer a diff capability between different nodes of the same kilink.

How this difference should be shown? as a new kilink? as an ephimeral popup window?

Try to simplify URLs

The visible "ultimate" URL for the user should have the form:

linkode.org/
linkode.org//

Probably, we should encapsulate the rest of behaviours under different server names (like api.linkode.org), or directly making it decide in function of some subpath, like

linkode.org/api/etc
linkode.org/users/etc

It's ok to have more complex (or not "that nice") urls in other cases, but the sharing one should be dead simple.

Put limits to the access

Limits should be enabled at web server level for the normal and API usages, to avoid DDOS attacks, or just overload the service.

We're exhausting the DB connections

I just found the service was down, having this in apache's log:

OperationalError: (OperationalError) FATAL: remaining connection slots are reserved for non-replication superuser connections

This is probably fault of my hacked connection manager

Export kilinks

We want to offer a "escape alternative". This is, allow the user to export all his kilinks, for the user to have them.

This is the kind of action that should be offered in the user's account page (of course, after logged in).

Add site metrics

Like google analytics and other one to see where the user clicks (don't remember which one it is, ask Hugo).

But first, we need to understand if this kind of "external analytic stuff" is not evil, in the sense that we shouldn't help third parties to gather information about our users.

Applet to allow kilink creation everywhere

Just a html/js thingie that anybody could include in any page to allow kilink creations. For example, I put it in my blog, and you can create a kilink automatically through it without leaving my blog.

We should have the interface in several languages

The language should be chosen in the account page.

However, I'm not sure what to do when the user is not logged in:

a) Show it in english

b) Try to select the language in function of the IP where the user is connecting in

Offer a print button to the user

A special CSS for printing, so what goes to the printer is only the text field content. One thing to think about: it should be colored or not?

Delete kilinks

Allow the user to remove one, or all her kilinks.

This is the kind of action that should be offered in the user's account page (of course, after logged in).

Interface language

The interface should have as few words as possible. But it will have some. So, it's a good thing to offer it in several languages.

Notify user about new revision of current kilink

A user reading a kilink has no way to know if a new revision has been made while reading. This presents an usability problem since user cant know if the kilink she is reading is outdated. This could be solved by pushing notifications to the client via javascript.

Applet to show kilinks everywhere

Just a html/js thingie that anybody could include in any page to show a kilink (a specific node, or the latest node for the kilink).

Plugins for editors

Mainstream editors (say: vim, emacs, ninja-ide) should have plugins where you select a bunch of text and automatically can create a kilink with that text.

If after creation it just offers you the kilink url or make you automatically jump to the web page in your browser, is more of a choice of the editor.

Tool for command line

Something that will allow people to do stuff like "grep ERROR *.log | kilink”, being the only result of the script the URL of the new kilink.

Minimise the steps to create a kilink

Two details (at least): cursor position, and submit.

So, whhen you enter the page, the cursor should be by default in the textarea, and also the "create" or "save new version" should be triggered by ctrl-enter.

This makes the nice effect of all having to do to create a kilink is enter the page, ctrl-v, ctrl-enter.

Allow users to login

We don't want to hold user information, nor the responsibility for the security of everything, so we should users to login using any of the modern easy ways.

IOW, we should allow users to login with twitter, facebook, etc, and OpenID.

All said, we would may users to set a mail address in their account, only to be used for rare important communications, or stuff like that.

After logged in, all interaction with that user would be done through HTTPS.

Plugins for browsers

Mainstream browsers (say: vim, emacs, ninja-ide) should have plugins where you select a bunch of text and automatically can create a kilink with that text.

Don't expose UUIDs to humans

Still use it as ids in the DB, but don't show them, convert them to something smaller without losing information.

The code was there in the past, need to get it back.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.