mirror of
https://github.com/makayabou/asg-server.git
synced 2026-05-02 17:43:36 +02:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
ed0d880e87
2
Makefile
2
Makefile
@ -21,7 +21,7 @@ db-upgrade:
|
||||
goose up
|
||||
|
||||
db-upgrade-raw:
|
||||
go run ./cmd/$(project_name)/main.go db-upgrade
|
||||
go run ./cmd/$(project_name)/main.go db:migrate
|
||||
|
||||
run:
|
||||
go run cmd/$(project_name)/main.go
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
@baseUrl=http://localhost:3000
|
||||
@cloudUrl=https://sms.capcom.me
|
||||
@credentials={{$dotenv CLOUD__CREDENTIALS}}
|
||||
@mobileToken={{$dotenv MOBILE__TOKEN}}
|
||||
@phone={{$dotenv PHONE}}
|
||||
|
||||
###
|
||||
@ -13,7 +14,7 @@ Content-Type: application/json
|
||||
}
|
||||
|
||||
###
|
||||
POST {{cloudUrl}}/api/3rdparty/v1/message HTTP/1.1
|
||||
POST {{baseUrl}}/api/3rdparty/v1/message HTTP/1.1
|
||||
Content-Type: application/json
|
||||
Authorization: Basic {{credentials}}
|
||||
|
||||
@ -32,11 +33,11 @@ Authorization: Basic {{credentials}}
|
||||
|
||||
###
|
||||
GET {{baseUrl}}/api/mobile/v1/message HTTP/1.1
|
||||
Authorization: Bearer KuvE4LBXzvy8QO2ZXDDMP
|
||||
Authorization: Bearer {{mobileToken}}
|
||||
|
||||
###
|
||||
PATCH {{baseUrl}}/api/mobile/v1/message HTTP/1.1
|
||||
Authorization: Bearer KuvE4LBXzvy8QO2ZXDDMP
|
||||
Authorization: Bearer {{mobileToken}}
|
||||
Content-Type: application/json
|
||||
|
||||
[
|
||||
|
||||
@ -358,6 +358,12 @@
|
||||
"79990001234"
|
||||
]
|
||||
},
|
||||
"simNumber": {
|
||||
"description": "Номер сим-карты",
|
||||
"type": "integer",
|
||||
"maximum": 3,
|
||||
"example": 1
|
||||
},
|
||||
"ttl": {
|
||||
"description": "Время жизни сообщения в секундах",
|
||||
"type": "integer",
|
||||
|
||||
@ -33,6 +33,11 @@ definitions:
|
||||
maxItems: 100
|
||||
minItems: 1
|
||||
type: array
|
||||
simNumber:
|
||||
description: Номер сим-карты
|
||||
example: 1
|
||||
maximum: 3
|
||||
type: integer
|
||||
ttl:
|
||||
description: Время жизни сообщения в секундах
|
||||
example: 86400
|
||||
|
||||
10
db/migrations/20231116233831_sim_number.sql
Normal file
10
db/migrations/20231116233831_sim_number.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- +goose Up
|
||||
-- +goose StatementBegin
|
||||
ALTER TABLE `messages`
|
||||
ADD `sim_number` tinyint(1) unsigned;
|
||||
-- +goose StatementEnd
|
||||
---
|
||||
-- +goose Down
|
||||
-- +goose StatementBegin
|
||||
ALTER TABLE `messages` DROP `sim_number`;
|
||||
-- +goose StatementEnd
|
||||
@ -48,6 +48,7 @@ type Message struct {
|
||||
Message string `gorm:"not null;type:tinytext"`
|
||||
State MessageState `gorm:"not null;type:enum('Pending','Sent','Processed','Delivered','Failed');default:Pending;index:idx_messages_device_state"`
|
||||
ValidUntil *time.Time `gorm:"type:datetime"`
|
||||
SimNumber *uint8 `gorm:"type:tinyint(1) unsigned"`
|
||||
|
||||
Device Device `gorm:"foreignKey:DeviceID;constraint:OnDelete:CASCADE"`
|
||||
Recipients []MessageRecipient `gorm:"foreignKey:MessageID;constraint:OnDelete:CASCADE"`
|
||||
|
||||
@ -62,6 +62,7 @@ func (s *MessagesService) SelectPending(deviceID string) ([]smsgateway.Message,
|
||||
Message: v.Message,
|
||||
TTL: ttl,
|
||||
PhoneNumbers: s.recipientsToDomain(v.Recipients),
|
||||
SimNumber: v.SimNumber,
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +129,7 @@ func (s *MessagesService) Enqeue(device models.Device, message smsgateway.Messag
|
||||
ExtID: message.ID,
|
||||
Message: message.Message,
|
||||
ValidUntil: validUntil,
|
||||
SimNumber: message.SimNumber,
|
||||
Recipients: s.recipientsToModel(message.PhoneNumbers),
|
||||
}
|
||||
if msg.ExtID == "" {
|
||||
|
||||
@ -15,6 +15,7 @@ type Message struct {
|
||||
ID string `json:"id,omitempty" validate:"omitempty,max=36" example:"PyDmBQZZXYmyxMwED8Fzy"` // Идентификатор
|
||||
Message string `json:"message" validate:"required,max=256" example:"Hello World!"` // Текст сообщения
|
||||
TTL *uint64 `json:"ttl,omitempty" validate:"omitempty,min=5" example:"86400"` // Время жизни сообщения в секундах
|
||||
SimNumber *uint8 `json:"simNumber,omitempty" validate:"omitempty,max=3" example:"1"` // Номер сим-карты
|
||||
PhoneNumbers []string `json:"phoneNumbers" validate:"required,min=1,max=100,dive,required,min=10" example:"79990001234"` // Получатели
|
||||
}
|
||||
|
||||
|
||||
@ -8,11 +8,13 @@ Android SMS Gateway turns your Android smartphone into an SMS gateway. It's a li
|
||||
|
||||
## Features
|
||||
|
||||
- **No registration required:** No registration or email is required to create an account.
|
||||
- **Send SMS programmatically:** Use our API to send messages directly from your own applications or services.
|
||||
- **Supports Android 5.0 and above:** The application is compatible with Android 5.0 and later versions.
|
||||
- **Message status tracking:** Monitor the status of your sent messages in real-time.
|
||||
- **Starts at boot:** The application starts running as soon as your device boots up.
|
||||
- **Prevents sleep mode:** Your device won't go to sleep while the application is running, ensuring continuous service.
|
||||
- **Supports multiple SIM cards:** The application supports multiple SIM cards.
|
||||
|
||||
## Ideal For
|
||||
|
||||
|
||||
@ -6,6 +6,13 @@ You can install app to your device from prebuilt APK or by building from sources
|
||||
|
||||
You need an Android device with Android 5.0 (Lollipop) or above for using the application.
|
||||
|
||||
### Permissions
|
||||
|
||||
To use the application, you need to grant the following permissions:
|
||||
|
||||
- **SEND_SMS**: This permission is required to send SMS messages.
|
||||
- **READ_PHONE_STATE**: This permission is required to select the SIM card. Optional, if you don't want to select the SIM card.
|
||||
|
||||
## Installation from APK
|
||||
|
||||
1. Navigate to the [Releases](https://github.com/capcom6/android-sms-gateway/releases) page.
|
||||
|
||||
5
web/mkdocs/requirements.txt
Normal file
5
web/mkdocs/requirements.txt
Normal file
@ -0,0 +1,5 @@
|
||||
mkdocs==1.5.3
|
||||
mkdocs-material==9.4.8
|
||||
mkdocs-material-extensions==1.3
|
||||
mkdocs-minify-plugin==0.7.1
|
||||
mkdocs-render-swagger-plugin==0.1.1
|
||||
Loading…
x
Reference in New Issue
Block a user