mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-28 08:50:56 +08:00
Fix some log and UI problems (#34863)
Remove the misleading error log, fix #34738 Make the "search" input auto-focused, fix #34807
This commit is contained in:
parent
35a8e6f8e9
commit
1839110ea6
@ -91,7 +91,7 @@ func AddGPGKey(ctx context.Context, ownerID int64, content, token, signature str
|
|||||||
signer, err = openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token+"\r\n"), strings.NewReader(signature), nil)
|
signer, err = openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token+"\r\n"), strings.NewReader(signature), nil)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to validate token signature. Error: %v", err)
|
log.Debug("AddGPGKey CheckArmoredDetachedSignature failed: %v", err)
|
||||||
return nil, ErrGPGInvalidTokenSignature{
|
return nil, ErrGPGInvalidTokenSignature{
|
||||||
ID: ekeys[0].PrimaryKey.KeyIdString(),
|
ID: ekeys[0].PrimaryKey.KeyIdString(),
|
||||||
Wrapped: err,
|
Wrapped: err,
|
||||||
|
@ -85,7 +85,7 @@ func VerifyGPGKey(ctx context.Context, ownerID int64, keyID, token, signature st
|
|||||||
}
|
}
|
||||||
|
|
||||||
if signer == nil {
|
if signer == nil {
|
||||||
log.Error("Unable to validate token signature. Error: %v", err)
|
log.Debug("VerifyGPGKey failed: no signer")
|
||||||
return "", ErrGPGInvalidTokenSignature{
|
return "", ErrGPGInvalidTokenSignature{
|
||||||
ID: key.KeyID,
|
ID: key.KeyID,
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ func VerifySSHKey(ctx context.Context, ownerID int64, fingerprint, token, signat
|
|||||||
// edge case for Windows based shells that will add CR LF if piped to ssh-keygen command
|
// edge case for Windows based shells that will add CR LF if piped to ssh-keygen command
|
||||||
// see https://github.com/PowerShell/PowerShell/issues/5974
|
// see https://github.com/PowerShell/PowerShell/issues/5974
|
||||||
if sshsig.Verify(strings.NewReader(token+"\r\n"), []byte(signature), []byte(key.Content), "gitea") != nil {
|
if sshsig.Verify(strings.NewReader(token+"\r\n"), []byte(signature), []byte(key.Content), "gitea") != nil {
|
||||||
log.Error("Unable to validate token signature. Error: %v", err)
|
log.Debug("VerifySSHKey sshsig.Verify failed: %v", err)
|
||||||
return "", ErrSSHInvalidTokenSignature{
|
return "", ErrSSHInvalidTokenSignature{
|
||||||
Fingerprint: key.Fingerprint,
|
Fingerprint: key.Fingerprint,
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ export default defineComponent({
|
|||||||
return {
|
return {
|
||||||
tab,
|
tab,
|
||||||
repos: [],
|
repos: [],
|
||||||
reposTotalCount: 0,
|
reposTotalCount: null,
|
||||||
reposFilter,
|
reposFilter,
|
||||||
archivedFilter,
|
archivedFilter,
|
||||||
privateFilter,
|
privateFilter,
|
||||||
@ -113,9 +113,6 @@ export default defineComponent({
|
|||||||
const el = document.querySelector('#dashboard-repo-list');
|
const el = document.querySelector('#dashboard-repo-list');
|
||||||
this.changeReposFilter(this.reposFilter);
|
this.changeReposFilter(this.reposFilter);
|
||||||
fomanticQuery(el.querySelector('.ui.dropdown')).dropdown();
|
fomanticQuery(el.querySelector('.ui.dropdown')).dropdown();
|
||||||
nextTick(() => {
|
|
||||||
this.$refs.search?.focus();
|
|
||||||
});
|
|
||||||
|
|
||||||
this.textArchivedFilterTitles = {
|
this.textArchivedFilterTitles = {
|
||||||
'archived': this.textShowOnlyArchived,
|
'archived': this.textShowOnlyArchived,
|
||||||
@ -243,12 +240,20 @@ export default defineComponent({
|
|||||||
|
|
||||||
let response, json;
|
let response, json;
|
||||||
try {
|
try {
|
||||||
|
const firstLoad = this.reposTotalCount === null;
|
||||||
if (!this.reposTotalCount) {
|
if (!this.reposTotalCount) {
|
||||||
const totalCountSearchURL = `${this.subUrl}/repo/search?count_only=1&uid=${this.uid}&team_id=${this.teamId}&q=&page=1&mode=`;
|
const totalCountSearchURL = `${this.subUrl}/repo/search?count_only=1&uid=${this.uid}&team_id=${this.teamId}&q=&page=1&mode=`;
|
||||||
response = await GET(totalCountSearchURL);
|
response = await GET(totalCountSearchURL);
|
||||||
this.reposTotalCount = parseInt(response.headers.get('X-Total-Count') ?? '0');
|
this.reposTotalCount = parseInt(response.headers.get('X-Total-Count') ?? '0');
|
||||||
}
|
}
|
||||||
|
if (firstLoad && this.reposTotalCount) {
|
||||||
|
nextTick(() => {
|
||||||
|
// MDN: If there's no focused element, this is the Document.body or Document.documentElement.
|
||||||
|
if ((document.activeElement === document.body || document.activeElement === document.documentElement)) {
|
||||||
|
this.$refs.search.focus({preventScroll: true});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
response = await GET(searchedURL);
|
response = await GET(searchedURL);
|
||||||
json = await response.json();
|
json = await response.json();
|
||||||
} catch {
|
} catch {
|
||||||
@ -350,7 +355,7 @@ export default defineComponent({
|
|||||||
<h4 class="ui top attached header tw-flex tw-items-center">
|
<h4 class="ui top attached header tw-flex tw-items-center">
|
||||||
<div class="tw-flex-1 tw-flex tw-items-center">
|
<div class="tw-flex-1 tw-flex tw-items-center">
|
||||||
{{ textMyRepos }}
|
{{ textMyRepos }}
|
||||||
<span class="ui grey label tw-ml-2">{{ reposTotalCount }}</span>
|
<span v-if="reposTotalCount" class="ui grey label tw-ml-2">{{ reposTotalCount }}</span>
|
||||||
</div>
|
</div>
|
||||||
<a class="tw-flex tw-items-center muted" :href="subUrl + '/repo/create' + (isOrganization ? '?org=' + organizationId : '')" :data-tooltip-content="textNewRepo">
|
<a class="tw-flex tw-items-center muted" :href="subUrl + '/repo/create' + (isOrganization ? '?org=' + organizationId : '')" :data-tooltip-content="textNewRepo">
|
||||||
<svg-icon name="octicon-plus"/>
|
<svg-icon name="octicon-plus"/>
|
||||||
@ -421,7 +426,7 @@ export default defineComponent({
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="repos.length" class="ui attached table segment tw-rounded-b">
|
<div v-if="repos.length" class="ui attached table segment tw-rounded-b">
|
||||||
<ul class="repo-owner-name-list">
|
<ul class="repo-owner-name-list">
|
||||||
<li class="tw-flex tw-items-center tw-py-2" v-for="repo, index in repos" :class="{'active': index === activeIndex}" :key="repo.id">
|
<li class="tw-flex tw-items-center tw-py-2" v-for="(repo, index) in repos" :class="{'active': index === activeIndex}" :key="repo.id">
|
||||||
<a class="repo-list-link muted" :href="repo.link">
|
<a class="repo-list-link muted" :href="repo.link">
|
||||||
<svg-icon :name="repoIcon(repo)" :size="16" class="repo-list-icon"/>
|
<svg-icon :name="repoIcon(repo)" :size="16" class="repo-list-icon"/>
|
||||||
<div class="text truncate">{{ repo.full_name }}</div>
|
<div class="text truncate">{{ repo.full_name }}</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user