Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
cc23d5ca
Unverified
Commit
cc23d5ca
authored
Feb 24, 2023
by
boojack
Committed by
GitHub
Feb 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: upgrade version to `0.11.0` (#1143)
* chore: upgrade version to `0.11.0` * chore: update
parent
9c5b44d0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
81 additions
and
26 deletions
+81
-26
system.go
server/system.go
+17
-0
version.go
server/version/version.go
+2
-2
00__user_avatar.sql
store/db/migration/prod/0.11/00__user_avatar.sql
+4
-0
01__idp.sql
store/db/migration/prod/0.11/01__idp.sql
+8
-0
02__storage.sql
store/db/migration/prod/0.11/02__storage.sql
+7
-0
LATEST__SCHEMA.sql
store/db/migration/prod/LATEST__SCHEMA.sql
+19
-1
CreateStorageServiceDialog.tsx
web/src/components/CreateStorageServiceDialog.tsx
+11
-5
SettingDialog.tsx
web/src/components/SettingDialog.tsx
+13
-18
No files found.
server/system.go
View file @
cc23d5ca
...
...
@@ -157,6 +157,21 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
g
.
GET
(
"/system/setting"
,
func
(
c
echo
.
Context
)
error
{
ctx
:=
c
.
Request
()
.
Context
()
userID
,
ok
:=
c
.
Get
(
getUserIDContextKey
())
.
(
int
)
if
!
ok
{
return
echo
.
NewHTTPError
(
http
.
StatusUnauthorized
,
"Missing user in session"
)
}
user
,
err
:=
s
.
Store
.
FindUser
(
ctx
,
&
api
.
UserFind
{
ID
:
&
userID
,
})
if
err
!=
nil
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to find user"
)
.
SetInternal
(
err
)
}
if
user
==
nil
||
user
.
Role
!=
api
.
Host
{
return
echo
.
NewHTTPError
(
http
.
StatusUnauthorized
,
"Unauthorized"
)
}
systemSettingList
,
err
:=
s
.
Store
.
FindSystemSettingList
(
ctx
,
&
api
.
SystemSettingFind
{})
if
err
!=
nil
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to find system setting list"
)
.
SetInternal
(
err
)
...
...
@@ -170,6 +185,7 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
if
!
ok
{
return
echo
.
NewHTTPError
(
http
.
StatusUnauthorized
,
"Missing user in session"
)
}
user
,
err
:=
s
.
Store
.
FindUser
(
ctx
,
&
api
.
UserFind
{
ID
:
&
userID
,
})
...
...
@@ -179,6 +195,7 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
if
user
==
nil
||
user
.
Role
!=
api
.
Host
{
return
echo
.
NewHTTPError
(
http
.
StatusUnauthorized
,
"Unauthorized"
)
}
if
err
:=
s
.
Store
.
Vacuum
(
ctx
);
err
!=
nil
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to vacuum database"
)
.
SetInternal
(
err
)
}
...
...
server/version/version.go
View file @
cc23d5ca
...
...
@@ -9,10 +9,10 @@ import (
// Version is the service current released version.
// Semantic versioning: https://semver.org/
var
Version
=
"0.1
0.3
"
var
Version
=
"0.1
1.0
"
// DevVersion is the service current development version.
var
DevVersion
=
"0.1
0.3
"
var
DevVersion
=
"0.1
1.0
"
func
GetCurrentVersion
(
mode
string
)
string
{
if
mode
==
"dev"
||
mode
==
"demo"
{
...
...
store/db/migration/prod/0.11/00__user_avatar.sql
0 → 100644
View file @
cc23d5ca
ALTER
TABLE
user
ADD
COLUMN
avatar_url
TEXT
NOT
NULL
DEFAULT
''
;
\ No newline at end of file
store/db/migration/prod/0.11/01__idp.sql
0 → 100644
View file @
cc23d5ca
-- idp
CREATE
TABLE
idp
(
id
INTEGER
PRIMARY
KEY
AUTOINCREMENT
,
name
TEXT
NOT
NULL
,
type
TEXT
NOT
NULL
,
identifier_filter
TEXT
NOT
NULL
DEFAULT
''
,
config
TEXT
NOT
NULL
DEFAULT
'{}'
);
\ No newline at end of file
store/db/migration/prod/0.11/02__storage.sql
0 → 100644
View file @
cc23d5ca
-- storage
CREATE
TABLE
storage
(
id
INTEGER
PRIMARY
KEY
AUTOINCREMENT
,
name
TEXT
NOT
NULL
,
type
TEXT
NOT
NULL
,
config
TEXT
NOT
NULL
DEFAULT
'{}'
);
\ No newline at end of file
store/db/migration/prod/LATEST__SCHEMA.sql
View file @
cc23d5ca
...
...
@@ -23,7 +23,8 @@ CREATE TABLE user (
email
TEXT
NOT
NULL
DEFAULT
''
,
nickname
TEXT
NOT
NULL
DEFAULT
''
,
password_hash
TEXT
NOT
NULL
,
open_id
TEXT
NOT
NULL
UNIQUE
open_id
TEXT
NOT
NULL
UNIQUE
,
avatar_url
TEXT
NOT
NULL
DEFAULT
''
);
-- user_setting
...
...
@@ -102,4 +103,21 @@ CREATE TABLE activity (
type
TEXT
NOT
NULL
DEFAULT
''
,
level
TEXT
NOT
NULL
CHECK
(
level
IN
(
'INFO'
,
'WARN'
,
'ERROR'
))
DEFAULT
'INFO'
,
payload
TEXT
NOT
NULL
DEFAULT
'{}'
);
-- storage
CREATE
TABLE
storage
(
id
INTEGER
PRIMARY
KEY
AUTOINCREMENT
,
name
TEXT
NOT
NULL
,
type
TEXT
NOT
NULL
,
config
TEXT
NOT
NULL
DEFAULT
'{}'
);
-- idp
CREATE
TABLE
idp
(
id
INTEGER
PRIMARY
KEY
AUTOINCREMENT
,
name
TEXT
NOT
NULL
,
type
TEXT
NOT
NULL
,
identifier_filter
TEXT
NOT
NULL
DEFAULT
''
,
config
TEXT
NOT
NULL
DEFAULT
'{}'
);
\ No newline at end of file
web/src/components/CreateStorageServiceDialog.tsx
View file @
cc23d5ca
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
Button
,
Input
,
Typography
}
from
"@mui/joy"
;
import
*
as
api
from
"../helpers/api"
;
import
{
generateDialog
}
from
"./Dialog"
;
...
...
@@ -13,7 +12,6 @@ interface Props extends DialogProps {
const
CreateStorageServiceDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
destroy
,
storage
,
confirmCallback
}
=
props
;
const
{
t
}
=
useTranslation
();
const
[
basicInfo
,
setBasicInfo
]
=
useState
({
name
:
""
,
});
...
...
@@ -95,9 +93,18 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
return
(
<>
<
div
className=
"dialog-header-container
!w-64
"
>
<
div
className=
"dialog-header-container"
>
<
p
className=
"title-text"
>
{
isCreating
?
t
(
"setting.storage-section.create-a-service"
)
:
t
(
"setting.storage-section.update-a-service"
)
}
{
isCreating
?
"Create storage"
:
"Update storage"
}
<
a
className=
"ml-2 text-sm text-blue-600 hover:opacity-80 hover:underline"
href=
"https://usememos.com/docs/storage"
target=
"_blank"
rel=
"noreferrer"
>
Learn more
<
Icon
.
ExternalLink
className=
"inline -mt-1 ml-1 w-4 h-auto opacity-80"
/>
</
a
>
</
p
>
<
button
className=
"btn close-btn"
onClick=
{
handleCloseBtnClick
}
>
<
Icon
.
X
/>
...
...
@@ -106,7 +113,6 @@ const CreateStorageServiceDialog: React.FC<Props> = (props: Props) => {
<
div
className=
"dialog-content-container"
>
<
Typography
className=
"!mb-1"
level=
"body2"
>
Name
<
span
className=
"text-sm text-gray-400 ml-1"
>
(Unique identifier)
</
span
>
</
Typography
>
<
Input
className=
"mb-2"
...
...
web/src/components/SettingDialog.tsx
View file @
cc23d5ca
import
{
Option
,
Select
}
from
"@mui/joy"
;
import
{
useState
}
from
"react"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
use
GlobalStore
,
use
UserStore
}
from
"../store/module"
;
import
{
useUserStore
}
from
"../store/module"
;
import
Icon
from
"./Icon"
;
import
{
generateDialog
}
from
"./Dialog"
;
import
BetaBadge
from
"./BetaBadge"
;
...
...
@@ -24,7 +24,6 @@ interface State {
const
SettingDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
destroy
}
=
props
;
const
{
t
}
=
useTranslation
();
const
globalStore
=
useGlobalStore
();
const
userStore
=
useUserStore
();
const
user
=
userStore
.
state
.
user
;
const
[
state
,
setState
]
=
useState
<
State
>
({
...
...
@@ -83,22 +82,18 @@ const SettingDialog: React.FC<Props> = (props: Props) => {
>
<
Icon
.
Settings2
className=
"w-4 h-auto mr-2 opacity-80"
/>
{
t
(
"setting.system"
)
}
</
span
>
{
globalStore
.
isDev
()
&&
(
<
span
onClick=
{
()
=>
handleSectionSelectorItemClick
(
"storage"
)
}
className=
{
`section-item ${state.selectedSection === "storage" ? "selected" : ""}`
}
>
<
Icon
.
Database
className=
"w-4 h-auto mr-2 opacity-80"
/>
{
t
(
"setting.storage"
)
}
<
BetaBadge
/>
</
span
>
)
}
{
globalStore
.
isDev
()
&&
(
<
span
onClick=
{
()
=>
handleSectionSelectorItemClick
(
"sso"
)
}
className=
{
`section-item ${state.selectedSection === "sso" ? "selected" : ""}`
}
>
<
Icon
.
Key
className=
"w-4 h-auto mr-2 opacity-80"
/>
{
t
(
"setting.sso"
)
}
<
BetaBadge
/>
</
span
>
)
}
<
span
onClick=
{
()
=>
handleSectionSelectorItemClick
(
"storage"
)
}
className=
{
`section-item ${state.selectedSection === "storage" ? "selected" : ""}`
}
>
<
Icon
.
Database
className=
"w-4 h-auto mr-2 opacity-80"
/>
{
t
(
"setting.storage"
)
}
<
BetaBadge
/>
</
span
>
<
span
onClick=
{
()
=>
handleSectionSelectorItemClick
(
"sso"
)
}
className=
{
`section-item ${state.selectedSection === "sso" ? "selected" : ""}`
}
>
<
Icon
.
Key
className=
"w-4 h-auto mr-2 opacity-80"
/>
{
t
(
"setting.sso"
)
}
<
BetaBadge
/>
</
span
>
</
div
>
</>
)
:
null
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment