Giter Site home page Giter Site logo

knadh / niltalk Goto Github PK

View Code? Open in Web Editor NEW
945.0 36.0 118.0 339 KB

Instant, disposable, single-binary web based live chat server. Go + VueJS.

License: GNU Affero General Public License v3.0

Go 53.13% HTML 9.36% CSS 16.99% JavaScript 18.61% Makefile 1.78% Dockerfile 0.13%
chat chat-server chat-room communication private-chat private-messaging disposable

niltalk's Introduction

Niltalk

Niltalk is a web based disposable chat server. It allows users to create password protected disposable, ephemeral chatrooms and invite peers to chat rooms. Rooms can be disposed of at any time.

niltalk

Installation

Niltalk supports in-memory / file / Redis as the backend for persisting room and session states.

Manual

  • Download the latest release for your platform and extract the binary.
  • Run ./niltalk --new-config to generate a sample config.toml and add your configuration.
  • Run ./niltalk and visit http://localhost:9000.

Docker

The official Docker image niltalk:latest is available here. To try out the app, copy docker-compose.yml and run docker-compose run niltalk.

Customisation

The static HTML/JS/CSS assets can be customized. Copy the static directory from the repository, change the files, and do: ./niltalk --static-dir=/path/to/custom/static

This is a complete rewrite of the old version that had been dead and obsolete for several years (can be found in the old branch). These codebases are not compatible with each other and master has been overwritten.

Licensed under AGPL3

niltalk's People

Contributors

clementauger avatar knadh 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  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  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  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  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  avatar  avatar  avatar  avatar

niltalk's Issues

added inmemory store and tor support on my fork

hi,

i made several updates on my fork. Letting you know in case you want to grab some for yourself.

  • added in memory store as i really dont care to crash and loose everything and prefer that to run an additional software. Also it makes it a one click to run application, which is what i want. If it was only me the configuration file would be automatically generated at start up with the defaults, i am just not motivated enough for now to implement it.
  • added tor support. just set the listen address to tor and it will generate an onion and make things happen. configure the new privatekey option to persist your onion and that's it. Don't forget to empty roolURL too, otherwise it will print unexpected addresses.

see the few commits at https://github.com/clementauger/niltalk/commits/master

I may also add growl support in future, so i can receive desktop notifications when someone speaks or enter a specific room. though i need to figure out a few things at first.

Thanks for that app. Just what i needed.

hth.

error initializing store: dial tcp: lookup redis on 127.0.0.53:53: server misbehaving

Hi, i have ubuntu 20.04 VPS without white IP.

i want to run niltalk, but i have error:

ubuntu@ubuntu:~/niltalk_0.1.0_linux_amd64$ ./niltalk
2022/02/13 15:19:45 main.go:82: reading config: config.toml
2022/02/13 15:19:45 error initializing store: dial tcp: lookup redis on 127.0.0.53:53: server misbehaving
ubuntu@ubuntu:~/niltalk_0.1.0_linux_amd64$
how to fix this error?

Incorrect room destroying

Hi,

I'm trying to use your multiroom chat example and I've found a problem with room destroying. Currently niltalk works like this:

  1. room is created;
  2. peers are connected;
  3. communication;
  4. stop signal to close the room;
  5. peers are disconnected;
  6. room is destroyed.

But in the Peer.listen() function you have a defer function:

defer func() {
		if _, exists := rooms[peer.room_id]; exists {
			rooms[peer.room_id].unregister <- peer
		}
		peer.ws.Close()
	}()

I often (and randomly) get a situation when this defer function is executed after the room is destroyed - so unregister channel is already closed and I get a runtime error write to the closed channel, sometimes my program even crashes after this error.

Please help to solve this. What would be the most optimal solution?

I've tried to add a room peer's counter and close when counter == 0, but counter checking in a loop freezes the process, so the solution is not working. Adding a timeout before closing the room is probably the worst solution.

panic(0x3275d8, 0x10804010)

panic: Redis connection failed

goroutine 1 [running]:
panic(0x3275d8, 0x10804010)
/usr/lib/go-1.7/src/runtime/panic.go:500 +0x33c
main.main()
/usr/share/go-1.7/src/github.com/goniltalk/niltalk/niltalk.go:145 +0xbc
exit status 2

I do not understand the error
Someone help me please ??

Using zipfs to provide individual unique web pages to each created room?

Hello,

I have just come across NilTalk and really like it as I can learn a lot as well.

