25 Commits
Author SHA1 Message Date
Matt BaerandGitHub 4d41677a7a Merge pull request #23 from writeas/dependabot/go_modules/golang.org/x/net-0.55.0
Bump golang.org/x/net from 0.54.0 to 0.55.0
2026-07-18 12:11:13 -04:00
dependabot[bot]andGitHub f6707f32ea Bump golang.org/x/net from 0.54.0 to 0.55.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.54.0 to 0.55.0.
- [Commits](https://github.com/golang/net/compare/v0.54.0...v0.55.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.55.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-18 16:10:57 +00:00
Matt Baer f286ddb713 Omit empty First value and only set on New with items>0
Supports fixing writefreely/writefreely#1698
2026-07-18 12:09:59 -04:00
Matt BaerandGitHub 52f92a2d92 Merge pull request #22 from writeas/dependabot/go_modules/golang.org/x/crypto-0.52.0
Bump golang.org/x/crypto from 0.45.0 to 0.52.0
2026-07-18 12:02:01 -04:00
dependabot[bot]andGitHub 9ef186bf73 Bump golang.org/x/crypto from 0.45.0 to 0.52.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.45.0 to 0.52.0.
- [Commits](https://github.com/golang/crypto/compare/v0.45.0...v0.52.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.52.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-18 15:57:53 +00:00
Matt Baer 91ebade091 Add default Context in NewNoteObject 2026-02-20 15:07:03 -05:00
Matt Baer e4cf634040 Update Web Monetization context 2026-02-20 14:48:44 -05:00
Matt Baer 25d52df9a3 Set default Context in NewArticle / NewNote 2026-02-20 14:47:22 -05:00
Matt BaerandGitHub e9abfc34c1 Merge pull request #21 from writeas/dependabot/go_modules/golang.org/x/crypto-0.45.0
Bump golang.org/x/crypto from 0.35.0 to 0.45.0
2026-02-20 14:34:54 -05:00
dependabot[bot]andGitHub d73d983f32 Bump golang.org/x/crypto from 0.35.0 to 0.45.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.35.0 to 0.45.0.
- [Commits](https://github.com/golang/crypto/compare/v0.35.0...v0.45.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.45.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-20 19:33:54 +00:00
Matt Baer 84d7479954 Add Monetization property to Object struct 2026-02-20 14:32:13 -05:00
Matt Baer b6521cded2 Merge branch 'main' of github.com:writeas/web-core 2026-01-15 15:04:57 -05:00
Matt Baer 180136e6db Add Web Monetization properties 2025-10-23 14:15:03 -04:00
Matt Baer cf9f5db56b Add Preview field to Object
This supports the `preview` AS2 attribute to support short-form previews
for `article`s, per FEP-b2b8.
2025-05-07 17:52:29 -04:00
Matt BaerandGitHub d476017273 Merge pull request #20 from writeas/dependabot/go_modules/golang.org/x/crypto-0.35.0
Bump golang.org/x/crypto from 0.17.0 to 0.35.0
2025-05-07 16:23:55 -04:00
dependabot[bot]andGitHub 428972d76c Bump golang.org/x/crypto from 0.17.0 to 0.35.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.17.0 to 0.35.0.
- [Commits](https://github.com/golang/crypto/compare/v0.17.0...v0.35.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.35.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-07 20:23:00 +00:00
Matt Baer a0c5600cc3 Export ToPublic constant 2024-04-11 16:19:18 -04:00
Matt Baer dd08b71215 Merge branch 'main' of github.com:writeas/web-core 2024-04-11 15:35:00 -04:00
Matt BaerandGitHub f311bfd33c Merge pull request #19 from writeas/dependabot/go_modules/golang.org/x/crypto-0.17.0
Bump golang.org/x/crypto from 0.1.0 to 0.17.0
2024-04-11 14:47:39 -04:00
dependabot[bot]andGitHub e8804848c7 Bump golang.org/x/crypto from 0.1.0 to 0.17.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.1.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.1.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-11 18:45:43 +00:00
Matt BaerandGitHub b435031b2d Merge pull request #18 from HotoRas/main
Temporal addition of Korean l10n
2024-04-11 14:44:39 -04:00
Hoto Ras ecf7fd1f90 Temporal addition of Korean l10n
Since the localization project didn't allow me to contribute, I ended up open ip the repo, add up the file, localize, and finally have it able to apply.

- Added: l10n/phrases_ko.go // korean l10n
- Modified: l10n/strings.go // Add casing to have above change able to apply
2024-03-31 13:42:18 +09:00
Matt Baer 6caf274300 Add text.ExtractImages func 2024-02-21 14:20:22 -05:00
Matt Baer d81124d454 Ensure Updated field will be omitted when nil or zero 2023-10-02 21:30:47 -04:00
Matt Baer adbbafe3ee Add Activity.Updated field
Per the Mastodon docs, we need to send an `updated` parameter for
`Update` activities to work correctly.
https://docs.joinmastodon.org/spec/activitypub/#supported-activities-for-statuses
2023-10-02 19:27:51 -04:00
8 changed files with 131 additions and 65 deletions
+29 -5
View File
@@ -8,10 +8,14 @@ import (
const ( const (
Namespace = "https://www.w3.org/ns/activitystreams" Namespace = "https://www.w3.org/ns/activitystreams"
toPublic = "https://www.w3.org/ns/activitystreams#Public" ToPublic = "https://www.w3.org/ns/activitystreams#Public"
) )
var Extensions = map[string]string{} var (
Extensions = map[string]string{}
apMonetizationContext = "https://webmonetization.org/ns.jsonld"
)
// Activity describes actions that have either already occurred, are in the // Activity describes actions that have either already occurred, are in the
// process of occurring, or may occur in the future. // process of occurring, or may occur in the future.
@@ -19,6 +23,7 @@ type Activity struct {
BaseObject BaseObject
Actor string `json:"actor"` Actor string `json:"actor"`
Published time.Time `json:"published,omitempty"` Published time.Time `json:"published,omitempty"`
Updated *time.Time `json:"updated,omitempty"`
To []string `json:"to,omitempty"` To []string `json:"to,omitempty"`
CC []string `json:"cc,omitempty"` CC []string `json:"cc,omitempty"`
Object *Object `json:"object"` Object *Object `json:"object"`
@@ -68,6 +73,9 @@ func NewUpdateActivity(o *Object) *Activity {
Object: o, Object: o,
Published: o.Published, Published: o.Published,
} }
if o.Updated != nil && !o.Updated.IsZero() {
a.Updated = o.Updated
}
return &a return &a
} }
@@ -107,6 +115,7 @@ func NewFollowActivity(actorIRI, followeeIRI string) *FollowActivity {
type Object struct { type Object struct {
BaseObject BaseObject
Published time.Time `json:"published,omitempty"` Published time.Time `json:"published,omitempty"`
Updated *time.Time `json:"updated,omitempty"`
Summary *string `json:"summary,omitempty"` Summary *string `json:"summary,omitempty"`
InReplyTo *string `json:"inReplyTo,omitempty"` InReplyTo *string `json:"inReplyTo,omitempty"`
URL string `json:"url"` URL string `json:"url"`
@@ -118,6 +127,7 @@ type Object struct {
ContentMap map[string]string `json:"contentMap,omitempty"` ContentMap map[string]string `json:"contentMap,omitempty"`
Tag []Tag `json:"tag,omitempty"` Tag []Tag `json:"tag,omitempty"`
Attachment []Attachment `json:"attachment,omitempty"` Attachment []Attachment `json:"attachment,omitempty"`
Preview *Object `json:"preview,omitempty"`
// Person // Person
Inbox string `json:"inbox,omitempty"` Inbox string `json:"inbox,omitempty"`
@@ -130,7 +140,7 @@ type Object struct {
Endpoints *Endpoints `json:"endpoints,omitempty"` Endpoints *Endpoints `json:"endpoints,omitempty"`
// Extensions // Extensions
// NOTE: add extensions here Monetization string `json:"monetization,omitempty"`
} }
// NewNoteObject creates a basic Note object that includes the public // NewNoteObject creates a basic Note object that includes the public
@@ -139,9 +149,12 @@ func NewNoteObject() *Object {
o := Object{ o := Object{
BaseObject: BaseObject{ BaseObject: BaseObject{
Type: "Note", Type: "Note",
Context: []interface{}{
Namespace,
},
}, },
To: []string{ To: []string{
toPublic, ToPublic,
}, },
} }
return &o return &o
@@ -153,9 +166,12 @@ func NewArticleObject() *Object {
o := Object{ o := Object{
BaseObject: BaseObject{ BaseObject: BaseObject{
Type: "Article", Type: "Article",
Context: []interface{}{
Namespace,
},
}, },
To: []string{ To: []string{
toPublic, ToPublic,
}, },
} }
return &o return &o
@@ -166,7 +182,15 @@ func NewPersonObject() *Object {
o := Object{ o := Object{
BaseObject: BaseObject{ BaseObject: BaseObject{
Type: "Person", Type: "Person",
Context: []interface{}{
Namespace,
},
}, },
} }
return &o return &o
} }
func (o *Object) AddWebMonetization(wallet string) {
o.Context = append(o.Context, apMonetizationContext)
o.Monetization = wallet
}
+6 -2
View File
@@ -30,7 +30,7 @@ type (
type OrderedCollection struct { type OrderedCollection struct {
BaseObject BaseObject
TotalItems int `json:"totalItems"` TotalItems int `json:"totalItems"`
First string `json:"first"` First string `json:"first,omitempty"`
Last string `json:"last,omitempty"` Last string `json:"last,omitempty"`
} }
@@ -43,9 +43,13 @@ func NewOrderedCollection(accountRoot, collType string, items int) *OrderedColle
ID: accountRoot + "/" + collType, ID: accountRoot + "/" + collType,
Type: "OrderedCollection", Type: "OrderedCollection",
}, },
First: accountRoot + "/" + collType + "?page=1",
TotalItems: items, TotalItems: items,
} }
if items > 0 {
// Next page should only be indicated if there are potentially items on it. NOTE: with no knowledge of items-
// per-page, this still may need to be altered by the func caller.
oc.First = accountRoot + "/" + collType + "?page=1"
}
return &oc return &oc
} }
+8
View File
@@ -13,6 +13,9 @@ type Person struct {
Summary string `json:"summary"` Summary string `json:"summary"`
PublicKey PublicKey `json:"publicKey"` PublicKey PublicKey `json:"publicKey"`
Endpoints Endpoints `json:"endpoints"` Endpoints Endpoints `json:"endpoints"`
// Extensions
Monetization string `json:"monetization,omitempty"`
} }
func NewPerson(accountRoot string) *Person { func NewPerson(accountRoot string) *Person {
@@ -49,3 +52,8 @@ func (p *Person) SetPrivKey(k []byte) {
func (p *Person) GetPrivKey() []byte { func (p *Person) GetPrivKey() []byte {
return p.PublicKey.privateKey return p.PublicKey.privateKey
} }
func (p *Person) AddWebMonetization(wallet string) {
p.Context = append(p.Context, apMonetizationContext)
p.Monetization = wallet
}
+10 -5
View File
@@ -1,19 +1,24 @@
module github.com/writeas/web-core module github.com/writeas/web-core
go 1.10 go 1.25.0
require ( require (
github.com/gofrs/uuid v3.3.0+incompatible github.com/gofrs/uuid v3.3.0+incompatible
github.com/kylemcc/twitter-text-go v0.0.0-20180726194232-7f582f6736ec github.com/kylemcc/twitter-text-go v0.0.0-20180726194232-7f582f6736ec
github.com/microcosm-cc/bluemonday v1.0.23 github.com/microcosm-cc/bluemonday v1.0.23
github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/writeas/go-strip-markdown/v2 v2.1.1 github.com/writeas/go-strip-markdown/v2 v2.1.1
github.com/writeas/impart v1.1.1 github.com/writeas/impart v1.1.1
github.com/writeas/openssl-go v1.0.0 github.com/writeas/openssl-go v1.0.0
github.com/writeas/saturday v1.7.1 github.com/writeas/saturday v1.7.1
github.com/writeas/slug v1.2.0 github.com/writeas/slug v1.2.0
golang.org/x/crypto v0.1.0 golang.org/x/crypto v0.52.0
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect )
require (
github.com/aymerick/douceur v0.2.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
golang.org/x/net v0.55.0 // indirect
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 // indirect gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 // indirect
) )
+4 -48
View File
@@ -4,11 +4,6 @@ github.com/gofrs/uuid v3.3.0+incompatible h1:8K4tyRfvU1CYPgJsveYFQMhpFd/wXNM7iK6
github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kylemcc/twitter-text-go v0.0.0-20180726194232-7f582f6736ec h1:ZXWuspqypleMuJy4bzYEqlMhJnGAYpLrWe5p7W3CdvI= github.com/kylemcc/twitter-text-go v0.0.0-20180726194232-7f582f6736ec h1:ZXWuspqypleMuJy4bzYEqlMhJnGAYpLrWe5p7W3CdvI=
github.com/kylemcc/twitter-text-go v0.0.0-20180726194232-7f582f6736ec/go.mod h1:voECJzdraJmolzPBgL9Z7ANwXf4oMXaTCsIkdiPpR/g= github.com/kylemcc/twitter-text-go v0.0.0-20180726194232-7f582f6736ec/go.mod h1:voECJzdraJmolzPBgL9Z7ANwXf4oMXaTCsIkdiPpR/g=
github.com/microcosm-cc/bluemonday v1.0.23 h1:SMZe2IGa0NuHvnVNAZ+6B38gsTbi5e4sViiWJyDDqFY= github.com/microcosm-cc/bluemonday v1.0.23 h1:SMZe2IGa0NuHvnVNAZ+6B38gsTbi5e4sViiWJyDDqFY=
@@ -27,48 +22,9 @@ github.com/writeas/saturday v1.7.1 h1:lYo1EH6CYyrFObQoA9RNWHVlpZA5iYL5Opxo7PYAnZ
github.com/writeas/saturday v1.7.1/go.mod h1:ETE1EK6ogxptJpAgUbcJD0prAtX48bSloie80+tvnzQ= github.com/writeas/saturday v1.7.1/go.mod h1:ETE1EK6ogxptJpAgUbcJD0prAtX48bSloie80+tvnzQ=
github.com/writeas/slug v1.2.0 h1:EMQ+cwLiOcA6EtFwUgyw3Ge18x9uflUnOnR6bp/J+/g= github.com/writeas/slug v1.2.0 h1:EMQ+cwLiOcA6EtFwUgyw3Ge18x9uflUnOnR6bp/J+/g=
github.com/writeas/slug v1.2.0/go.mod h1:RE8shOqQP3YhsfsQe0L3RnuejfQ4Mk+JjY5YJQFubfQ= github.com/writeas/slug v1.2.0/go.mod h1:RE8shOqQP3YhsfsQe0L3RnuejfQ4Mk+JjY5YJQFubfQ=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.52.0 h1:RMs7fP2rXdep0CftQlK8Uf+kibLm7qkCcradZWYz988=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.52.0/go.mod h1:1QgfPxDqh0T2M/elOJtp9RvuR95kVjir0e6/BvEmGbc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8=
golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 h1:POO/ycCATvegFmVuPpQzZFJ+pGZeX22Ufu6fibxDVjU= gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 h1:POO/ycCATvegFmVuPpQzZFJ+pGZeX22Ufu6fibxDVjU=
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg= gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
+34
View File
@@ -0,0 +1,34 @@
package l10n
// Temporal korean localation by Hoto Ras (@ras@hoto.moe), 2024
var phrasesKO = map[string]string{
"Anonymous post": "모두의 게시물",
"Blogs": "블로그",
"Enter": "접속",
"Newer": "신규",
"Next": "다음",
"Older": "오래됨",
"Posts": "게시물",
"Previous": "이전",
"Publish to...": "다음으로 게시...",
"Publish": "게시",
"Read more...": "더 읽어보기...",
"Subscribe": "구독",
"This blog requires a password.": "이 블로그는 비밀번호가 필요합니다.",
"Toggle theme": "테마 토글",
"View posts": "게시물 보기",
"delete": "삭제",
"edit": "수정",
"email subscription confirm": "이메일을 확인하고 확인 링크를 눌러 구독을 완료하세요.",
"email subscription prompt": "새로운 소식을 보고 싶으신가요? 여기에 이메일을 입력해 구독하세요!",
"email subscription success": "구독이 완료되었습니다! 이제 앞으로의 블로그 게시물을 이메일로 받아볼 수 있어요.",
"move to...": "다음으로 이동...",
"pin": "고정",
"published with write.as": "write.as를 통해 배포됨",
"share modal ending": "친구에게 보내거나, 인터넷에 공유하거나, 트윗할 수도 있습니다. 더 알아보기",
"share modal introduction": "각각의 게시물에는 비밀이 있어요. 각자 특별한 주소가 있어 모두와 공유할 수 있답니다. 주소는 여기 있어요:",
"share modal title": "이 게시물 공유하기",
"share": "공유",
"unpin": "고정 해제",
"title dash": "&mdash;",
}
+2
View File
@@ -34,6 +34,8 @@ func Strings(lang string) map[string]string {
return phrasesIT return phrasesIT
case "ja": case "ja":
return phrasesJA return phrasesJA
case "ko":
return phrasesKO
case "lt": case "lt":
return phrasesLT return phrasesLT
case "mk": case "mk":
+33
View File
@@ -0,0 +1,33 @@
package text
import (
"github.com/kylemcc/twitter-text-go/extract"
"net/url"
"regexp"
)
var imageURLRegex = regexp.MustCompile(`(?i)[^ ]+\.(gif|png|jpg|jpeg|image)$`)
func ExtractImages(content string) []string {
matches := extract.ExtractUrls(content)
urls := map[string]bool{}
for i := range matches {
uRaw := matches[i].Text
// Parse the extracted text so we can examine the path
u, err := url.Parse(uRaw)
if err != nil {
continue
}
// Ensure the path looks like it leads to an image file
if !imageURLRegex.MatchString(u.Path) {
continue
}
urls[uRaw] = true
}
resURLs := make([]string, 0)
for k := range urls {
resURLs = append(resURLs, k)
}
return resURLs
}