Skip to content

Commit

Permalink
Add package name filter (#452)
Browse files Browse the repository at this point in the history
* Add package name filter

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update bot.js

* Update bot.js

* Update bot.js

* Update bot.js
  • Loading branch information
Howard20181 authored Jul 5, 2023
1 parent 9350d47 commit f4aa01d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ function checkPackageName (packageName) {
if (!packageName.match(/\./)) return false
const groups = packageName.split('.')
for (const group of groups) {
if (!group.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) return false
if (!group.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/) || group.toLowerCase() === 'example') return false
}
blacklist = ['com.android', 'com.google', 'org.lsposed', 'io.github.lsposed'];
for (const item in blacklist) {
if(packageName.toLowerCase().startsWith(item)) return false
}
return true
}
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function run () {
}
if (label === 'invalid') {
await leaveComment(token, owner, repo, issue.number,
'It seems like your request has an invalid package name. ' +
'It seems like your request has an invalid package name, please consider another package name. (e.g. `io.github.' + owner + '.[appname]`)' +
"If that's not true, please contact a human by " +
'https://modules.lsposed.org/submission?type=appeal'
)
Expand Down Expand Up @@ -42,7 +42,7 @@ async function run () {
await closeIssue(token, owner, repo, issue.number)
} else {
await leaveComment(token, owner, repo, issue.number,
'It seems like your package name is already in use, please consider another package name. ' +
'It seems like your package name is already in use, please consider another package name. (e.g. `io.github.' + owner + '.' + title.split('.').slice(-1) + '`)' +
"If you believe that's a fraudulent use, please contact a human by " +
'https://modules.lsposed.org/submission?type=appeal'
)
Expand Down

0 comments on commit f4aa01d

Please sign in to comment.