Giter VIP home page Giter VIP logo

haste-server's Issues

IE 11 support

I'd like to see Internet Explorer 11 support in Hastebin.

IPv6 Support

How can I have the server bind to both v4 and v6 addresses or at minimum bind to an IPv6 address?

Why do pastes on hastebin.com regularly disappear after ~24 hours?

In http://hastebin.com/about.md it says that

Pastes will stay for 30 days from their last view. They may be removed earlier
and without notice.

I know there is a exceptional clause, however I don't think I ever had a paste that lasted this long. They ususally are deleted one or two days after.

I love the site for its simplicity, just open the site, ctrl-v, ctrl-s, ctrl-l, ctrl-c and you have a url. Potentially modify the url extension and paste it anywhere you like. I have not yet found a page where it is this easy and transparent to create pastes.

I would love if pastes lasted more than one or two days before they get deleted. They don't have to be permanent at all, but this time is barely enough and only works for quick conversations. I can't use it for emails for example because I don't know if the recipient will read it in time. Please do something about this. Or, if you can't do anything, you should probably change that part of the about.md to indicate that pastes are deleted way earlier than 30 days.

favicon

add a favicon to the site

Certain text input crashes browser tab when attempting to save new hastebin

If you enter this text into hastebin and attempt to save it:

INFO 08-20 09:45:51,627 [main] SLF4JDemo.java,19 | marked 17 blah_blah_blah_blah completed for customerId=42 between Thu Jul 31 19:00:00 CDT 2014 and Mon Aug 04 19:00:00 CDT 2014
ERROR 08-20 09:45:51,631 [main] SLF4JDemo.java,24 | failed to mark blah_blah_blah_blah complete for customerId=42 between Thu Jul 31 19:00:00 CDT 2014 and Mon Aug 04 19:00:00 CDT 2014

it will completely lock up the browser tab. I suspect there is some parsing/sanitization logic that is stuck in an infinite loop...

Weird one! :-)

JSONP support

It would be great if haste-server supported JSONP, so that JavaScript-based clients could interact with it.

Hastebin rocks - thanks for creating this project!

Show a list of past texts

Would be great to show a list of past texts right under the icons, so we could have an history to navigate.

@seejohnrun suggested to store it on HTML5 storage and I liked it.

There could be an extra attribute on the texts like an user id or username so you could populate the local storage once you move between computers

Apache proxy connection

I'm using Apache to proxy the requests from port 7777 to 80.

[error] (111)Connection refused: proxy: HTTP: attempt to connect to 127.0.0.1:7777 (127.0.0.1) failed
[error] ap_proxy_connect_backend disabling worker for (127.0.0.1)

Here is my proxy config :

<VirtualHost *:80>
    ServerAdmin root
    ServerName bin.postblue.info

    <IfModule mod_proxy.c>
        ProxyVia On
        ProxyRequests Off
        ProxyPass / http://127.0.0.1:7777/
        ProxyPassReverse / http://127.0.0.1:7777/
        ProxyPreserveHost on
        <Proxy *>
            AllowOverride All
            Order allow,deny
            allow from all
        </Proxy>
    </IfModule>
</VirtualHost>

Is there anyone else who have such a problem ?

Error connecting to redis

I followed the instructions (download, extract, edit config.js if needed, npm install, npm start), but maybe redis wasn't installed properly?

stdout:

blha303@irc:~/haste-server$ npm start

> [email protected] start /home/blha303/haste-server
> node server.js

