1
0
mirror of https://github.com/JustKato/FreePad.git synced 2026-02-23 15:50:46 +02:00

+ Maximum pad length

+ Configurable maximum pad length
+ Refresh pad
+ Archive pad
+ Archives in local client storage
+ Download pad
This commit is contained in:
2022-05-21 16:17:25 +03:00
parent b079c0f637
commit e781daec89
8 changed files with 326 additions and 73 deletions

View File

@@ -1,10 +1,13 @@
package objects
import (
"errors"
"fmt"
"os"
"path/filepath"
"time"
"github.com/JustKato/FreePad/lib/helper"
)
type Post struct {
@@ -73,6 +76,11 @@ func GetPost(fileName string) Post {
func WritePost(p Post) error {
maximumPadSize := helper.GetMaximumPadSize()
if len(p.Content) > maximumPadSize {
return errors.New("The pad is too big, please limit to the maximum of " + fmt.Sprint(maximumPadSize) + " characters")
}
// Get the base storage directory and make sure it exists
storageDir := getStorageDirectory()