<commit_before>// Package upload encapsulates prepping an image for sending to discord,
// and actually uploading it there.
package upload

import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"image"
	"io"
	"io/ioutil"
	"log"
	"mime/multipart"
	"net/http"
	"os"
	"path/filepath"
	"time"

	"github.com/fogleman/gg"
	"github.com/tardisx/discord-auto-upload/config"
	daulog "github.com/tardisx/discord-auto-upload/log"
	"golang.org/x/image/font/inconsolata"
)

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type Uploader struct {
	Uploads []*Upload `json:"uploads"`
}

type Upload struct {
	Uploaded   bool      `json:"uploaded"` // has this file been uploaded to discord
	UploadedAt time.Time `json:"uploaded_at"`

	Failed bool `json:"failed"`

	originalFilename string // path on the local disk
	filenameToUpload string // post-watermark, or just original if unwatermarked

	webhookURL string

	watermark bool // should watermark

	usernameOverride string

	Url string `json:"url"` // url on the discord CDN

	Width  int `json:"width"`
	Height int `json:"height"`

	Client HTTPClient
}

func NewUploader() *Uploader {
	u := Uploader{}
	uploads := make([]*Upload, 0)
	u.Uploads = uploads
	return &u
}
<commit_msg>Fix problem with uploads rest endpoint<commit_after>// Package upload encapsulates prepping an image for sending to discord,
// and actually uploading it there.
package upload

import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"image"
	"io"
	"io/ioutil"
	"log"
	"mime/multipart"
	"net/http"
	"os"
	"path/filepath"
	"time"

	"github.com/fogleman/gg"
	"github.com/tardisx/discord-auto-upload/config"
	daulog "github.com/tardisx/discord-auto-upload/log"
	"golang.org/x/image/font/inconsolata"
)

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type Uploader struct {
	Uploads []*Upload `json:"uploads"`
}

type Upload struct {
	Uploaded   bool      `json:"uploaded"` // has this file been uploaded to discord
	UploadedAt time.Time `json:"uploaded_at"`

	Failed bool `json:"failed"`

	originalFilename string // path on the local disk
	filenameToUpload string // post-watermark, or just original if unwatermarked

	webhookURL string

	watermark bool // should watermark

	usernameOverride string

	Url string `json:"url"` // url on the discord CDN

	Width  int `json:"width"`
	Height int `json:"height"`

	Client HTTPClient `json:"-"`
}

func NewUploader() *Uploader {
	u := Uploader{}
	uploads := make([]*Upload, 0)
	u.Uploads = uploads
	return &u
}

{'fraction_non_alphanumeric': 0.1259904912836767, 'fraction_numerical': 0.000792393026941363, 'mean_word_length': 4.153061224489796, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4179367', 'n_tokens_mistral': 924, 'n_tokens_neox': 887, 'n_words': 246}