One thing that I have also been thinking is about how to have a complete set of independent web pages for each room created and have been investigating ZIPFS (https://github.com/spkg/zipfs) for possible use in this way as it allows for a ZIP compressed set of files to be stored in a single file.

I have done some simple tests with ZIPFS and they work:


package main

import (
	"log"
	"net/http"
	"github.com/spkg/zipfs"
)

func main() {
	fs, err := zipfs.New("testdata/testdata.zip")
	if err != nil {
		log.Fatalf("Error setting up zipfs: %v", err)
	}

	log.Fatal(http.ListenAndServe(":8080", zipfs.FileServer(fs)))
}

I was wondering how I might be able to make changes to the NilTalk code that would allow a user to select one of the created and compressed zip "Themes" that could be all stored in a directory and then they could choose one when they create the room or leave it to the default NilTalk theme, but I am not sure what changes might need to be made.

Can you please advise what might be able to be done?
Thanks in advance

Deploying Niltalk as a Microservice in a Subdirectory

I am attempting to deploy the Niltalk application on a subdirectory as a micro service, but I am encountering several issues.

Specifically, I have set the root_url in the config.toml file to https://example.site/chat, and I have set up a reverse proxy in Nginx to point to the application:

    location /chat/ {

      proxy_set_header        Host $host;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;
      proxy_set_header        Connection $http_connection;
      # proxy_set_header        X-NginX-Proxy true;

      proxy_pass          http://localhost:9000/;
      proxy_read_timeout  120;
    }

When I access https://example.site/chat, my browser is reporting multiple errors related to missing resources:

vue.min.js:1  Failed to load resource: the server responded with a status of 404 (https://example.site/vue.min.js)
client.js:1 Failed to load resource: the server responded with a status of 404 (https://example.site/client.js)
app.js:1 Failed to load resource: the server responded with a status of 404 (https://example.site/app.js)
logo.png:1  Failed to load resource: the server responded with a status of 404 (https://example.site/logo.png)
chat.png:1 Failed to load resource: the server responded with a status of 404 (https://example.site/chat.png)
style.css:1 Failed to load resource: the server responded with a status of 404 (https://example.site/style.css)

I tried using use custom static files and modify some files like template/base.html to reference them, but this approach only made things worse:

<script src="./static/vue.min.js"></script>
<script src="./static/client.js"></script>
<script src="./static/app.js"></script>

Is there a way to host Niltalk in a subdirectory as a microservice?

end-to-end encryption?

Are you encrypting messages end-to-end? AFAICT, you're only encrypting the HTTP + WS connections to the server with traditional SSL. Am I right in saying that the server can spy on all the traffic?

Installation of Niltalk?

Hello, I am trying to install niltalk and run it on a test server of mine to tinker around with it. I understand that this hasn't been updated in a while, but I am getting the issue when I try to do go get github.com/knadh/niltalk or go get github.com/goniltalk/niltalk.
I get the following issue.
./api.go:286: invalid operation: ctx["token"] (type stack.Context does not support indexing)

Is there any way to fix this? I'd like to get niltalk up and running on my own host.

dubious check in redis store

hey,

in the redis store GetSession method, the statement that verifies that the retrieved handle form redis is not empty is dubious.

In the case the user has not provided an username, which he might do, then the session he opened can never be retrieved.

See this line https://github.com/knadh/niltalk/blob/master/store/redis/redis.go#L164

I have not run manual testing to check for it, though i had to remove the corresponding statement in the memory store i have written.

So i guess this applies to the redis store too.

docker-compose.yml error

on running docker compose am getting the following error. guess I am missing something, please help:

invalid mount config for type "volume": invalid mount path: 'niltalk-data' mount path must be absolute

thanks

A lot race issue?

I found a lot possible race issues in this project.

For example, the Room struct, the run method goroutine read/write the room.peers, but out of the run method, there're also some other goroutine read the room.peers without lock, it might case race issue.

// Write in one goroutine

...
go rooms[id].run()
...

select {
    // A new peer has connected.
    case peer, ok := <-room.register:
        if ok {
            room.peers[peer] = true
    // ...

But out of the run method goroutine, there is another goroutine read it without lock.

// Read in another goroutine
func (room *Room) peerList() map[string]string {
	list := make(map[string]string)

	for peer := range room.peers {
		list[peer.id] = peer.handle
	}

	return list
}

I found some more places like this, it should case race issue.

Does it support voice message?

It is great to have a temporary chat room for live broadcast, without the necessity of creating a group in other platform; does this support voice message? If not, is that possible to have this function?

Unknown error

Installed and followed all the steps listed. It runs fine but after creating a room...it says "DEBUG: 2016/11/24 00:33:38 Websocket upgrade failed: 127.0.0.1:17182 websocket: could not find connection header with token 'upgrade'"

On the web browser console...it says "WebSocket connection to 'wss://www.tlk2me.com/w/QIrG8?handle=' failed: Unexpected response code: 400"

What do you think is not right here?

undefined error

hello
what is the probleme

command-line-arguments

run.bat
command-line-arguments
.\niltalk.go:91:69: undefined: syscall.SIGUSR1
.\niltalk.go:94:14: undefined: syscall.SIGUSR1

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.