mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 12:39:17 +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:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: success
|
description: success
|
||||||
'406':
|
content:
|
||||||
description: node already claimed
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
'500':
|
'500':
|
||||||
description: internal server error
|
description: internal server error
|
||||||
|
|
||||||
@ -285,10 +287,10 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: success
|
description: success
|
||||||
'401':
|
content:
|
||||||
description: permission denied
|
application/json:
|
||||||
'406':
|
schema:
|
||||||
description: accounts not available
|
type: boolean
|
||||||
'500':
|
'500':
|
||||||
description: internal server error
|
description: internal server error
|
||||||
|
|
||||||
@ -333,10 +335,12 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: success
|
description: success
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
'401':
|
'401':
|
||||||
description: permission denied
|
description: permission denied
|
||||||
'406':
|
|
||||||
description: username already claimed
|
|
||||||
'500':
|
'500':
|
||||||
description: internal server error
|
description: internal server error
|
||||||
|
|
||||||
@ -436,6 +440,20 @@ paths:
|
|||||||
description: permission denied
|
description: permission denied
|
||||||
'500':
|
'500':
|
||||||
description: internal server error
|
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:
|
/account/profile/image:
|
||||||
get:
|
get:
|
||||||
@ -460,6 +478,36 @@ paths:
|
|||||||
'500':
|
'500':
|
||||||
description: internal server error
|
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:
|
/account/auth:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@ -495,6 +543,24 @@ paths:
|
|||||||
'500':
|
'500':
|
||||||
description: internal server error
|
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:
|
/account/apps:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@ -3877,6 +3943,7 @@ components:
|
|||||||
- disabled
|
- disabled
|
||||||
- storageUsed
|
- storageUsed
|
||||||
- storageAvailable
|
- storageAvailable
|
||||||
|
- forwardingAddress
|
||||||
properties:
|
properties:
|
||||||
disabled:
|
disabled:
|
||||||
type: boolean
|
type: boolean
|
||||||
@ -3886,6 +3953,8 @@ components:
|
|||||||
storageAvailable:
|
storageAvailable:
|
||||||
type: number
|
type: number
|
||||||
format: int64
|
format: int64
|
||||||
|
forwardingAddress:
|
||||||
|
type: string
|
||||||
|
|
||||||
Profile:
|
Profile:
|
||||||
type: object
|
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.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||||
w.WriteHeader(http.StatusOK)
|
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,12 +56,10 @@ func GetNodeAccounts(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
func GetNodeClaimable(w http.ResponseWriter, r *http.Request) {
|
func GetNodeClaimable(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
// check if has been configured
|
body, _ := json.Marshal(!_configured);
|
||||||
if _configured {
|
w.Write(body);
|
||||||
w.WriteHeader(http.StatusNotAcceptable)
|
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||||
} else {
|
w.WriteHeader(http.StatusOK)
|
||||||
w.WriteHeader(http.StatusOK)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetNodeConfig(w http.ResponseWriter, r *http.Request) {
|
func GetNodeConfig(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -16,4 +16,7 @@ type AccountStatus struct {
|
|||||||
StorageUsed float64 `json:"storageUsed"`
|
StorageUsed float64 `json:"storageUsed"`
|
||||||
|
|
||||||
StorageAvailable float64 `json:"storageAvailable"`
|
StorageAvailable float64 `json:"storageAvailable"`
|
||||||
|
|
||||||
|
ForwardingAddress string `json:"forwardingAddress"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,6 +139,21 @@ type LabelGroup struct {
|
|||||||
Group Group
|
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 {
|
type Article struct {
|
||||||
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
||||||
ArticleId string `gorm:"not null;index:article,unique"`
|
ArticleId string `gorm:"not null;index:article,unique"`
|
||||||
@ -156,17 +171,10 @@ type Article struct {
|
|||||||
|
|
||||||
type ArticleAsset struct {
|
type ArticleAsset struct {
|
||||||
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
||||||
AssetId string `gorm:"not null;index:articleasset,unique"`
|
AssetID uint
|
||||||
ArticleID uint `gorm:"not null;index:articleasset,unique"`
|
ArticleID uint
|
||||||
Status string `gorm:"not null;index"`
|
|
||||||
Size uint64
|
|
||||||
Crc uint32
|
|
||||||
Transform string
|
|
||||||
TransformId string
|
|
||||||
TransformData string
|
|
||||||
Created int64 `gorm:"autoCreateTime"`
|
|
||||||
Updated int64 `gorm:"autoUpdateTime"`
|
|
||||||
Article Article
|
Article Article
|
||||||
|
Asset Asset
|
||||||
}
|
}
|
||||||
|
|
||||||
type ArticleTag struct {
|
type ArticleTag struct {
|
||||||
@ -253,17 +261,10 @@ type Topic struct {
|
|||||||
|
|
||||||
type TopicAsset struct {
|
type TopicAsset struct {
|
||||||
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
||||||
AssetId string `gorm:"not null;index:topicasset,unique"`
|
AssetID uint
|
||||||
TopicID uint `gorm:"not null;index:topicasset,unique"`
|
TopicID uint
|
||||||
Status string `gorm:"not null;index"`
|
|
||||||
Size uint64
|
|
||||||
Crc uint32
|
|
||||||
Transform string
|
|
||||||
TransformId string
|
|
||||||
TransformData string
|
|
||||||
Created int64 `gorm:"autoCreateTime"`
|
|
||||||
Updated int64 `gorm:"autoUpdateTime"`
|
|
||||||
Topic Topic
|
Topic Topic
|
||||||
|
Asset Asset
|
||||||
}
|
}
|
||||||
|
|
||||||
type TopicTag struct {
|
type TopicTag struct {
|
||||||
|
@ -23,7 +23,16 @@ func Claimable(t *testing.T) {
|
|||||||
r := httptest.NewRequest("GET", "/admin/claimable", nil)
|
r := httptest.NewRequest("GET", "/admin/claimable", nil)
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
app.GetNodeClaimable(w, r)
|
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")
|
t.Errorf("server not initially claimable")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user