Skip to content

Commit

Permalink
✨ Feature: add smms-v2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Molunerfinn committed Mar 7, 2020
1 parent 32334e9 commit 3f3ea69
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"keycode": "^2.2.0",
"lodash-id": "^0.14.0",
"lowdb": "^1.0.0",
"picgo": "^1.4.6",
"picgo": "^1.4.7",
"vue": "^2.6.10",
"vue-gallery": "^2.0.1",
"vue-lazyload": "^1.2.6",
Expand Down
88 changes: 68 additions & 20 deletions src/renderer/pages/picbeds/SMMS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,27 @@
<div class="view-title">
SM.MS设置
</div>
<div class="content">
感谢SM.MS提供的优质服务
</div>
<div style="text-align: center; margin-top: 20px;">
<el-button type="success" @click="confirm" round :disabled="defaultPicBed === 'smms'" size="mini">设为默认图床</el-button>
</div>
<el-form
ref="smms"
label-position="right"
label-width="120px"
:model="form"
size="mini">
<el-form-item
label="设定Token"
prop="token"
:rules="{
required: true, message: 'Token不能为空', trigger: 'blur'
}">
<el-input v-model="form.token" type="password" placeholder="token" @keyup.native.enter="confirm('smmsForm')"></el-input>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" @click="confirm" round>确定</el-button>
<el-button type="success" @click="setDefaultPicBed('smms')" round :disabled="defaultPicBed === 'smms'">设为默认图床</el-button>
</el-button-group>
</el-form-item>
</el-form>
</el-col>
</el-row>
</div>
Expand All @@ -23,25 +38,58 @@ import mixin from '@/utils/ConfirmButtonMixin'
mixins: [mixin]
})
export default class extends Vue {
form: ISMMSConfig = {
token: ''
}
created () {
const config = this.$db.get('picBed.smms.token') as (string | boolean)
if (typeof config !== 'boolean') {
this.form.token = config
}
}
confirm () {
this.letPicGoSaveData({
'picBed.smms': true
})
// @ts-ignore 来自mixin
this.setDefaultPicBed('smms')
const successNotification = new window.Notification('设置结果', {
body: '设置成功'
// @ts-ignore
this.$refs.smms.validate((valid) => {
if (valid) {
this.letPicGoSaveData({
'picBed.smms': this.form
})
const successNotification = new window.Notification('设置结果', {
body: '设置成功'
})
successNotification.onclick = () => {
return true
}
} else {
return false
}
})
successNotification.onclick = () => {
return true
}
}
}
</script>
<style lang='stylus'>
#smms-view
.content
text-align center
font-size 14px
color #eee
.el-form
label
line-height 22px
padding-bottom 0
color #eee
.el-input__inner
border-radius 19px
&-item
margin-bottom 10.5px
.el-radio-group
width 100%
label
width 25%
.el-radio-button__inner
width 100%
.el-radio-button:first-child
.el-radio-button__inner
border-left none
border-radius 14px 0 0 14px
.el-radio-button:last-child
.el-radio-button__inner
border-left none
border-radius 0 14px 14px 0
</style>
4 changes: 4 additions & 0 deletions src/universal/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ interface IQiniuConfig {
path: string
}

interface ISMMSConfig {
token: string
}

interface ITcYunConfig {
secretId: string,
secretKey: string,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8292,10 +8292,10 @@ performance-now@^2.1.0:
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=

picgo@^1.4.6:
version "1.4.6"
resolved "https://registry.yarnpkg.com/picgo/-/picgo-1.4.6.tgz#aa90439a253c5a07068b136a0d1426f63236735b"
integrity sha512-VNh5el0hkh0OrxqTPGkRAUtGmncr7cdKrjdvp6yf2Iwx+O+uJ4IHgKMmzAj+siJGTBENL0eWoujmzX07zAt30g==
picgo@^1.4.7:
version "1.4.7"
resolved "https://registry.yarnpkg.com/picgo/-/picgo-1.4.7.tgz#ef9bea9e765ef9d77daa32f8a14c84c345677ece"
integrity sha512-r2j/cxfKdeHn/HnN/1XwbSM/xakO8XrAM0todTAbCDd4r+zIwDcl1pms5S+8YVDqQRAd/qNE4t9XESIIjhSVtA==
dependencies:
chalk "^2.4.1"
commander "^2.17.0"
Expand Down

2 comments on commit 3f3ea69

@xlzy520
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我的smms-user自己都好久没用了,一直用的哔哩哔哩。谢谢作者,我也不用再维护了。

@Molunerfinn
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我的smms-user自己都好久没用了,一直用的哔哩哔哩。谢谢作者,我也不用再维护了。

感谢你对picgo生态的贡献!

Please sign in to comment.