From fd22e24eab9aeefdd8e023bd37bfd07f5668e2a6 Mon Sep 17 00:00:00 2001 From: Gary Date: Wed, 15 Jun 2022 14:59:07 +0800 Subject: [PATCH] CHG: replace sia with skynet --- dao/dao_records_info.go | 4 ++-- dns.go | 6 +++--- main.go | 4 ++-- sync.go | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dao/dao_records_info.go b/dao/dao_records_info.go index 3b53969..8a628a4 100644 --- a/dao/dao_records_info.go +++ b/dao/dao_records_info.go @@ -31,11 +31,11 @@ func (d *DbDao) FindRecordInfoByKeys(keys []string) (recordInfo []TableRecordsIn } func (d *DbDao) FindContentRecordInfoByMaxId(id uint64) (recordInfo []TableRecordsInfo, err error) { - err = d.db.Where("`key` IN(?) AND id > ? ", []string{"ipfs", "ipns", "sia"}, id).Find(&recordInfo).Error + err = d.db.Where("`key` IN(?) AND id > ? ", []string{"ipfs", "ipns", "skynet"}, id).Find(&recordInfo).Error return } func (d *DbDao) FindContentRecordInfoByAccount(account string) (recordInfo []TableRecordsInfo, err error) { - err = d.db.Where("`key` IN(?) AND account = ? ", []string{"ipfs", "ipns", "sia"}, account).Find(&recordInfo).Error + err = d.db.Where("`key` IN(?) AND account = ? ", []string{"ipfs", "ipns", "skynet"}, account).Find(&recordInfo).Error return } diff --git a/dns.go b/dns.go index d374c21..845923a 100644 --- a/dns.go +++ b/dns.go @@ -83,7 +83,7 @@ func (d *DNSData) updateDNSRecord(contentRecord dao.TableRecordsInfo) (dao.Table oldRecords = *d.cnameRecords content := d.ipfsCname // CNAME content for skynet - if contentRecord.Key == "sia" { + if contentRecord.Key == "skynet" { content = d.skynetCname } newRecord = cloudflare.DNSRecord{ @@ -96,14 +96,14 @@ func (d *DNSData) updateDNSRecord(contentRecord dao.TableRecordsInfo) (dao.Table oldRecords = *d.txtRecords value := contentRecord.Value // compatible with ipfs://xxx sia://xxx https://ipfs.io/ipfs/xxx - if contentRecord.Key == "sia" || contentRecord.Key == "ipfs" { + if contentRecord.Key == "skynet" || contentRecord.Key == "ipfs" { re := regexp.MustCompile(`([0-9A-Za-z-]{46})`) if results := re.FindStringSubmatch(value); len(results) == 2 { value = results[1] } } txt := "dnslink=/" + contentRecord.Key + "/" + value - if contentRecord.Key == "sia" { + if contentRecord.Key == "skynet" { txt = "dnslink=/skynet-ns/" + value } newRecord = cloudflare.DNSRecord{ diff --git a/main.go b/main.go index e240917..0d577c2 100644 --- a/main.go +++ b/main.go @@ -62,8 +62,8 @@ func runServer(ctx *cli.Context) error { } log.Info("dns data ok") - // read all das accounts that has ipfs/ipns/sia record - contentRecordList, _ := dbDao.FindRecordInfoByKeys([]string{"ipfs", "ipns", "sia"}) + // read all das accounts that has ipfs/ipns/skynet record + contentRecordList, _ := dbDao.FindRecordInfoByKeys([]string{"ipfs", "ipns", "skynet"}) jobsChanLength := len(contentRecordList) if jobsChanLength == 0 { diff --git a/sync.go b/sync.go index db2099f..1ec01f6 100644 --- a/sync.go +++ b/sync.go @@ -47,7 +47,7 @@ func findPriorityRecord(contentRecord dao.TableRecordsInfo, contentRecordList [] if priorityRecord.Id > candidateRecord.Id { priorityRecord = candidateRecord } - } else if priorityRecord.Key == "sia" { + } else if priorityRecord.Key == "skynet" { // Skynet record lowest priority priorityRecord = candidateRecord } else if candidateRecord.Key == "ipns" {