mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
adding forwarding address
This commit is contained in:
parent
d340d81e39
commit
ce3ed4bc2c
85
doc/api.oa3
85
doc/api.oa3
@ -61,8 +61,10 @@ paths:
|
||||
responses:
|
||||
'200':
|
||||
description: success
|
||||
'406':
|
||||
description: node already claimed
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: boolean
|
||||
'500':
|
||||
description: internal server error
|
||||
|
||||
@ -285,10 +287,10 @@ paths:
|
||||
responses:
|
||||
'200':
|
||||
description: success
|
||||
'401':
|
||||
description: permission denied
|
||||
'406':
|
||||
description: accounts not available
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: boolean
|
||||
'500':
|
||||
description: internal server error
|
||||
|
||||
@ -333,10 +335,12 @@ paths:
|
||||
responses:
|
||||
'200':
|
||||
description: success
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: boolean
|
||||
'401':
|
||||
description: permission denied
|
||||
'406':
|
||||
description: username already claimed
|
||||
'500':
|
||||
description: internal server error
|
||||
|
||||
@ -436,6 +440,20 @@ paths:
|
||||
description: permission denied
|
||||
'500':
|
||||
description: internal server error
|
||||
delete:
|
||||
tags:
|
||||
- account
|
||||
description: Delete account. Access granted to valid create account token.
|
||||
operationId: remove-account
|
||||
security:
|
||||
- basicAuth: []
|
||||
responses:
|
||||
'201':
|
||||
description: successful operation
|
||||
'401':
|
||||
description: permission denied
|
||||
'500':
|
||||
description: internal server error
|
||||
|
||||
/account/profile/image:
|
||||
get:
|
||||
@ -460,6 +478,36 @@ paths:
|
||||
'500':
|
||||
description: internal server error
|
||||
|
||||
/account/assets/{assetId}:
|
||||
get:
|
||||
tags:
|
||||
- account
|
||||
description: Get asset assigned to an account. The endpoint supports byte-range requests and responds with the content-type set appropriatly. Access granted to the app tokens of the account holder and in the case of non-original assets, the contact token for accounts with which the article is shared.
|
||||
operationId: get-account-asset
|
||||
security:
|
||||
- basicAuth: []
|
||||
parameters:
|
||||
- name: assetId
|
||||
in: path
|
||||
description: specified asset id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: success
|
||||
content:
|
||||
application/octet-stream: #asset specific
|
||||
schema:
|
||||
type: string
|
||||
format: binary
|
||||
'401':
|
||||
description: permission denied
|
||||
'404':
|
||||
description: asset or article not found
|
||||
'500':
|
||||
description: internal server error
|
||||
|
||||
/account/auth:
|
||||
post:
|
||||
tags:
|
||||
@ -495,6 +543,24 @@ paths:
|
||||
'500':
|
||||
description: internal server error
|
||||
|
||||
/account/node:
|
||||
put:
|
||||
tags:
|
||||
- account
|
||||
description: Set forwarding address after export/import has completed. Access granted to valid reset token.
|
||||
operationId: set-account-node
|
||||
security:
|
||||
- basicAuth: []
|
||||
responses:
|
||||
'201':
|
||||
description: success
|
||||
'401':
|
||||
description: permission denied
|
||||
'405':
|
||||
description: failed to confirm
|
||||
'500':
|
||||
description: internal server error
|
||||
|
||||
/account/apps:
|
||||
get:
|
||||
tags:
|
||||
@ -3877,6 +3943,7 @@ components:
|
||||
- disabled
|
||||
- storageUsed
|
||||
- storageAvailable
|
||||
- forwardingAddress
|
||||
properties:
|
||||
disabled:
|
||||
type: boolean
|
||||
@ -3886,6 +3953,8 @@ components:
|
||||
storageAvailable:
|
||||
type: number
|
||||
format: int64
|
||||
forwardingAddress:
|
||||
type: string
|
||||
|
||||
Profile:
|
||||
type: object
|
||||
|
@ -102,3 +102,9 @@ func SetAccountExport(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
func SetAccountNode(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
|
@ -56,13 +56,11 @@ func GetNodeAccounts(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func GetNodeClaimable(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// check if has been configured
|
||||
if _configured {
|
||||
w.WriteHeader(http.StatusNotAcceptable)
|
||||
} else {
|
||||
body, _ := json.Marshal(!_configured);
|
||||
w.Write(body);
|
||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
}
|
||||
|
||||
func GetNodeConfig(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||
|
@ -16,4 +16,7 @@ type AccountStatus struct {
|
||||
StorageUsed float64 `json:"storageUsed"`
|
||||
|
||||
StorageAvailable float64 `json:"storageAvailable"`
|
||||
|
||||
ForwardingAddress string `json:"forwardingAddress"`
|
||||
}
|
||||
|
||||
|
@ -139,6 +139,21 @@ type LabelGroup struct {
|
||||
Group Group
|
||||
}
|
||||
|
||||
type Asset struct {
|
||||
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
||||
AssetId string `gorm:"not null;index:asset,unique"`
|
||||
AccountID uint `gorm:"not null;index:asset,unique"`
|
||||
Status string `gorm:"not null;index"`
|
||||
Size uint64
|
||||
Crc uint32
|
||||
Transform string
|
||||
TransformId string
|
||||
TransformData string
|
||||
Created int64 `gorm:"autoCreateTime"`
|
||||
Updated int64 `gorm:"autoUpdateTime"`
|
||||
Account Account
|
||||
}
|
||||
|
||||
type Article struct {
|
||||
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
||||
ArticleId string `gorm:"not null;index:article,unique"`
|
||||
@ -156,17 +171,10 @@ type Article struct {
|
||||
|
||||
type ArticleAsset struct {
|
||||
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
||||
AssetId string `gorm:"not null;index:articleasset,unique"`
|
||||
ArticleID uint `gorm:"not null;index:articleasset,unique"`
|
||||
Status string `gorm:"not null;index"`
|
||||
Size uint64
|
||||
Crc uint32
|
||||
Transform string
|
||||
TransformId string
|
||||
TransformData string
|
||||
Created int64 `gorm:"autoCreateTime"`
|
||||
Updated int64 `gorm:"autoUpdateTime"`
|
||||
AssetID uint
|
||||
ArticleID uint
|
||||
Article Article
|
||||
Asset Asset
|
||||
}
|
||||
|
||||
type ArticleTag struct {
|
||||
@ -253,17 +261,10 @@ type Topic struct {
|
||||
|
||||
type TopicAsset struct {
|
||||
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
||||
AssetId string `gorm:"not null;index:topicasset,unique"`
|
||||
TopicID uint `gorm:"not null;index:topicasset,unique"`
|
||||
Status string `gorm:"not null;index"`
|
||||
Size uint64
|
||||
Crc uint32
|
||||
Transform string
|
||||
TransformId string
|
||||
TransformData string
|
||||
Created int64 `gorm:"autoCreateTime"`
|
||||
Updated int64 `gorm:"autoUpdateTime"`
|
||||
AssetID uint
|
||||
TopicID uint
|
||||
Topic Topic
|
||||
Asset Asset
|
||||
}
|
||||
|
||||
type TopicTag struct {
|
||||
|
@ -23,7 +23,16 @@ func Claimable(t *testing.T) {
|
||||
r := httptest.NewRequest("GET", "/admin/claimable", nil)
|
||||
w := httptest.NewRecorder()
|
||||
app.GetNodeClaimable(w, r)
|
||||
if w.Code != 200 {
|
||||
|
||||
//body, _ := ioutil.ReadAll(resp.Body)
|
||||
resp := w.Result()
|
||||
dec := json.NewDecoder(resp.Body);
|
||||
var res bool
|
||||
err := dec.Decode(&res)
|
||||
if err != nil {
|
||||
t.Errorf("failed to get claimable response")
|
||||
}
|
||||
if resp.StatusCode != 200 {
|
||||
t.Errorf("server not initially claimable")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user