Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.3.1 #28

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions mywords-flutter/lib/config/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ final Map<String, String> _hostIconsAssetPath = {
"www.nytimes.com": "$_iconPrefix/nytimes.png",
"www.economist.com": "$_iconPrefix/theeconomist.png",
"www.cnbc.com": "$_iconPrefix/cnbc.png",
"www.nbcnews.com": "$_iconPrefix/cnbc.png",
"www.bbc.com": "$_iconPrefix/bbc.png",
"www.bbc.co.uk": "$_iconPrefix/bbc.png",
"www.thetimes.co.uk": "$_iconPrefix/thetimes.png",
Expand All @@ -14,7 +13,7 @@ final Map<String, String> _hostIconsAssetPath = {
"www.washingtonpost.com": "$_iconPrefix/wp.png",
"www.foxnews.com": "$_iconPrefix/foxnews.png",
"apnews.com": "$_iconPrefix/ap.png",
"www.npr.org": "$_iconPrefix/ap.png",
"www.npr.org": "$_iconPrefix/npr.png",
"www.theguardian.com": "$_iconPrefix/theguardian.png",
"www.voanews.com": "$_iconPrefix/voanews.png",
"time.com": "$_iconPrefix/time.png",
Expand Down
2 changes: 1 addition & 1 deletion mywords-flutter/linux-deb/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: mywords
Version: 4.3.0
Version: 4.3.1
Section: Education
Priority: optional
Architecture: amd64
Expand Down
2 changes: 1 addition & 1 deletion mywords-flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
# version number is versionName; build number is versionCode;
version: 4.3.0+3
version: 4.3.1+3

environment:
sdk: '>=3.2.3 <4.0.0'
Expand Down
22 changes: 9 additions & 13 deletions mywords-go/client/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ func (c *Client) saveSourcesToLocal(sources []string) (err error) {
var localFixedSourcesMap = []string{
"https://cn.nytimes.com",
"https://www.bbc.co.uk",
"https://edition.cnn.com",
"https://apnews.com",
"https://www.npr.org",
"https://www.cbsnews.com",
"https://www.theguardian.com",
"https://www.voanews.com",
"https://time.com",
Expand Down Expand Up @@ -161,8 +162,9 @@ func (c *Client) getAllSources(ctx context.Context) []string {
hostsCountMap[host.Host] = host.Count
}

// 排序: 优先级: 公共源 > 按照host出现次数排序 > 私有源 > 按照source排序
// 排序: 优先级: 按照host出现次数排序 > 公共源 > 私有源 > 按照source排序
// host 通过getHostFromURL获取
// order: host count > public > private > source
sort.Slice(allSources, func(i, j int) bool {
sourceI := allSources[i]
sourceJ := allSources[j]
Expand All @@ -173,22 +175,16 @@ func (c *Client) getAllSources(ctx context.Context) []string {
countJ := hostsCountMap[hostJ]
_, isPublicI := publicSourcesMap[sourceI]
_, isPublicJ := publicSourcesMap[sourceJ]
if countI != countJ {
return countI > countJ
}
// countI == countJ
if isPublicI && !isPublicJ {
return true
}
if !isPublicI && isPublicJ {
return false
}
if isPublicI && isPublicJ {
if countI != countJ {
return countI > countJ
}
return sourceI < sourceJ
}
// all are private sources
if countI != countJ {
return countI > countJ
}
return sourceI < sourceJ
})
return allSources
Expand Down Expand Up @@ -218,7 +214,7 @@ func (c *Client) GetSourcesPublic(ctx context.Context) ([]string, error) {
return sources, nil
}
func (c *Client) getSourcesFromPublic(ctx context.Context) ([]string, error) {
const sourceURL = "https://raw.githubusercontent.com/vito-go/assets/refs/heads/dev-sources/mywords/sources.list"
const sourceURL = "https://raw.githubusercontent.com/vito-go/assets/refs/heads/master/mywords/sources.list"
req, err := http.NewRequest("GET", sourceURL, nil)
if err != nil {
return nil, err
Expand Down
47 changes: 0 additions & 47 deletions mywords-go/pkg/sources/sources.go

This file was deleted.

15 changes: 0 additions & 15 deletions mywords-go/pkg/sources/sources_test.go

This file was deleted.