Git Product home page Git Product logo

zestream-server's People

Contributors

abhi-shek-raj avatar abskrj avatar akshat2602 avatar catalyst-47 avatar chauhan17nitin avatar deepsource-autofix[bot] avatar deepsourcebot avatar shofiya2003 avatar uzaxirr avatar vivek378521 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

zestream-server's Issues

Add watermark while generating multi-bitrate video

Is your feature request related to a problem? Please describe.
We need to have a feature to add watermark to the video while generating the multi-bitrate video. The image will be present in downloads/directory and the filePath will be given, checkout service/dash.go for more details.

Describe the solution you'd like
Image file is present in downloads/ folder, and the (x,y) coordinates will be passed to function, and inject the image in all the bitrate videos at the given bitrate.

Create a Template for Issues

It should have the following:

  1. Feature/Bug description
  2. ๐Ÿง‘โ€๐Ÿ’ป Implementation/Fix
  3. Steps to reproduce

Feel free to add any new points

Create an endpoint to publish event on Kafka

We need an endpoint which takes the below object in body and publishes an event in Kafka (Kafka URI present in environment variable, if not present throw Err while starting service).

{
  "video": {
    "id": "string",
    "src": "string",
    "type": "mp4"
  }
}

Use of `net/http`'s `ListenAndServe` function has no support for setting timeouts

Description

HTTP timeouts are necessary to expire inactive connections and failing to do so might make the application vulnerable to attacks like slowloris which work by sending data very slow, which in case of no timeout will keep the connection active eventually leading to a denial-of-service (DoS) attack.

Occurrences

There is 1 occurrence of this issue in the repository.

See all occurrences on DeepSource โ†’ deepsource.io/gh/ZeStream/zestream-server/issue/GO-S2114/occurrences/

Screenshot 2023-01-03 at 10 42 12 AM

Solution

A possible solution could be

server := &http.Server{
    Addr:         port,
    ReadTimeout:  time.Duration(timeout) * time.Second,
    WriteTimeout: time.Duration(timeout) * time.Second,
}

err := server.ListenAndServe()

Add Test Cases for `UploadToCloudStorage`

Add Test cases for the function UploadToCloudStorage and all possible functions in utils/upload.go

The cloud provider services needs to be mocked over here (Eg: AWS, GCP and Azure)

File Hash Function

Describe the solution you'd like
Create a Hash function in Golang, which takes a file name and URL params, and returns MD5 hash of it.

Approach
Append the key and values of params to the file name, sort the string and generate MD5 hash and return.
Step 1: fileName-key1:value1;key2:value2;........keyN:valueN
Step 2: sort the above string
Step 3: Calculate MD5 of the string and return

Document setting up Cloud Storage

Is your feature request related to a problem? Please describe.
Documentation

Describe the solution you'd like
As now we have function to upload the folder directly, there should be a doc when people can read and easily understand, how to setup GCP/Azure/AWS.

Write UTs for all the function

Is your feature request related to a problem? Please describe.
Enhancement

Describe the solution you'd like
We need to write UT for every function out there

Child Issues

Add Azure and GCP support for pre-signing url

Is your feature request related to a problem? Please describe.
Its a feature

Describe the solution you'd like
Currently, we can only generate AWS pre signed url, we should support GCP and Azure also.

Describe alternatives you've considered
Add support for GCP and Azure also

Unsafe defer of `os.Close`

Description

Calling os.Close on an io.Closer may return an error, and ignoring the same might result in a data loss.

Occurrences

There are 3 occurrences of this issue in the repository.

See all occurrences on DeepSource โ†’ deepsource.io/gh/ZeStream/zestream-server/issue/GO-S2307/occurrences/
Screenshot 2023-01-03 at 10 49 10 AM

Suggestions

Bad Practice

package main

import (
    "fmt"
    "os"
)

func foo() error {
    f, err := os.Create("/tmp/test.txt")
    if err != nil {
        return err
    }
    defer f.Close()

    return fmt.Fprint(f, "Hello World")
}

Recommend

package main

import (
    "fmt"
    "os"
)

func foo() error {
    f, err := os.Create("/tmp/test.txt")
    if err != nil {
        return err
    }

    err = fmt.Fprint(f, "Hello World")
    if err != nil {
        return err
    }

    return f.Close()
}
package main

import (
    "fmt"
    "os"
)

func foo() error {
    f, err := os.Create("/tmp/test.txt")
    if err != nil {
        return err
    }
    defer f.Close()

    err = fmt.Fprint(f, "Hello World")
    if err != nil {
        return err
    }

    return f.Sync()
}

Improve Readme

Is your feature request related to a problem? Please describe.
This is a feature request.

Describe the solution you'd like
Write a better Readme for this repo.

Additional context
PIng in #36 for more context.

Test

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Ubuntu]
  • OS Version [e.g. 20.04]
  • Golang Version [e.g. 1.9]

Additional context
Add any other context about the problem here.

Add docker support

We need to add docker support, using a single command, it should deploy an instance on docker

Write error response schema for APIs

We need to write an Error response schema to be returned from API. Like this

{
    "error": "Error parsing JSON request",
    "message": "Invalid JSON format",
    "detail": "Post the 'author' and 'id' fields in the request body."
    "statusCode": 400
}

Lint the Codebase and Create CI/CD workflow for the same

Currently the codebase is not properly linted, when we run golangci-lint run in the root of repository we get many errors, so it is desirable to fix them up and create a GitHub action workflow for the same to avoid bumping into this in future

Screenshot 2023-01-02 at 1 13 49 AM

Dependency issue wrt Azure and GCP packages

Describe the bug
While setting up the dev environment I noticed that some packages are missing from the direct requirements part of thego.mod file. Specifically the cloud.google.com/go/storage package and github.com/Azure/azure-storage-blob-go package.

To Reproduce
Steps to reproduce the behavior:

  1. Run go get .
  2. Packages will move from being an indirect dependency to a direct one.

Expected behavior
They should ideally be already in the direct dependency.

Exit inside non-main function

Description

Packages exposing functions that can stop program execution by exiting are hard to reuse. Program exits in functions other than main() or init() are not encouraged.

Occurrences

There are 4 occurrences of this issue in the repository.

See all occurrences on DeepSource โ†’ deepsource.io/gh/ZeStream/zestream-server/issue/RVV-A0003/occurrences/

Screenshot 2023-01-03 at 10 35 00 AM

Solution

calls to log.Fatal should be only in main() or init() functions. So a possible solution for this could be replacing log.Fatal with an Error log level

Write unit tests for functions

We need to write UTs for all the functions, whose UTs are not written yet.

You can even raise PR with at least 1 UT of a function.

Optimized Image CDN

Describe the solution you'd like
Create an endpoint which takes a file path, width and height and returns a file in that dimension.
The URL should look like

/api/v1/image/path-to-file?h=100&w=100

Approach

  1. Take the file path, create the hash with height and width
  2. Check if the path (/path-to-file#hash) exists on CDN
  3. If it exists, do a 301 redirect
  4. If doesnt, generate the image file using ffmpeg and upload it to CDN, and return the file.

Add Logging via Zap Logger

Is your feature request related to a problem? Please describe.
Currently we use the traditional golang log package for logging purpose, however its not sufficient as it lacks a lot of basic functionality like an error level log.

Describe the solution you'd like
Use Zap Logger and replace all the occurrence of log package with this one. Also add new logger statements whenever necessary.

Describe alternatives you've considered
logrus

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.