## License
[MIT](/LICENSE)
================================================
FILE: onlyoffice-server/.eslintrc.js
================================================
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir : __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
================================================
FILE: onlyoffice-server/.gitignore
================================================
# compiled output
/dist
/node_modules
# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# OS
.DS_Store
# Tests
/coverage
/.nyc_output
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
================================================
FILE: onlyoffice-server/.prettierrc
================================================
{
"singleQuote": true,
"trailingComma": "all"
}
================================================
FILE: onlyoffice-server/README.md
================================================
# Onlyoffice Server
基于 nest 的 Onlyoffice 示例。
## 快速使用
```bash
# 安装依赖
pnpm install
# 开发
pnpm run dev
# 打包
pnpm run build
```
## License
[MIT](/LICENSE)
================================================
FILE: onlyoffice-server/nest-cli.json
================================================
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"plugins": [
{
"name": "@nestjs/swagger",
"options": {
"classValidatorShim": true,
"introspectComments": true
}
}
]
}
}
================================================
FILE: onlyoffice-server/package.json
================================================
{
"name": "onlyoffice-server",
"version": "1.0.0",
"description": "",
"author": "wytxer",
"private": true,
"license": "MIT",
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"dev": "pnpm run start:test",
"start": "cross-env NODE_ENV=online nest start",
"start:test": "cross-env NODE_ENV=test nest start --watch",
"start:debug": "cross-env NODE_ENV=test nest start --debug --watch",
"start:online": "cross-env NODE_ENV=online node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@nestjs/axios": "^0.1.0",
"@nestjs/common": "^9.0.0",
"@nestjs/config": "^2.2.0",
"@nestjs/core": "^9.0.0",
"@nestjs/jwt": "^9.0.0",
"@nestjs/platform-express": "^9.0.0",
"@nestjs/serve-static": "^3.0.0",
"@nestjs/swagger": "^6.0.1",
"axios": "^0.27.2",
"chalk": "^5.0.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.2",
"cross-env": "^7.0.3",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0",
"swagger-ui-express": "^4.4.0"
},
"devDependencies": {
"@nestjs/cli": "^9.0.0",
"@nestjs/schematics": "^9.0.0",
"@nestjs/testing": "^9.0.0",
"@types/express": "^4.17.13",
"@types/jest": "28.1.4",
"@types/node": "^16.0.0",
"@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "28.1.2",
"prettier": "^2.3.2",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "28.0.5",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "4.0.0",
"typescript": "^4.3.5"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
================================================
FILE: onlyoffice-server/src/app.controller.ts
================================================
import { Controller } from '@nestjs/common';
@Controller()
export class AppController {}
================================================
FILE: onlyoffice-server/src/app.module.ts
================================================
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { ServeStaticModule } from '@nestjs/serve-static';
import { join } from 'path';
import config from './shared/config';
import { SharedModule } from './shared/shared.module';
import { AppController } from './app.controller';
import { OnlyofficeModule } from './onlyoffice/onlyoffice.module';
import { DocumentModule } from './document/document.module';
@Module({
imports: [
// 导入全局变量配置
ConfigModule.forRoot({
isGlobal: true,
expandVariables: true,
load: [config],
}),
// 静态资源服务配置
ServeStaticModule.forRoot({
serveRoot: '/static',
rootPath: join(__dirname, '..', 'static'),
}),
SharedModule,
OnlyofficeModule,
DocumentModule,
],
controllers: [AppController],
providers: [],
})
export class AppModule {}
================================================
FILE: onlyoffice-server/src/document/document.controller.ts
================================================
import { Controller, Post, Get, Body, Query } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { DocumentForceSaveDto, DocumentInfoDto } from './document.dto';
import { DocumentInfo } from './document.entity';
import { DocumentService } from './document.service';
@ApiTags('Document')
@Controller({
path: 'document',
version: '1',
})
export class DocumentController {
constructor(private documentService: DocumentService) {}
@Post('forceSave')
@ApiOperation({
summary: '强制保存文档',
description:
'通过调用 Onlyoffice 提供的指令接口间接保存文件,最终文件的报错操作还是在 editorConfig.callbackUrl 所指定的接口里面完成的',
})
async forceSave(@Body() body: DocumentForceSaveDto): Promise内容
内容
内容
内容内容内容内容内容内容内容,内容内容内容内容内容内容,内容内容内容内容内容内容内容内容内容。内容内容内容内容内容内容内容。内容内容内容内容内容内容内容。内容内容内容内容内容内容内容内容内容,内容内容内容内容内容。
内容
内容
内容
内容
================================================ FILE: onlyoffice-server/tsconfig.build.json ================================================ { "extends": "./tsconfig.json", "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] } ================================================ FILE: onlyoffice-server/tsconfig.json ================================================ { "compilerOptions": { "module": "commonjs", "declaration": true, "removeComments": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "allowSyntheticDefaultImports": true, "target": "es2017", "sourceMap": true, "outDir": "./dist", "baseUrl": "./", "incremental": true, "skipLibCheck": true, "strictNullChecks": false, "noImplicitAny": false, "strictBindCallApply": false, "forceConsistentCasingInFileNames": false, "noFallthroughCasesInSwitch": false } } ================================================ FILE: onlyoffice-vue/.editorconfig ================================================ [*.{js,jsx,ts,tsx,vue}] indent_style = space indent_size = 2 trim_trailing_whitespace = true insert_final_newline = true ================================================ FILE: onlyoffice-vue/.eslintignore ================================================ lib/ dist/ ================================================ FILE: onlyoffice-vue/.eslintrc.js ================================================ module.exports = { root: true, env: { node: true }, extends: [ 'plugin:vue/essential', '@vue/standard' ], parserOptions: { parser: 'babel-eslint' }, rules: { 'no-unused-vars': 'warn', 'vue/no-unused-components': 'warn', 'no-trailing-spaces': 'warn', 'import/newline-after-import': 'error', 'vue/mustache-interpolation-spacing': 'warn', 'vue/no-multi-spaces': 'warn' } } ================================================ FILE: onlyoffice-vue/.gitignore ================================================ .DS_Store node_modules /dist package-lock.json yarn.lock # local env files .env.local .env.*.local # Log files npm-debug.log* yarn-debug.log* yarn-error.log* # Editor directories and files .idea .vscode *.suo *.ntvs* *.njsproj *.sln *.sw? ================================================ FILE: onlyoffice-vue/LICENSE ================================================ MIT License Copyright (c) 2022 wytxer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: onlyoffice-vue/README.md ================================================ # Onlyoffice Vue 基于 Vue.js 的 Onlyoffice 示例。 ### 快速使用 ```bash # 安装依赖 pnpm install # 开发 pnpm run dev # 打包 pnpm run build ``` ## License [MIT](/LICENSE) ================================================ FILE: onlyoffice-vue/babel.config.js ================================================ module.exports = { presets: [ '@vue/cli-plugin-babel/preset' ], plugins: [ [ 'import', { libraryName: 'ant-design-vue', libraryDirectory: 'es', style: true } ] ] } ================================================ FILE: onlyoffice-vue/package.json ================================================ { "name": "onlyoffice-vue", "version": "1.0.0", "description": "", "private": true, "scripts": { "dev": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint" }, "dependencies": { "@wytxer/style-utils": "^1.0.2", "ant-design-vue": "^1.7.8", "axios": "^0.27.2", "core-js": "^3.6.5", "lodash.merge": "^4.6.2", "onlyoffice-vue": "^1.0.1", "vue": "^2.6.14", "vue-router": "^3.5.3", "vuex": "^3.6.2" }, "devDependencies": { "@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-eslint": "~4.5.0", "@vue/cli-plugin-router": "~4.5.0", "@vue/cli-plugin-vuex": "~4.5.0", "@vue/cli-service": "~4.5.0", "@vue/eslint-config-standard": "^5.1.2", "babel-eslint": "^10.1.0", "babel-plugin-import": "^1.13.5", "eslint": "^6.7.2", "eslint-plugin-import": "^2.20.2", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-standard": "^4.0.0", "eslint-plugin-vue": "^6.2.2", "less": "^3.13.1", "less-loader": "^4.1.0", "lint-staged": "^9.5.0", "vue-template-compiler": "^2.6.14" }, "engines": { "node": ">=10" }, "license": "MIT", "homepage": "https://github.com/wytxer/demo-onlyoffice/#readme", "keywords": [ "onlyoffice", "demo", "office", "vue", "nestjs", "docx" ], "author": { "name": "wytxer", "url": "https://github.com/wytxer" }, "repository": { "type": "git", "url": "git@github.com:wytxer/demo-onlyoffice.git" }, "bugs": { "url": "https://github.com/wytxer/demo-onlyoffice/issues" }, "browserslist": [ "> 1%", "last 2 versions", "not dead" ], "gitHooks": { "pre-commit": "lint-staged" }, "lint-staged": { "*.{js,jsx,vue}": [ "vue-cli-service lint", "git add" ] } } ================================================ FILE: onlyoffice-vue/public/index.html ================================================