From c0049e6d49d37109243ae0b4086de2540ca44fe3 Mon Sep 17 00:00:00 2001 From: Rafael Caricio Date: Sun, 9 Apr 2023 01:34:07 +0200 Subject: [PATCH] Delete some more --- README.md | 8 - contracts/IERC165.json | 30 --- contracts/IERC20Metadata.json | 233 ------------------- contracts/IERC721Metadata.json | 341 ---------------------------- contracts/IGate.json | 30 --- contracts/IMinter.json | 57 ----- contracts/ISubscription.json | 87 ------- contracts/ISubscriptionAdapter.json | 137 ----------- docs/ethereum.md | 7 - docs/monero.md | 13 -- mitra-config/src/blockchain.rs | 91 -------- mitra-config/src/config.rs | 29 +-- mitra-config/src/lib.rs | 8 +- mitra-config/src/loader.rs | 8 - src/main.rs | 4 +- src/mastodon_api/instance/types.rs | 6 +- src/nodeinfo/types.rs | 6 +- 17 files changed, 14 insertions(+), 1081 deletions(-) delete mode 100644 contracts/IERC165.json delete mode 100644 contracts/IERC20Metadata.json delete mode 100644 contracts/IERC721Metadata.json delete mode 100644 contracts/IGate.json delete mode 100644 contracts/IMinter.json delete mode 100644 contracts/ISubscription.json delete mode 100644 contracts/ISubscriptionAdapter.json delete mode 100644 docs/ethereum.md delete mode 100644 docs/monero.md delete mode 100644 mitra-config/src/blockchain.rs diff --git a/README.md b/README.md index 51f7eb6..aa2eb47 100644 --- a/README.md +++ b/README.md @@ -112,14 +112,6 @@ Test connection: psql -h localhost -p 55432 -U mitra mitra ``` -### Start Monero node and wallet server - -(this step is optional) - -```shell -docker-compose --profile monero up -d -``` - ### Run web service Create config file, adjust settings if needed: diff --git a/contracts/IERC165.json b/contracts/IERC165.json deleted file mode 100644 index ff87f91..0000000 --- a/contracts/IERC165.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "IERC165", - "sourceName": "@openzeppelin/contracts/utils/introspection/IERC165.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/IERC20Metadata.json b/contracts/IERC20Metadata.json deleted file mode 100644 index 31d6425..0000000 --- a/contracts/IERC20Metadata.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "IERC20Metadata", - "sourceName": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/IERC721Metadata.json b/contracts/IERC721Metadata.json deleted file mode 100644 index 3fe3866..0000000 --- a/contracts/IERC721Metadata.json +++ /dev/null @@ -1,341 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "IERC721Metadata", - "sourceName": "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "_approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/IGate.json b/contracts/IGate.json deleted file mode 100644 index 289e2c8..0000000 --- a/contracts/IGate.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "IGate", - "sourceName": "contracts/interfaces/IGate.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "isAllowedUser", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/IMinter.json b/contracts/IMinter.json deleted file mode 100644 index febd88a..0000000 --- a/contracts/IMinter.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "IMinter", - "sourceName": "contracts/interfaces/IMinter.sol", - "abi": [ - { - "inputs": [], - "name": "collectible", - "outputs": [ - { - "internalType": "contract IERC721Metadata", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "string", - "name": "tokenURI", - "type": "string" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/ISubscription.json b/contracts/ISubscription.json deleted file mode 100644 index 57472f4..0000000 --- a/contracts/ISubscription.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "ISubscription", - "sourceName": "contracts/interfaces/ISubscription.sol", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "expires_at", - "type": "uint256" - } - ], - "name": "UpdateSubscription", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "cancel", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "send", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "withdrawReceived", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdrawReceivedAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/ISubscriptionAdapter.json b/contracts/ISubscriptionAdapter.json deleted file mode 100644 index 047a966..0000000 --- a/contracts/ISubscriptionAdapter.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "ISubscriptionAdapter", - "sourceName": "contracts/interfaces/ISubscriptionAdapter.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "configureSubscription", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "getSubscriptionPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "getSubscriptionState", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "isSubscriptionConfigured", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "subscription", - "outputs": [ - { - "internalType": "contract ISubscription", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "subscriptionToken", - "outputs": [ - { - "internalType": "contract IERC20Metadata", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/docs/ethereum.md b/docs/ethereum.md deleted file mode 100644 index ce66198..0000000 --- a/docs/ethereum.md +++ /dev/null @@ -1,7 +0,0 @@ -# Ethereum integration - -Install Ethereum client or choose a JSON-RPC API provider. - -Deploy contracts on the blockchain. Instructions can be found at https://codeberg.org/silverpill/mitra-contracts. - -Add blockchain configuration to `blockchains` array in your configuration file. diff --git a/docs/monero.md b/docs/monero.md deleted file mode 100644 index dbd532b..0000000 --- a/docs/monero.md +++ /dev/null @@ -1,13 +0,0 @@ -# Monero integration - -Install Monero node or choose a [public one](https://monero.fail/). - -Install and configure [monero-wallet-rpc](https://monerodocs.org/interacting/monero-wallet-rpc-reference/) service. Add `disable-rpc-login=1` to your `monero-wallet-rpc` configuration file (currently RPC auth is not supported in Mitra). See [example](../contrib/monero/wallet.conf). - -Start `monero-wallet-rpc`. Create a wallet for your instance: - -``` -mitractl create-monero-wallet "mitra-wallet" "passw0rd" -``` - -Add blockchain configuration to `blockchains` array in your configuration file. diff --git a/mitra-config/src/blockchain.rs b/mitra-config/src/blockchain.rs deleted file mode 100644 index 2060c71..0000000 --- a/mitra-config/src/blockchain.rs +++ /dev/null @@ -1,91 +0,0 @@ -use std::path::PathBuf; - -use serde::{Deserialize, Serialize}; - -use mitra_utils::caip2::{ChainId, ChainIdError}; - -fn default_chain_sync_step() -> u64 { 1000 } - -fn default_chain_reorg_max_depth() -> u64 { 10 } - -#[derive(Clone, Deserialize, Serialize)] -pub struct EthereumChainMetadata { - pub chain_name: String, - pub currency_name: String, - pub currency_symbol: String, - pub currency_decimals: u8, - pub public_api_url: String, - // Block explorer base URL (should be compatible with https://eips.ethereum.org/EIPS/eip-3091) - pub explorer_url: Option, -} - -#[derive(Clone, Deserialize)] -pub struct EthereumConfig { - // CAIP-2 chain ID - pub chain_id: ChainId, - // Additional information for clients - // https://github.com/ethereum-lists/chains - pub chain_metadata: Option, - - pub contract_address: String, - pub contract_dir: PathBuf, - pub api_url: String, - // Instance private key - pub signing_key: String, - - #[serde(default = "default_chain_sync_step")] - pub chain_sync_step: u64, - #[serde(default = "default_chain_reorg_max_depth")] - pub chain_reorg_max_depth: u64, -} - -impl EthereumConfig { - pub fn try_ethereum_chain_id(&self) -> Result { - self.chain_id.ethereum_chain_id() - } - - pub fn ethereum_chain_id(&self) -> u32 { - self.try_ethereum_chain_id().unwrap() - } -} - -fn default_wallet_account_index() -> u32 { 0 } - -#[derive(Clone, Deserialize)] -pub struct MoneroConfig { - pub chain_id: ChainId, - #[serde(alias = "daemon_url")] - pub node_url: String, - pub wallet_url: String, - // Wallet name and password are required when - // monero-wallet-rpc is running with --wallet-dir option - pub wallet_name: Option, - pub wallet_password: Option, - #[serde(default = "default_wallet_account_index")] - pub account_index: u32, -} - -#[derive(Clone, Deserialize)] -#[serde(untagged)] -pub enum BlockchainConfig { - Ethereum(EthereumConfig), - Monero(MoneroConfig), -} - -impl BlockchainConfig { - pub fn ethereum_config(&self) -> Option<&EthereumConfig> { - if let Self::Ethereum(ethereum_config) = self { - Some(ethereum_config) - } else { - None - } - } - - pub fn monero_config(&self) -> Option<&MoneroConfig> { - if let Self::Monero(monero_config) = self { - Some(monero_config) - } else { - None - } - } -} diff --git a/mitra-config/src/config.rs b/mitra-config/src/config.rs index aa05269..a3ea8c7 100644 --- a/mitra-config/src/config.rs +++ b/mitra-config/src/config.rs @@ -7,17 +7,16 @@ use url::Url; use mitra_utils::urls::normalize_url; -use super::blockchain::BlockchainConfig; use super::environment::Environment; use super::federation::FederationConfig; use super::limits::Limits; use super::registration::RegistrationConfig; use super::retention::RetentionConfig; -use super::MITRA_VERSION; +use super::REEF_VERSION; fn default_log_level() -> LogLevel { LogLevel::Info } -fn default_login_message() -> String { "Do not sign this message on other sites!".to_string() } +fn default_login_message() -> String { "What?!".to_string() } #[derive(Clone, Deserialize)] pub struct Config { @@ -78,12 +77,6 @@ pub struct Config { #[serde(default)] pub blocked_instances: Vec, - // Blockchain integrations - #[serde(rename = "blockchain")] - _blockchain: Option, // deprecated - #[serde(default)] - blockchains: Vec, - // IPFS pub ipfs_api_url: Option, pub ipfs_gateway_url: Option, @@ -116,18 +109,6 @@ impl Config { pub fn media_dir(&self) -> PathBuf { self.storage_dir.join("media") } - - pub fn blockchain(&self) -> Option<&BlockchainConfig> { - if let Some(ref _blockchain_config) = self._blockchain { - panic!("'blockchain' setting is not supported anymore, use 'blockchains' instead"); - } else { - match &self.blockchains[..] { - [blockchain_config] => Some(blockchain_config), - [] => None, - _ => panic!("multichain deployments are not supported"), - } - } - } } #[derive(Clone)] @@ -155,8 +136,8 @@ impl Instance { pub fn agent(&self) -> String { format!( - "Mitra {version}; {instance_url}", - version=MITRA_VERSION, + "Reef {version}; {instance_url}", + version= REEF_VERSION, instance_url=self.url(), ) } @@ -201,7 +182,7 @@ mod tests { assert_eq!(instance.hostname(), "example.com"); assert_eq!( instance.agent(), - format!("Mitra {}; https://example.com", MITRA_VERSION), + format!("Mitra {}; https://example.com", REEF_VERSION), ); } diff --git a/mitra-config/src/lib.rs b/mitra-config/src/lib.rs index 12c25f1..b13b189 100644 --- a/mitra-config/src/lib.rs +++ b/mitra-config/src/lib.rs @@ -1,4 +1,3 @@ -mod blockchain; mod config; mod environment; mod federation; @@ -7,17 +6,12 @@ mod loader; mod registration; mod retention; -pub use blockchain::{ - BlockchainConfig, - EthereumConfig, - MoneroConfig, -}; pub use config::{Config, Instance}; pub use environment::Environment; pub use loader::parse_config; pub use registration::{DefaultRole, RegistrationType}; -pub const MITRA_VERSION: &str = env!("CARGO_PKG_VERSION"); +pub const REEF_VERSION: &str = env!("CARGO_PKG_VERSION"); #[derive(thiserror::Error, Debug)] #[error("{0}")] diff --git a/mitra-config/src/loader.rs b/mitra-config/src/loader.rs index 767b0c3..a8d2e1a 100644 --- a/mitra-config/src/loader.rs +++ b/mitra-config/src/loader.rs @@ -102,14 +102,6 @@ pub fn parse_config() -> (Config, Vec<&'static str>) { }; check_directory_owner(&config.storage_dir); config.try_instance_url().expect("invalid instance URI"); - if let Some(blockchain_config) = config.blockchain() { - if let Some(ethereum_config) = blockchain_config.ethereum_config() { - ethereum_config.try_ethereum_chain_id().unwrap(); - if !ethereum_config.contract_dir.exists() { - panic!("contract directory does not exist"); - }; - }; - }; if config.ipfs_api_url.is_some() != config.ipfs_gateway_url.is_some() { panic!("both ipfs_api_url and ipfs_gateway_url must be set"); }; diff --git a/src/main.rs b/src/main.rs index cff9d07..2470e8d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,7 +36,7 @@ use mitra::mastodon_api::timelines::views::timeline_api_scope; use mitra::nodeinfo::views as nodeinfo; use mitra::webfinger::views as webfinger; use mitra::web_client::views as web_client; -use mitra_config::{parse_config, Environment, MITRA_VERSION}; +use mitra_config::{parse_config, Environment, REEF_VERSION}; use mitra_models::database::{get_database_client, create_pool}; use mitra_models::database::migrate::apply_migrations; @@ -62,7 +62,7 @@ async fn main() -> std::io::Result<()> { std::mem::drop(db_client); log::info!( "app initialized; version {}, environment = '{:?}'", - MITRA_VERSION, + REEF_VERSION, config.environment, ); diff --git a/src/mastodon_api/instance/types.rs b/src/mastodon_api/instance/types.rs index 77b8e55..071889a 100644 --- a/src/mastodon_api/instance/types.rs +++ b/src/mastodon_api/instance/types.rs @@ -3,7 +3,7 @@ use serde::Serialize; use mitra_config::{ Config, RegistrationType, - MITRA_VERSION, + REEF_VERSION, }; use mitra_utils::markdown::markdown_to_html; @@ -58,7 +58,7 @@ pub struct InstanceInfo { fn get_full_api_version(version: &str) -> String { format!( - "{0} (compatible; Mitra {1})", + "{0} (compatible; Reef {1})", MASTODON_API_VERSION, version, ) @@ -77,7 +77,7 @@ impl InstanceInfo { short_description: config.instance_short_description.clone(), description: markdown_to_html(&config.instance_description), description_source: config.instance_description.clone(), - version: get_full_api_version(MITRA_VERSION), + version: get_full_api_version(REEF_VERSION), registrations: config.registration.registration_type != RegistrationType::Invite, diff --git a/src/nodeinfo/types.rs b/src/nodeinfo/types.rs index 61ccb35..77ed515 100644 --- a/src/nodeinfo/types.rs +++ b/src/nodeinfo/types.rs @@ -2,7 +2,7 @@ use serde::Serialize; -use mitra_config::{Config, RegistrationType, MITRA_VERSION}; +use mitra_config::{Config, RegistrationType, REEF_VERSION}; const MITRA_NAME: &str = "reef"; const MITRA_REPOSITORY: &str = "https://code.caric.io/reef/reef"; @@ -19,7 +19,7 @@ impl Default for Software20 { fn default() -> Self { Self { name: MITRA_NAME.to_string(), - version: MITRA_VERSION.to_string(), + version: REEF_VERSION.to_string(), } } } @@ -35,7 +35,7 @@ impl Default for Software21 { fn default() -> Self { Self { name: MITRA_NAME.to_string(), - version: MITRA_VERSION.to_string(), + version: REEF_VERSION.to_string(), repository: MITRA_REPOSITORY.to_string(), } }