info: configuring redis
info: compressed application.js into application.min.js
info: loading static document name=about, path=./about.md
info: listening on 0.0.0.0:7777
error: error connecting to redis index 2 error=undefined
npm ERR! [email protected] start: `node server.js`
npm ERR! `sh "-c" "node server.js"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the haste package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls haste
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 2.6.18-308.el5.028stab099.3
npm ERR! command "nodejs" "/usr/bin/npm" "start"
npm ERR! cwd /home/blha303/haste-server
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.69
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/blha303/haste-server/npm-debug.log
npm ERR! not ok code 0

Contents of npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'nodejs', '/usr/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose read json /home/blha303/haste-server/package.json
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart [email protected]
7 info start [email protected]
8 verbose unsafe-perm in lifecycle true
9 silly exec sh "-c" "node server.js"
10 silly sh,-c,node server.js,/home/blha303/haste-server spawning
11 info [email protected] Failed to exec start script
12 error [email protected] start: `node server.js`
12 error `sh "-c" "node server.js"` failed with 1
13 error Failed at the [email protected] start script.
13 error This is most likely a problem with the haste package,
13 error not with npm itself.
13 error Tell the author that this fails on your system:
13 error     node server.js
13 error You can get their info via:
13 error     npm owner ls haste
13 error There is likely additional logging output above.
14 error System Linux 2.6.18-308.el5.028stab099.3
15 error command "nodejs" "/usr/bin/npm" "start"
16 error cwd /home/blha303/haste-server
17 error node -v v0.8.16
18 error npm -v 1.1.69
19 error code ELIFECYCLE
20 verbose exit [ 1, true ]

Use basicAuth

Would it be difficult to implement connect's basicAuth, to provide static user/password access to the hastebin server?

Specify syntax highlighting

Syntax highlighting isn't perfect, and often fails to detect the language being used. An option to specify it would be great.

Not loading up on EC2

Do I have to do anything special to the host/port configurations on EC2 ? I have opened up the port I intend to use (8080) and I am successfully running the server.
However when I connect to www.hardikr.com:8080 it just gives me a 404.. Is there some sort of security development/production measure I have to remove ?

Again, thanks for a wonderful OSS project!

Max files size

What is the default max size of log file you can paste, and what si the maximum possible value I can push this to ? Our team has to pass around a lot of log files for troubleshooting and this would work great, but its pretty comment for logs in question to be 30-40,000 lines

Can't create paste with "??" in contents

To reproduce:

  1. Enter ?? as the pasted text (alone or with more text).
  2. Try to save it.
  3. Observe a red "undefined" error.

Something is actually saved if you check server logs (in one of my cases, jQuery1707589711453765631_1328643245761)...but not the actual data.

Running ca9d4c1; also seen on hastebin.com.

Activate syntax highlighting automatically

Instead of highlighting the paste after a save, the highlighting should kick in after you've typed a few lines. Additionally you should be able to set the programming language in the case it can not be detected or is wrongly detected.

Offer raw text if javascript is disabled

Some people have javascript disabled by default, and the result is an empty page.
Would be great to see the raw version instead along with note about the awesome features they would get with javascript.

Support to modify baseurl

I'm setting up hastebin on a server with other services, I'd like to proxy it through httpd to be exposed at /haste or something like that but it doesn't look like hastebin supports this.

Are there any plans to incorporate an option to set the baseurl? Currently hastebin expects to be running at /

FileDocumentStore has no method md5

OK, I have tried all 3 ways of getting Haste up and running - files, redis and memcached! All three of them give some error. Here is the one for file :

info: compressed application.js into application.min.js
info: listening on localhost:7777

/home/ubuntu/code/node/haste-server/lib/document_stores/file.js:28
var fn = _this.basePath + '/' + _this.md5(key);
                                        ^
TypeError: Object [object Object] has no method 'md5'
at Object.oncomplete (/home/ubuntu/code/node/haste-server/lib/document_stores/file.js:28:45)

It is strange because file.js has an md5 method explicitly defined for the object FileDocumentStore.

Support for key naming schemes

It'd be nice if key names were able to be generated with different methods, much like how pwgen (man page) has phonetic generation and others. If you don't have a way of sending the link to yourself or writing it down (e.g., pasting some information to retrieve when you get back to your desk), it can be difficult to remember a purely random key.

Error 127

Dagon@two:/www/haste-server-master$ npm start

[email protected] start /www/haste-server-master
node server.js

sh: 1: node: not found
npm ERR! [email protected] start: node server.js
npm ERR! sh "-c" "node server.js" failed with 127
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the haste package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server.js
npm ERR! You can get their info via:
npm ERR! npm owner ls haste
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! cwd /www/haste-server-master
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /www/haste-server-master/npm-debug.log
npm ERR! not ok code 0

Long first few lines are partially hidden by logo

if a paste contains a long first few lines (greater than the width of the screen - logo width), the end of each line will be hidden by the Hastebin logo and controls. It can be seen by using raw text, but otherwise you are unable to scroll out to the end.

Trying to think of a graceful way of showing the full line.. Perhaps somehow setting the page width wider than that will allow scrolling past the end of the line so that it will show fully on the left side of the logo? Or some sort of wrap or other way of being able to see it?

Backup / Restore?

what is the best way to backup your paste's ? We find our selves routinely using them for logging in tickets and would like to add some way to backup and restore paste's if at all possible

Syntax Error?

Whenever i try to start NPM, it shows me i should do node server.js

node server.js

undefined:26
{
^
SyntaxError: Unexpected token {
at Object.parse (native)
at Object. (/home/kvm3/haste/haste-server/server.js:11:19)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3

My server.js (nothing changed!)

var http = require('http');
var url = require('url');
var fs = require('fs');

var winston = require('winston');
var connect = require('connect');

var DocumentHandler = require('./lib/document_handler');

// Load the configuration and set some defaults
var config = JSON.parse(fs.readFileSync('./config.js', 'utf8'));
config.port = process.env.PORT || config.port || 7777;
config.host = process.env.HOST || config.host || 'localhost';

// Set up the logger
if (config.logging) {
try {
winston.remove(winston.transports.Console);
} catch(er) { }
var detail, type;
for (var i = 0; i < config.logging.length; i++) {
detail = config.logging[i];
type = detail.type;
delete detail.type;
winston.add(winston.transports[type], detail);
}
}

// build the store from the config on-demand - so that we don't load it
// for statics
if (!config.storage) {
config.storage = { type: 'file' };
}
if (!config.storage.type) {
config.storage.type = 'file';
}

var Store, preferredStore;

if (process.env.REDISTOGO_URL && config.storage.type === 'redis') {
var redisClient = require('redis-url').connect(process.env.REDISTOGO_URL);
Store = require('./lib/document_stores/redis');
preferredStore = new Store(config.storage, redisClient);
}
else {
Store = require('./lib/document_stores/' + config.storage.type);
preferredStore = new Store(config.storage);
}

// Compress the static javascript assets
if (config.recompressStaticAssets) {
var jsp = require("uglify-js").parser;
var pro = require("uglify-js").uglify;
var list = fs.readdirSync('./static');
for (var i = 0; i < list.length; i++) {
var item = list[i];
var orig_code, ast;
if ((item.indexOf('.js') === item.length - 3) &&
(item.indexOf('.min.js') === -1)) {
dest = item.substring(0, item.length - 3) + '.min' +
item.substring(item.length - 3);
orig_code = fs.readFileSync('./static/' + item, 'utf8');
ast = jsp.parse(orig_code);
ast = pro.ast_mangle(ast);
ast = pro.ast_squeeze(ast);
fs.writeFileSync('./static/' + dest, pro.gen_code(ast), 'utf8');
winston.info('compressed ' + item + ' into ' + dest);
}
}
}

// Send the static documents into the preferred store, skipping expirations
var path, data;
for (var name in config.documents) {
path = config.documents[name];
data = fs.readFileSync(path, 'utf8');
winston.info('loading static document', { name: name, path: path });
if (data) {
preferredStore.set(name, data, function(cb) {
winston.debug('loaded static document', { success: cb });
}, true);
}
else {
winston.warn('failed to load static document', { name: name, path: path });
}
}

// Pick up a key generator
var pwOptions = config.keyGenerator || {};
pwOptions.type = pwOptions.type || 'random';
var gen = require('./lib/key_generators/' + pwOptions.type);
var keyGenerator = new gen(pwOptions);

// Configure the document handler
var documentHandler = new DocumentHandler({
store: preferredStore,
maxLength: config.maxLength,
keyLength: config.keyLength,
keyGenerator: keyGenerator
});

// Set the server up with a static cache
connect.createServer(
// First look for api calls
connect.router(function(app) {
// get raw documents - support getting with extension
app.get('/raw/:id', function(request, response, next) {
var skipExpire = !!config.documents[request.params.id];
var key = request.params.id.split('.')[0];
return documentHandler.handleRawGet(key, response, skipExpire);
});
// add documents
app.post('/documents', function(request, response, next) {
return documentHandler.handlePost(request, response);
});
// get documents
app.get('/documents/:id', function(request, response, next) {
var skipExpire = !!config.documents[request.params.id];
return documentHandler.handleGet(
request.params.id,
response,
skipExpire
);
});
}),
// Otherwise, static
connect.staticCache(),
connect.static(__dirname + '/static', { maxAge: config.staticMaxAge }),
// Then we can loop back - and everything else should be a token,
// so route it back to /index.html
connect.router(function(app) {
app.get('/:id', function(request, response, next) {
request.url = request.originalUrl = '/index.html';
next();
});
}),
connect.static(__dirname + '/static', { maxAge: config.staticMaxAge })
).listen(config.port, config.host);

winston.info('listening on ' + config.host + ':' + config.port);

Multiple documents loading problem

Here is the thing : I putted multiple static documents in my config, but there's only the latest loaded, 3 times !

info: listening on localhost:7777
info: connected to memcached on localhost:11211
info: loaded static document name=rss-feeds, path=./rss-feeds.opml
info: loaded static document name=rss-feeds, path=./rss-feeds.opml
info: loaded static document name=rss-feeds, path=./rss-feeds.opml
warn: document not found key=about
warn: document not found key=statusnet
verbose: retrieved document key=rss-feeds

My config is :

"documents": {
"about": "./about.md",
"statusnet": "./statusnet.php",
"rss-feeds": "./rss-feeds.opml"
}

Am I doing it right ? :/

Line numbers don't align correctly

http://hastebin.com/pexobuqicu.avrasm :
linenumbers It begins quite well, but in the end it is messed up.

I'm using latest version, with Google Chrome and this has bugged me for a few months already. It seems to add 1 or 2 pixels everytime (or just randomly? I haven't investigated this too much)

I'm not sure when this happens, but it doesn't happen if I only add some random text, like asdasdasdasdasd \n asdasdasda \n asdasdad \n and so on. It happens with code.

edit: hmm, I noticed that it doesn't happen with .hs extensions, it has something to do with the syntax hilighting

subdirectory with nginx proxypass

How would you use haste-server in a sub-directory? I can use it in the root of the WWW using proxypass to remove to port from the URL. Though if i try to use it in a sub-directory like location /haste problems start appearing.

Twitter shortcut key poorly chosen

The default keyboard shortcut for Twitter submission (Ctrl-t) collides with the fairly common shortcut to create a new tab in several browsers.

If I didn't have a popup blocker, I would constantly be tweeting about things I really do not want to share.

Please choose an accelerator that tries to avoid the common shortcuts in browsers.

line numbering

add line numbering. This should be in edit mode and in final mode, and should show the number of lines along with the main content. Scrollable also

./about.md shows javascript block of code only

./about.md shows javascript block of code only.

When i visited /about i saw the raw markdown, but when i added the .md extension, it looks like it codeblocked the header of the page and showed that instead.

Questions about development

Hi, I hope this is an ok forum for these questions. :)

  • It seems launching server.js re-minifies application.js. Is that correct? Or, in other words, If I change application.js, what do I need to do to make sure the changes are correctly reflected in .min.js?
  • On that note, it actually seems like application.min.js should be .gitignored, since it's a build artifact and prone to meaningless merge conflicts. Shouldn't it?
  • If I want a feature and I'm willing to do the work, should I just make it happen and send a pull request, or run it by you first?

Thanks for making this! It works real nice.

highlight line

from email:

"""
hold be nice to add functionality to allow the specification of a line in the url
(example: http://hastebin.com/ruguxarori#12)

this would display the text at the specified line and highlight it.

Thanks and great job!
"""

hastebin.com is down

Right now the error message is
"
Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.
"

I assume this has to do with hosting, but just to be sure its worth checking those logs ...

Add ability to edit a document using a random private key

Hello,

I think editing a document instead of creating a new copy can be very interesting.
Once a new document is saved, the user can edit the document whenever he wants using a random generated private key.

http://hastebin.com/mugehequvi.rb

To edit the file, a user can go to : http://hastebin.com/mugehequvi.rb/private_key
or : http://hastebin.com/edit/mugehequvi.rb/private_key

For the gem, a user can type : 'cat file' | haste -k private_key

Thanks!

Chromium grabs the shortcuts

Chromium Version 24.0.1312.52 (175374) grabs shortcuts. For example if i press the ctrl +n new window opens. But haste should create new file

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.