Skip to content

Commit d9ced31

Browse files
authored
Merge pull request #39 from cloudoptlab/fix/2.x/issue-fixes
Fix/2.x/issue fixes
2 parents 42e3940 + 62e5d87 commit d9ced31

6 files changed

Lines changed: 24 additions & 4 deletions

File tree

src/background/bookmark.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import message from '../core/message'
2+
import * as logger from '../core/logger'
23

34
function search(text: any, sender: any, sendResponse: (something: any) => void) {
45
try {
@@ -16,5 +17,11 @@ message.addListener({
1617
})
1718

1819
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
19-
message.sendTab(tabId, 'load-complete')
20+
message.sendTab(tabId, 'load-complete').then((result: any) => {
21+
// catch last error of messaging
22+
if (chrome.runtime.lastError) {
23+
logger.debug(chrome.runtime.lastError.message);
24+
}
25+
return result
26+
})
2027
})

src/content/bookmark.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class BookmarkSearch {
5858
$('#nx_query').bind('input propertychange', () => {
5959
this.sendSearch(this.getKeyword())
6060
})
61+
} else {
62+
return
6163
}
6264

6365
this.sendSearch(this.getKeyword())

src/core/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class Config {
3131

3232
let configObject: Config = {
3333
safeCloud: true,
34-
safeDownload: true,
34+
safeDownload: false,
3535
safeCoin: true,
3636
safePrivacy: true,
3737
safePotential: false,

src/core/grade.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,18 @@ export async function website(url: string): Promise<Result> {
109109
try {
110110
record = await api.gradeWebsite(host)
111111
record.safe = await record.isSafe()
112+
store.set(cacheKey, record.toString())
112113
} catch (error) {
113114
record = new Result()
114115
record.score = 60
115116
record.safe = true
117+
// When there is no record on cloudopt.net yet
118+
if (error.error === 404) {
119+
record.host = 'UNKNOWN'
120+
record.type = 'UNKNOWN'
121+
store.set(cacheKey, record.toString())
122+
}
116123
}
117-
store.set(cacheKey, record.toString())
118124
}
119125

120126
return record

src/option/component/adBlock/index.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,9 @@
102102
}
103103
}
104104
}
105+
button {
106+
&.close {
107+
outline: none;
108+
}
109+
}
105110
}

src/popup/popup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ async function initialize() {
272272
const countNode = $('#credibilityScore .score-count')
273273
countNode.text(result.score)
274274

275-
if (result.score === 0 && result.isSafe) {
275+
if (result.score === 0 && result.isSafe()) {
276276
countNode.text('?')
277277
} else if (result.score < 60) {
278278
// $('.mdl-layout__header').css('background-color', '#e53935')

0 commit comments

Comments
 (0)