Commit 95110541 authored by rockyl's avatar rockyl

修改3

parent b8ef8b77
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const logger_1 = require("./logger"); const logger_1 = require("./logger");
const compress_1 = require("./compress"); const compress_1 = require("./compress");
const ali_oss_duiba_1 = require("ali-oss-duiba"); //import {uploadFile} from 'ali-oss-duiba'
const acceptTypes = ['image/png', 'image/jpeg']; const acceptTypes = ['image/png', 'image/jpeg'];
function applyApi(server) { function applyApi(server) {
server.get('/info', function (req, res, next) { server.get('/info', function (req, res, next) {
...@@ -27,11 +27,11 @@ async function tinify(req, res, next) { ...@@ -27,11 +27,11 @@ async function tinify(req, res, next) {
try { try {
const buffer = await (0, compress_1.compressImage)(file.path, type); const buffer = await (0, compress_1.compressImage)(file.path, type);
if (cdnPath) { if (cdnPath) {
const name = await (0, ali_oss_duiba_1.uploadFile)(buffer, cdnPath); /*const name = await uploadFile(buffer, cdnPath)
res.send({ res.send({
code: 0, code: 0,
data: name data: name
}); })*/
} }
else { else {
res.sendRaw(buffer, { res.sendRaw(buffer, {
......
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,qCAA6B;AAC7B,yCAAwC;AACxC,iDAAwC;AAExC,MAAM,WAAW,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;AAE/C,SAAwB,QAAQ,CAAC,MAAM;IACtC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,EAAE,GAAG,EAAE,IAAI;QAC3C,GAAG,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAA;QAC3C,OAAO,IAAI,EAAE,CAAA;IACd,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,GAAG,CAAC,gBAAgB,EAAE,UAAU,GAAG,EAAE,GAAG,EAAE,IAAI;QACpD,GAAG,CAAC,OAAO,CAAC,IAAI,CAA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CAAC,CAAA;gBACnD,IAAI,OAAO,EAAE;oBACZ;;;;wBAII;iBACJ;qBAAM;oBACN,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE;wBACnB,cAAc,EAAE,IAAI,CAAC,IAAI;qBACzB,CAAC,CAAA;iBACF;aACD;YAAC,OAAO,CAAC,EAAE;gBACX,gBAAM,CAAC,KAAK,CAAC,SAAS,EAAE,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,CAAA;gBACrD,GAAG,CAAC,IAAI,CAAC;oBACR,IAAI,EAAE,CAAC;oBACP,GAAG,EAAE,iBAAiB;iBACtB,CAAC,CAAA;aACF;SACD;aAAM;YACN,gBAAM,CAAC,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAA;YACrC,GAAG,CAAC,IAAI,CAAC;gBACR,IAAI,EAAE,CAAC;gBACP,GAAG,EAAE,YAAY;aACjB,CAAC,CAAA;SACF;KACD;SAAM;QACN,GAAG,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,iBAAiB;SACtB,CAAC,CAAA;KACF;IACD,OAAO,IAAI,EAAE,CAAA;AACd,CAAC"}
\ No newline at end of file \ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import logger from "./logger" import logger from "./logger"
import {compressImage} from "./compress" import {compressImage} from "./compress"
import {uploadFile} from 'ali-oss-duiba' //import {uploadFile} from 'ali-oss-duiba'
const acceptTypes = ['image/png', 'image/jpeg'] const acceptTypes = ['image/png', 'image/jpeg']
...@@ -31,11 +31,11 @@ async function tinify(req, res, next) { ...@@ -31,11 +31,11 @@ async function tinify(req, res, next) {
try { try {
const buffer = await compressImage(file.path, type) const buffer = await compressImage(file.path, type)
if (cdnPath) { if (cdnPath) {
const name = await uploadFile(buffer, cdnPath) /*const name = await uploadFile(buffer, cdnPath)
res.send({ res.send({
code: 0, code: 0,
data: name data: name
}) })*/
} else { } else {
res.sendRaw(buffer, { res.sendRaw(buffer, {
'Content-Type': file.type, 'Content-Type': file.type,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment